[GOAL]
a b : Cardinal.{u}
n m : ℕ
⊢ IsUnit a ↔ a = 1
[PROOFSTEP]
refine'
  ⟨fun h => _, by
    rintro rfl
    exact isUnit_one⟩
[GOAL]
a b : Cardinal.{u}
n m : ℕ
⊢ a = 1 → IsUnit a
[PROOFSTEP]
rintro rfl
[GOAL]
b : Cardinal.{u}
n m : ℕ
⊢ IsUnit 1
[PROOFSTEP]
exact isUnit_one
[GOAL]
a b : Cardinal.{u}
n m : ℕ
h : IsUnit a
⊢ a = 1
[PROOFSTEP]
rcases eq_or_ne a 0 with (rfl | ha)
[GOAL]
case inl
b : Cardinal.{u}
n m : ℕ
h : IsUnit 0
⊢ 0 = 1
[PROOFSTEP]
exact (not_isUnit_zero h).elim
[GOAL]
case inr
a b : Cardinal.{u}
n m : ℕ
h : IsUnit a
ha : a ≠ 0
⊢ a = 1
[PROOFSTEP]
rw [isUnit_iff_forall_dvd] at h
[GOAL]
case inr
a b : Cardinal.{u}
n m : ℕ
h : ∀ (y : Cardinal.{u}), a ∣ y
ha : a ≠ 0
⊢ a = 1
[PROOFSTEP]
cases' h 1 with t ht
[GOAL]
case inr.intro
a b : Cardinal.{u}
n m : ℕ
h : ∀ (y : Cardinal.{u}), a ∣ y
ha : a ≠ 0
t : Cardinal.{u}
ht : 1 = a * t
⊢ a = 1
[PROOFSTEP]
rw [eq_comm, mul_eq_one_iff'] at ht
[GOAL]
case inr.intro
a b : Cardinal.{u}
n m : ℕ
h : ∀ (y : Cardinal.{u}), a ∣ y
ha : a ≠ 0
t : Cardinal.{u}
ht : a = 1 ∧ t = 1
⊢ a = 1
[PROOFSTEP]
exact ht.1
[GOAL]
case inr.intro.ha
a b : Cardinal.{u}
n m : ℕ
h : ∀ (y : Cardinal.{u}), a ∣ y
ha : a ≠ 0
t : Cardinal.{u}
ht : a * t = 1
⊢ 1 ≤ a
[PROOFSTEP]
exact one_le_iff_ne_zero.mpr ha
[GOAL]
case inr.intro.hb
a b : Cardinal.{u}
n m : ℕ
h : ∀ (y : Cardinal.{u}), a ∣ y
ha : a ≠ 0
t : Cardinal.{u}
ht : a * t = 1
⊢ 1 ≤ t
[PROOFSTEP]
apply one_le_iff_ne_zero.mpr
[GOAL]
case inr.intro.hb
a b : Cardinal.{u}
n m : ℕ
h : ∀ (y : Cardinal.{u}), a ∣ y
ha : a ≠ 0
t : Cardinal.{u}
ht : a * t = 1
⊢ t ≠ 0
[PROOFSTEP]
intro h
[GOAL]
case inr.intro.hb
a b : Cardinal.{u}
n m : ℕ
h✝ : ∀ (y : Cardinal.{u}), a ∣ y
ha : a ≠ 0
t : Cardinal.{u}
ht : a * t = 1
h : t = 0
⊢ False
[PROOFSTEP]
rw [h, mul_zero] at ht
[GOAL]
case inr.intro.hb
a b : Cardinal.{u}
n m : ℕ
h✝ : ∀ (y : Cardinal.{u}), a ∣ y
ha : a ≠ 0
t : Cardinal.{u}
ht : 0 = 1
h : t = 0
⊢ False
[PROOFSTEP]
exact zero_ne_one ht
[GOAL]
a✝ b✝ : Cardinal.{u}
n m : ℕ
a x : Cardinal.{u_1}
b0 : x ≠ 0
b : Cardinal.{u_1}
hab : x = a * b
⊢ a ≤ x
[PROOFSTEP]
simpa only [hab, mul_one] using
  mul_le_mul_left' (one_le_iff_ne_zero.2 fun h : b = 0 => b0 (by rwa [h, mul_zero] at hab )) a
[GOAL]
a✝ b✝ : Cardinal.{u}
n m : ℕ
a x : Cardinal.{u_1}
b0 : x ≠ 0
b : Cardinal.{u_1}
hab : x = a * b
h : b = 0
⊢ x = 0
[PROOFSTEP]
rwa [h, mul_zero] at hab
[GOAL]
a b : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
⊢ Prime a
[PROOFSTEP]
refine' ⟨(aleph0_pos.trans_le ha).ne', _, fun b c hbc => _⟩
[GOAL]
case refine'_1
a b : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
⊢ ¬IsUnit a
[PROOFSTEP]
rw [isUnit_iff]
[GOAL]
case refine'_1
a b : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
⊢ ¬a = 1
[PROOFSTEP]
exact (one_lt_aleph0.trans_le ha).ne'
[GOAL]
case refine'_2
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
⊢ a ∣ b ∨ a ∣ c
[PROOFSTEP]
cases' eq_or_ne (b * c) 0 with hz hz
[GOAL]
case refine'_2.inl
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c = 0
⊢ a ∣ b ∨ a ∣ c
[PROOFSTEP]
rcases mul_eq_zero.mp hz with (rfl | rfl)
[GOAL]
case refine'_2.inl.inl
a b : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
c : Cardinal.{u}
hbc : a ∣ 0 * c
hz : 0 * c = 0
⊢ a ∣ 0 ∨ a ∣ c
[PROOFSTEP]
simp
[GOAL]
case refine'_2.inl.inr
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b : Cardinal.{u}
hbc : a ∣ b * 0
hz : b * 0 = 0
⊢ a ∣ b ∨ a ∣ 0
[PROOFSTEP]
simp
[GOAL]
case refine'_2.inr
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
⊢ a ∣ b ∨ a ∣ c
[PROOFSTEP]
wlog h : c ≤ b
[GOAL]
case refine'_2.inr.inr
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
⊢ a ∣ b ∨ a ∣ c
[PROOFSTEP]
cases le_total c b <;> [skip; rw [or_comm]]
[GOAL]
case refine'_2.inr.inr
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
⊢ a ∣ b ∨ a ∣ c
[PROOFSTEP]
cases le_total c b
[GOAL]
case refine'_2.inr.inr.inl
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : c ≤ b
⊢ a ∣ b ∨ a ∣ c
[PROOFSTEP]
skip
[GOAL]
case refine'_2.inr.inr.inr
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
⊢ a ∣ b ∨ a ∣ c
[PROOFSTEP]
rw [or_comm]
[GOAL]
case refine'_2.inr.inr.inl
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : c ≤ b
⊢ a ∣ b ∨ a ∣ c
[PROOFSTEP]
apply_assumption
[GOAL]
case refine'_2.inr.inr.inr
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
⊢ a ∣ c ∨ a ∣ b
[PROOFSTEP]
apply_assumption
[GOAL]
case refine'_2.inr.inr.inl.b
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : c ≤ b
hz_symm : 0 ≠ b * c
⊢ Cardinal.{u}
case refine'_2.inr.inr.inl.n
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : c ≤ b
hz_symm : 0 ≠ b * c
⊢ ℕ
case refine'_2.inr.inr.inl.m
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : c ≤ b
hz_symm : 0 ≠ b * c
⊢ ℕ
case refine'_2.inr.inr.inl.ha
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : c ≤ b
hz_symm : 0 ≠ b * c
⊢ ℵ₀ ≤ a
case refine'_2.inr.inr.inl.hbc
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : c ≤ b
hz_symm : 0 ≠ b * c
⊢ a ∣ b * c
case refine'_2.inr.inr.inl.hz
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : c ≤ b
hz_symm : 0 ≠ b * c
⊢ b * c ≠ 0
case refine'_2.inr.inr.inl.h
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : c ≤ b
hz_symm : 0 ≠ b * c
⊢ c ≤ b
case refine'_2.inr.inr.inr.b
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ Cardinal.{u}
case refine'_2.inr.inr.inr.n
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ ℕ
case refine'_2.inr.inr.inr.m
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ ℕ
case refine'_2.inr.inr.inr.ha
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ ℵ₀ ≤ a
case refine'_2.inr.inr.inr.hbc
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ a ∣ c * b
case refine'_2.inr.inr.inr.hz
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ c * b ≠ 0
case refine'_2.inr.inr.inr.h
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ b ≤ c
[PROOFSTEP]
assumption'
[GOAL]
case refine'_2.inr.inr.inr.hbc
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ a ∣ c * b
case refine'_2.inr.inr.inr.hz
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ c * b ≠ 0
[PROOFSTEP]
all_goals rwa [mul_comm]
[GOAL]
case refine'_2.inr.inr.inr.hbc
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ a ∣ c * b
[PROOFSTEP]
rwa [mul_comm]
[GOAL]
case refine'_2.inr.inr.inr.hz
a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
this :
  ∀ {a : Cardinal.{u}} {b : Cardinal.{u}} {n m : ℕ},
    ℵ₀ ≤ a → ∀ (b c : Cardinal.{u}), a ∣ b * c → b * c ≠ 0 → c ≤ b → a ∣ b ∨ a ∣ c
h : ¬c ≤ b
h✝ : b ≤ c
hz_symm : 0 ≠ b * c
⊢ c * b ≠ 0
[PROOFSTEP]
rwa [mul_comm]
[GOAL]
a✝ a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
h : c ≤ b
⊢ a ∣ b ∨ a ∣ c
[PROOFSTEP]
left
[GOAL]
case h
a✝ a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
h : c ≤ b
⊢ a ∣ b
[PROOFSTEP]
have habc := le_of_dvd hz hbc
[GOAL]
case h
a✝ a b✝ : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
b c : Cardinal.{u}
hbc : a ∣ b * c
hz : b * c ≠ 0
h : c ≤ b
habc : a ≤ b * c
⊢ a ∣ b
[PROOFSTEP]
rwa [mul_eq_max' <| ha.trans <| habc, max_def', if_pos h] at hbc
[GOAL]
a b : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
⊢ ¬Irreducible a
[PROOFSTEP]
rw [irreducible_iff, not_and_or]
[GOAL]
a b : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
⊢ ¬¬IsUnit a ∨ ¬∀ (a_1 b : Cardinal.{u}), a = a_1 * b → IsUnit a_1 ∨ IsUnit b
[PROOFSTEP]
refine' Or.inr fun h => _
[GOAL]
a b : Cardinal.{u}
n m : ℕ
ha : ℵ₀ ≤ a
h : ∀ (a_1 b : Cardinal.{u}), a = a_1 * b → IsUnit a_1 ∨ IsUnit b
⊢ False
[PROOFSTEP]
simpa [mul_aleph0_eq ha, isUnit_iff, (one_lt_aleph0.trans_le ha).ne', one_lt_aleph0.ne'] using h a ℵ₀
[GOAL]
a b : Cardinal.{u}
n m : ℕ
⊢ ↑n ∣ ↑m ↔ n ∣ m
[PROOFSTEP]
refine' ⟨_, fun ⟨h, ht⟩ => ⟨h, by exact_mod_cast ht⟩⟩
[GOAL]
a b : Cardinal.{u}
n m : ℕ
x✝ : n ∣ m
h : ℕ
ht : m = n * h
⊢ ↑m = ↑n * ↑h
[PROOFSTEP]
exact_mod_cast ht
[GOAL]
a b : Cardinal.{u}
n m : ℕ
⊢ ↑n ∣ ↑m → n ∣ m
[PROOFSTEP]
rintro ⟨k, hk⟩
[GOAL]
case intro
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
⊢ n ∣ m
[PROOFSTEP]
have : ↑m < ℵ₀ := nat_lt_aleph0 m
[GOAL]
case intro
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
this : ↑m < ℵ₀
⊢ n ∣ m
[PROOFSTEP]
rw [hk, mul_lt_aleph0_iff] at this
[GOAL]
case intro
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
this : ↑n = 0 ∨ k = 0 ∨ ↑n < ℵ₀ ∧ k < ℵ₀
⊢ n ∣ m
[PROOFSTEP]
rcases this with (h | h | ⟨-, hk'⟩)
[GOAL]
case intro.inl
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
h : ↑n = 0
⊢ n ∣ m
case intro.inr.inl
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
h : k = 0
⊢ n ∣ m
case intro.inr.inr.intro a b : Cardinal.{u} n m : ℕ k : Cardinal.{u_1} hk : ↑m = ↑n * k hk' : k < ℵ₀ ⊢ n ∣ m
[PROOFSTEP]
iterate 2 simp only [h, mul_zero, zero_mul, Nat.cast_eq_zero] at hk ; simp [hk]
[GOAL]
case intro.inl
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
h : ↑n = 0
⊢ n ∣ m
case intro.inr.inl
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
h : k = 0
⊢ n ∣ m
case intro.inr.inr.intro a b : Cardinal.{u} n m : ℕ k : Cardinal.{u_1} hk : ↑m = ↑n * k hk' : k < ℵ₀ ⊢ n ∣ m
[PROOFSTEP]
simp only [h, mul_zero, zero_mul, Nat.cast_eq_zero] at hk
[GOAL]
case intro.inl
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
h : ↑n = 0
hk : m = 0
⊢ n ∣ m
case intro.inr.inl
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
h : k = 0
⊢ n ∣ m
case intro.inr.inr.intro a b : Cardinal.{u} n m : ℕ k : Cardinal.{u_1} hk : ↑m = ↑n * k hk' : k < ℵ₀ ⊢ n ∣ m
[PROOFSTEP]
simp [hk]
[GOAL]
case intro.inr.inl
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
h : k = 0
⊢ n ∣ m
case intro.inr.inr.intro a b : Cardinal.{u} n m : ℕ k : Cardinal.{u_1} hk : ↑m = ↑n * k hk' : k < ℵ₀ ⊢ n ∣ m
[PROOFSTEP]
simp only [h, mul_zero, zero_mul, Nat.cast_eq_zero] at hk
[GOAL]
case intro.inr.inl
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
h : k = 0
hk : m = 0
⊢ n ∣ m
case intro.inr.inr.intro a b : Cardinal.{u} n m : ℕ k : Cardinal.{u_1} hk : ↑m = ↑n * k hk' : k < ℵ₀ ⊢ n ∣ m
[PROOFSTEP]
simp [hk]
[GOAL]
case intro.inr.inr.intro
a b : Cardinal.{u}
n m : ℕ
k : Cardinal.{u_1}
hk : ↑m = ↑n * k
hk' : k < ℵ₀
⊢ n ∣ m
[PROOFSTEP]
lift k to ℕ using hk'
[GOAL]
case intro.inr.inr.intro.intro
a b : Cardinal.{u}
n m k : ℕ
hk : ↑m = ↑n * ↑k
⊢ n ∣ m
[PROOFSTEP]
exact ⟨k, by exact_mod_cast hk⟩
[GOAL]
a b : Cardinal.{u}
n m k : ℕ
hk : ↑m = ↑n * ↑k
⊢ m = n * k
[PROOFSTEP]
exact_mod_cast hk
[GOAL]
a b : Cardinal.{u}
n m : ℕ
⊢ Prime ↑n ↔ Nat.Prime n
[PROOFSTEP]
simp only [Prime, Nat.prime_iff]
[GOAL]
a b : Cardinal.{u}
n m : ℕ
⊢ (↑n ≠ 0 ∧ ¬IsUnit ↑n ∧ ∀ (a b : Cardinal.{u_1}), ↑n ∣ a * b → ↑n ∣ a ∨ ↑n ∣ b) ↔
    n ≠ 0 ∧ ¬IsUnit n ∧ ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
[PROOFSTEP]
refine' and_congr (by simp) (and_congr _ ⟨fun h b c hbc => _, fun h b c hbc => _⟩)
[GOAL]
a b : Cardinal.{u}
n m : ℕ
⊢ ↑n ≠ 0 ↔ n ≠ 0
[PROOFSTEP]
simp
[GOAL]
case refine'_1
a b : Cardinal.{u}
n m : ℕ
⊢ ¬IsUnit ↑n ↔ ¬IsUnit n
[PROOFSTEP]
simp only [isUnit_iff, Nat.isUnit_iff]
[GOAL]
case refine'_1
a b : Cardinal.{u}
n m : ℕ
⊢ ¬↑n = 1 ↔ ¬n = 1
[PROOFSTEP]
exact_mod_cast Iff.rfl
[GOAL]
case refine'_2
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : Cardinal.{u_1}), ↑n ∣ a * b → ↑n ∣ a ∨ ↑n ∣ b
b c : ℕ
hbc : n ∣ b * c
⊢ n ∣ b ∨ n ∣ c
[PROOFSTEP]
exact_mod_cast h b c (by exact_mod_cast hbc)
[GOAL]
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : Cardinal.{u_1}), ↑n ∣ a * b → ↑n ∣ a ∨ ↑n ∣ b
b c : ℕ
hbc : n ∣ b * c
⊢ ↑n ∣ ↑b * ↑c
[PROOFSTEP]
exact_mod_cast hbc
[GOAL]
case refine'_3
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
cases' lt_or_le (b * c) ℵ₀ with h' h'
[GOAL]
case refine'_3.inl
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : b * c < ℵ₀
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
rcases mul_lt_aleph0_iff.mp h' with (rfl | rfl | ⟨hb, hc⟩)
[GOAL]
case refine'_3.inl.inl
a b : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
c : Cardinal.{u_1}
hbc : ↑n ∣ 0 * c
h' : 0 * c < ℵ₀
⊢ ↑n ∣ 0 ∨ ↑n ∣ c
[PROOFSTEP]
simp
[GOAL]
case refine'_3.inl.inr.inl
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b : Cardinal.{u_1}
hbc : ↑n ∣ b * 0
h' : b * 0 < ℵ₀
⊢ ↑n ∣ b ∨ ↑n ∣ 0
[PROOFSTEP]
simp
[GOAL]
case refine'_3.inl.inr.inr.intro
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : b * c < ℵ₀
hb : b < ℵ₀
hc : c < ℵ₀
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
lift b to ℕ using hb
[GOAL]
case refine'_3.inl.inr.inr.intro.intro
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
c : Cardinal.{u_1}
hc : c < ℵ₀
b : ℕ
hbc : ↑n ∣ ↑b * c
h' : ↑b * c < ℵ₀
⊢ ↑n ∣ ↑b ∨ ↑n ∣ c
[PROOFSTEP]
lift c to ℕ using hc
[GOAL]
case refine'_3.inl.inr.inr.intro.intro.intro
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : ℕ
hbc : ↑n ∣ ↑b * ↑c
h' : ↑b * ↑c < ℵ₀
⊢ ↑n ∣ ↑b ∨ ↑n ∣ ↑c
[PROOFSTEP]
exact_mod_cast h b c (by exact_mod_cast hbc)
[GOAL]
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : ℕ
hbc : ↑n ∣ ↑b * ↑c
h' : ↑b * ↑c < ℵ₀
⊢ n ∣ b * c
[PROOFSTEP]
exact_mod_cast hbc
[GOAL]
case refine'_3.inr
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
rcases aleph0_le_mul_iff.mp h' with ⟨hb, hc, hℵ₀⟩
[GOAL]
case refine'_3.inr.intro.intro
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
have hn : (n : Cardinal) ≠ 0 := by
  intro h
  rw [h, zero_dvd_iff, mul_eq_zero] at hbc
  cases hbc <;> contradiction
[GOAL]
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
⊢ ↑n ≠ 0
[PROOFSTEP]
intro h
[GOAL]
a b✝ : Cardinal.{u}
n m : ℕ
h✝ : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
h : ↑n = 0
⊢ False
[PROOFSTEP]
rw [h, zero_dvd_iff, mul_eq_zero] at hbc
[GOAL]
a b✝ : Cardinal.{u}
n m : ℕ
h✝ : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : b = 0 ∨ c = 0
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
h : ↑n = 0
⊢ False
[PROOFSTEP]
cases hbc
[GOAL]
case inl
a b✝ : Cardinal.{u}
n m : ℕ
h✝¹ : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
h : ↑n = 0
h✝ : b = 0
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case inr
a b✝ : Cardinal.{u}
n m : ℕ
h✝¹ : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
h : ↑n = 0
h✝ : c = 0
⊢ False
[PROOFSTEP]
contradiction
[GOAL]
case refine'_3.inr.intro.intro
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
wlog hℵ₀b : ℵ₀ ≤ b
[GOAL]
case refine'_3.inr.intro.intro.inr
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
refine' (this h c b _ _ hc hb hℵ₀.symm hn (hℵ₀.resolve_left hℵ₀b)).symm
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_1
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ Cardinal.{u}
[PROOFSTEP]
try assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_1
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ Cardinal.{u}
[PROOFSTEP]
assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_2
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ Cardinal.{u}
[PROOFSTEP]
try assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_2
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ Cardinal.{u}
[PROOFSTEP]
assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_3
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ℕ
[PROOFSTEP]
try assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_3
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ℕ
[PROOFSTEP]
assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_4
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ↑n ∣ c * b
[PROOFSTEP]
try assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_4
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ↑n ∣ c * b
[PROOFSTEP]
assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_5
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ℵ₀ ≤ c * b
[PROOFSTEP]
try assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_5
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ℵ₀ ≤ c * b
[PROOFSTEP]
assumption
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_4
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ↑n ∣ c * b
case refine'_3.inr.intro.intro.inr.refine'_5
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ℵ₀ ≤ c * b
n✝ : ℕ
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
hℵ₀b : ℵ₀ ≤ b
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
rwa [mul_comm] at hbc
[GOAL]
case refine'_3.inr.intro.intro.inr.refine'_5
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
this :
  ∀ {a b : Cardinal.{u}} {n : ℕ} {m : ℕ},
    (∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b) →
      ∀ (b c : Cardinal.{u_1}),
        ↑n ∣ b * c → ℵ₀ ≤ b * c → b ≠ 0 → c ≠ 0 → ℵ₀ ≤ b ∨ ℵ₀ ≤ c → ↑n ≠ 0 → ℵ₀ ≤ b → ↑n ∣ b ∨ ↑n ∣ c
hℵ₀b : ¬ℵ₀ ≤ b
⊢ ℵ₀ ≤ c * b
n✝ : ℕ
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
hℵ₀b : ℵ₀ ≤ b
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
rwa [mul_comm] at h'
[GOAL]
n✝ : ℕ
a b✝ : Cardinal.{u}
n m : ℕ
h : ∀ (a b : ℕ), n ∣ a * b → n ∣ a ∨ n ∣ b
b c : Cardinal.{u_1}
hbc : ↑n ∣ b * c
h' : ℵ₀ ≤ b * c
hb : b ≠ 0
hc : c ≠ 0
hℵ₀ : ℵ₀ ≤ b ∨ ℵ₀ ≤ c
hn : ↑n ≠ 0
hℵ₀b : ℵ₀ ≤ b
⊢ ↑n ∣ b ∨ ↑n ∣ c
[PROOFSTEP]
exact Or.inl (dvd_of_le_of_aleph0_le hn ((nat_lt_aleph0 n).le.trans hℵ₀b) hℵ₀b)
[GOAL]
a✝ b : Cardinal.{u}
n m : ℕ
a : Cardinal.{u_1}
⊢ Prime a ↔ ℵ₀ ≤ a ∨ ∃ p, a = ↑p ∧ Nat.Prime p
[PROOFSTEP]
cases' le_or_lt ℵ₀ a with h h
[GOAL]
case inl
a✝ b : Cardinal.{u}
n m : ℕ
a : Cardinal.{u_1}
h : ℵ₀ ≤ a
⊢ Prime a ↔ ℵ₀ ≤ a ∨ ∃ p, a = ↑p ∧ Nat.Prime p
[PROOFSTEP]
simp [h]
[GOAL]
case inr
a✝ b : Cardinal.{u}
n m : ℕ
a : Cardinal.{u_1}
h : a < ℵ₀
⊢ Prime a ↔ ℵ₀ ≤ a ∨ ∃ p, a = ↑p ∧ Nat.Prime p
[PROOFSTEP]
lift a to ℕ using id h
[GOAL]
case inr.intro
a✝ b : Cardinal.{u}
n m a : ℕ
h : ↑a < ℵ₀
⊢ Prime ↑a ↔ ℵ₀ ≤ ↑a ∨ ∃ p, ↑a = ↑p ∧ Nat.Prime p
[PROOFSTEP]
simp [not_le.mpr h]
[GOAL]
a✝ b : Cardinal.{u}
n m : ℕ
a : Cardinal.{u_1}
⊢ IsPrimePow a ↔ ℵ₀ ≤ a ∨ ∃ n, a = ↑n ∧ IsPrimePow n
[PROOFSTEP]
by_cases h : ℵ₀ ≤ a
[GOAL]
case pos
a✝ b : Cardinal.{u}
n m : ℕ
a : Cardinal.{u_1}
h : ℵ₀ ≤ a
⊢ IsPrimePow a ↔ ℵ₀ ≤ a ∨ ∃ n, a = ↑n ∧ IsPrimePow n
[PROOFSTEP]
simp [h, (prime_of_aleph0_le h).isPrimePow]
[GOAL]
case neg
a✝ b : Cardinal.{u}
n m : ℕ
a : Cardinal.{u_1}
h : ¬ℵ₀ ≤ a
⊢ IsPrimePow a ↔ ℵ₀ ≤ a ∨ ∃ n, a = ↑n ∧ IsPrimePow n
[PROOFSTEP]
simp only [h, Nat.cast_inj, exists_eq_left', false_or_iff, isPrimePow_nat_iff]
[GOAL]
case neg
a✝ b : Cardinal.{u}
n m : ℕ
a : Cardinal.{u_1}
h : ¬ℵ₀ ≤ a
⊢ IsPrimePow a ↔ ∃ n, a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
lift a to ℕ using not_le.mp h
[GOAL]
case neg.intro
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
⊢ IsPrimePow ↑a ↔ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
rw [isPrimePow_def]
[GOAL]
case neg.intro
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
⊢ (∃ p k, Prime p ∧ 0 < k ∧ p ^ k = ↑a) ↔ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
refine' ⟨_, fun ⟨n, han, p, k, hp, hk, h⟩ => ⟨p, k, nat_is_prime_iff.2 hp, hk, by rw [han]; exact_mod_cast h⟩⟩
[GOAL]
a✝ b : Cardinal.{u}
n✝ m a : ℕ
h✝ : ¬ℵ₀ ≤ ↑a
x✝ : ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
n : ℕ
han : ↑a = ↑n
p k : ℕ
hp : Nat.Prime p
hk : 0 < k
h : p ^ k = n
⊢ ↑p ^ k = ↑a
[PROOFSTEP]
rw [han]
[GOAL]
a✝ b : Cardinal.{u}
n✝ m a : ℕ
h✝ : ¬ℵ₀ ≤ ↑a
x✝ : ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
n : ℕ
han : ↑a = ↑n
p k : ℕ
hp : Nat.Prime p
hk : 0 < k
h : p ^ k = n
⊢ ↑p ^ k = ↑n
[PROOFSTEP]
exact_mod_cast h
[GOAL]
case neg.intro
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
⊢ (∃ p k, Prime p ∧ 0 < k ∧ p ^ k = ↑a) → ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
rintro ⟨p, k, hp, hk, hpk⟩
[GOAL]
case neg.intro.intro.intro.intro.intro
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal.{u_1}
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
⊢ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
have key : p ^ 1 ≤ ↑a := by rw [← hpk]; apply power_le_power_left hp.ne_zero; exact_mod_cast hk
[GOAL]
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal.{u_1}
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
⊢ p ^ 1 ≤ ↑a
[PROOFSTEP]
rw [← hpk]
[GOAL]
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal.{u_1}
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
⊢ p ^ 1 ≤ p ^ k
[PROOFSTEP]
apply power_le_power_left hp.ne_zero
[GOAL]
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal.{u_1}
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
⊢ 1 ≤ ↑k
[PROOFSTEP]
exact_mod_cast hk
[GOAL]
case neg.intro.intro.intro.intro.intro
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal.{u_1}
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
key : p ^ 1 ≤ ↑a
⊢ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
rw [power_one] at key
[GOAL]
case neg.intro.intro.intro.intro.intro
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
p : Cardinal.{u_1}
k : ℕ
hp : Prime p
hk : 0 < k
hpk : p ^ k = ↑a
key : p ≤ ↑a
⊢ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
lift p to ℕ using key.trans_lt (nat_lt_aleph0 a)
[GOAL]
case neg.intro.intro.intro.intro.intro.intro
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
k : ℕ
hk : 0 < k
p : ℕ
hp : Prime ↑p
hpk : ↑p ^ k = ↑a
key : ↑p ≤ ↑a
⊢ ∃ n, ↑a = ↑n ∧ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
exact ⟨a, rfl, p, k, nat_is_prime_iff.mp hp, hk, by exact_mod_cast hpk⟩
[GOAL]
a✝ b : Cardinal.{u}
n m a : ℕ
h : ¬ℵ₀ ≤ ↑a
k : ℕ
hk : 0 < k
p : ℕ
hp : Prime ↑p
hpk : ↑p ^ k = ↑a
key : ↑p ≤ ↑a
⊢ p ^ k = a
[PROOFSTEP]
exact_mod_cast hpk


[GOAL]
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ (leftDerived F n).map f =
    (leftDerivedObjIso F n P).hom ≫
      (homologyFunctor D (ComplexShape.down ℕ) n).map ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) ≫
        (leftDerivedObjIso F n Q).inv
[PROOFSTEP]
dsimp only [Functor.leftDerived, Functor.leftDerivedObjIso]
[GOAL]
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ (projectiveResolutions C ⋙
          mapHomotopyCategory F (ComplexShape.down ℕ) ⋙ HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      f =
    ((HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).mapIso
            (HomotopyCategory.isoOfHomotopyEquiv
              (mapHomotopyEquiv F (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P))) ≪≫
          (HomotopyCategory.homologyFactors D (ComplexShape.down ℕ) n).app
            ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex)).hom ≫
      (homologyFunctor D (ComplexShape.down ℕ) n).map ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) ≫
        ((HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).mapIso
              (HomotopyCategory.isoOfHomotopyEquiv
                (mapHomotopyEquiv F (ProjectiveResolution.homotopyEquiv (projectiveResolution Y) Q))) ≪≫
            (HomotopyCategory.homologyFactors D (ComplexShape.down ℕ) n).app
              ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj Q.complex)).inv
[PROOFSTEP]
dsimp
[GOAL]
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((mapHomotopyCategory F (ComplexShape.down ℕ)).map ((projectiveResolutions C).map f)) =
    ((HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
          ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
            ((mapHomologicalComplex F (ComplexShape.down ℕ)).map
              (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom)) ≫
        𝟙
          ((HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).obj
            ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).obj
              ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex)))) ≫
      homology.map
          (_ :
            HomologicalComplex.dTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex) n ≫
                HomologicalComplex.dFrom ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex) n =
              0)
          (_ :
            HomologicalComplex.dTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj Q.complex) n ≫
                HomologicalComplex.dFrom ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj Q.complex) n =
              0)
          (HomologicalComplex.Hom.sqTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) n)
          (HomologicalComplex.Hom.sqFrom ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) n)
          (_ :
            (HomologicalComplex.Hom.sqTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) n).right =
              (HomologicalComplex.Hom.sqTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) n).right) ≫
        𝟙 (HomologicalComplex.homology ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj Q.complex) n) ≫
          (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
            ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
              ((mapHomologicalComplex F (ComplexShape.down ℕ)).map
                (ProjectiveResolution.homotopyEquiv (projectiveResolution Y) Q).inv))
[PROOFSTEP]
simp only [Category.comp_id, Category.id_comp]
[GOAL]
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((mapHomotopyCategory F (ComplexShape.down ℕ)).map ((projectiveResolutions C).map f)) =
    (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
        ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
          ((mapHomologicalComplex F (ComplexShape.down ℕ)).map
            (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom)) ≫
      homology.map
          (_ :
            HomologicalComplex.dTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex) n ≫
                HomologicalComplex.dFrom ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex) n =
              0)
          (_ :
            HomologicalComplex.dTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj Q.complex) n ≫
                HomologicalComplex.dFrom ((mapHomologicalComplex F (ComplexShape.down ℕ)).obj Q.complex) n =
              0)
          (HomologicalComplex.Hom.sqTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) n)
          (HomologicalComplex.Hom.sqFrom ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) n)
          (_ :
            (HomologicalComplex.Hom.sqTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) n).right =
              (HomologicalComplex.Hom.sqTo ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g) n).right) ≫
        (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
          ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
            ((mapHomologicalComplex F (ComplexShape.down ℕ)).map
              (ProjectiveResolution.homotopyEquiv (projectiveResolution Y) Q).inv))
[PROOFSTEP]
rw [← homologyFunctor_map, HomotopyCategory.homologyFunctor_map_factors]
[GOAL]
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((mapHomotopyCategory F (ComplexShape.down ℕ)).map ((projectiveResolutions C).map f)) =
    (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
        ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
          ((mapHomologicalComplex F (ComplexShape.down ℕ)).map
            (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom)) ≫
      (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
          ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
            ((mapHomologicalComplex F (ComplexShape.down ℕ)).map g)) ≫
        (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
          ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
            ((mapHomologicalComplex F (ComplexShape.down ℕ)).map
              (ProjectiveResolution.homotopyEquiv (projectiveResolution Y) Q).inv))
[PROOFSTEP]
simp only [← Functor.map_comp]
[GOAL]
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((mapHomotopyCategory F (ComplexShape.down ℕ)).map ((projectiveResolutions C).map f)) =
    (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
        ((mapHomologicalComplex F (ComplexShape.down ℕ)).map
          ((ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
            g ≫ (ProjectiveResolution.homotopyEquiv (projectiveResolution Y) Q).inv)))
[PROOFSTEP]
congr 1
[GOAL]
case e_a
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ (mapHomotopyCategory F (ComplexShape.down ℕ)).map ((projectiveResolutions C).map f) =
    (HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
      ((mapHomologicalComplex F (ComplexShape.down ℕ)).map
        ((ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
          g ≫ (ProjectiveResolution.homotopyEquiv (projectiveResolution Y) Q).inv))
[PROOFSTEP]
apply HomotopyCategory.eq_of_homotopy
[GOAL]
case e_a.h
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ Homotopy ((mapHomologicalComplex F (ComplexShape.down ℕ)).map (projectiveResolution.lift f))
    ((mapHomologicalComplex F (ComplexShape.down ℕ)).map
      ((ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
        g ≫ (ProjectiveResolution.homotopyEquiv (projectiveResolution Y) Q).inv))
[PROOFSTEP]
apply Functor.mapHomotopy
[GOAL]
case e_a.h.h
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ Homotopy (projectiveResolution.lift f)
    ((ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
      g ≫ (ProjectiveResolution.homotopyEquiv (projectiveResolution Y) Q).inv)
[PROOFSTEP]
apply ProjectiveResolution.liftHomotopy f
[GOAL]
case e_a.h.h.g_comm
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ projectiveResolution.lift f ≫ (projectiveResolution Y).π = (projectiveResolution X).π ≫ (ChainComplex.single₀ C).map f
[PROOFSTEP]
simp
[GOAL]
case e_a.h.h.h_comm
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Additive F
n : ℕ
X Y : C
f : X ⟶ Y
P : ProjectiveResolution X
Q : ProjectiveResolution Y
g : P.complex ⟶ Q.complex
w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f
⊢ ((ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
        g ≫ (ProjectiveResolution.homotopyEquiv (projectiveResolution Y) Q).inv) ≫
      (projectiveResolution Y).π =
    (projectiveResolution X).π ≫ (ChainComplex.single₀ C).map f
[PROOFSTEP]
simp [w]
[GOAL]
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Functor.Additive F
n : ℕ
⊢ leftDerived (𝟙 F) n = 𝟙 (Functor.leftDerived F n)
[PROOFSTEP]
simp [NatTrans.leftDerived]
[GOAL]
C : Type u
inst✝¹² : Category.{v, u} C
D : Type u_1
inst✝¹¹ : Category.{u_2, u_1} D
inst✝¹⁰ : Preadditive C
inst✝⁹ : HasZeroObject C
inst✝⁸ : HasEqualizers C
inst✝⁷ : HasImages C
inst✝⁶ : HasProjectiveResolutions C
inst✝⁵ : Preadditive D
inst✝⁴ : HasEqualizers D
inst✝³ : HasCokernels D
inst✝² : HasImages D
inst✝¹ : HasImageMaps D
F : C ⥤ D
inst✝ : Functor.Additive F
n : ℕ
⊢ 𝟙
      (projectiveResolutions C ⋙
        Functor.mapHomotopyCategory F (ComplexShape.down ℕ) ⋙
          HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n) =
    𝟙 (Functor.leftDerived F n)
[PROOFSTEP]
rfl
[GOAL]
C : Type u
inst✝¹⁴ : Category.{v, u} C
D : Type u_1
inst✝¹³ : Category.{u_2, u_1} D
inst✝¹² : Preadditive C
inst✝¹¹ : HasZeroObject C
inst✝¹⁰ : HasEqualizers C
inst✝⁹ : HasImages C
inst✝⁸ : HasProjectiveResolutions C
inst✝⁷ : Preadditive D
inst✝⁶ : HasEqualizers D
inst✝⁵ : HasCokernels D
inst✝⁴ : HasImages D
inst✝³ : HasImageMaps D
F G H : C ⥤ D
inst✝² : Functor.Additive F
inst✝¹ : Functor.Additive G
inst✝ : Functor.Additive H
α : F ⟶ G
β : G ⟶ H
n : ℕ
⊢ leftDerived (α ≫ β) n = leftDerived α n ≫ leftDerived β n
[PROOFSTEP]
simp [NatTrans.leftDerived]
[GOAL]
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ app (leftDerived α n) X =
    (Functor.leftDerivedObjIso F n P).hom ≫
      (homologyFunctor D (ComplexShape.down ℕ) n).map (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) ≫
        (Functor.leftDerivedObjIso G n P).inv
[PROOFSTEP]
symm
[GOAL]
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ (Functor.leftDerivedObjIso F n P).hom ≫
      (homologyFunctor D (ComplexShape.down ℕ) n).map (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) ≫
        (Functor.leftDerivedObjIso G n P).inv =
    app (leftDerived α n) X
[PROOFSTEP]
dsimp [NatTrans.leftDerived, Functor.leftDerivedObjIso]
[GOAL]
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ ((HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
          ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
            ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).map
              (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom)) ≫
        𝟙
          ((HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).obj
            ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).obj
              ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex)))) ≫
      homology.map
          (_ :
            HomologicalComplex.dTo ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex) n ≫
                HomologicalComplex.dFrom ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex) n =
              0)
          (_ :
            HomologicalComplex.dTo ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).obj P.complex) n ≫
                HomologicalComplex.dFrom ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).obj P.complex) n =
              0)
          (HomologicalComplex.Hom.sqTo (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) n)
          (HomologicalComplex.Hom.sqFrom (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) n)
          (_ :
            (HomologicalComplex.Hom.sqTo (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) n).right =
              (HomologicalComplex.Hom.sqTo (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) n).right) ≫
        𝟙 (HomologicalComplex.homology ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).obj P.complex) n) ≫
          (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
            ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
              ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map
                (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).inv)) =
    (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
        (app (mapHomologicalComplex α (ComplexShape.down ℕ)) ((projectiveResolutions C).obj X).as))
[PROOFSTEP]
simp only [Category.comp_id, Category.id_comp]
[GOAL]
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
        ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
          ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).map
            (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom)) ≫
      homology.map
          (_ :
            HomologicalComplex.dTo ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex) n ≫
                HomologicalComplex.dFrom ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).obj P.complex) n =
              0)
          (_ :
            HomologicalComplex.dTo ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).obj P.complex) n ≫
                HomologicalComplex.dFrom ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).obj P.complex) n =
              0)
          (HomologicalComplex.Hom.sqTo (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) n)
          (HomologicalComplex.Hom.sqFrom (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) n)
          (_ :
            (HomologicalComplex.Hom.sqTo (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) n).right =
              (HomologicalComplex.Hom.sqTo (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex) n).right) ≫
        (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
          ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
            ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map
              (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).inv)) =
    (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
        (app (mapHomologicalComplex α (ComplexShape.down ℕ)) ((projectiveResolutions C).obj X).as))
[PROOFSTEP]
rw [← homologyFunctor_map, HomotopyCategory.homologyFunctor_map_factors]
[GOAL]
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
        ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
          ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).map
            (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom)) ≫
      (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
          ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
            (app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex)) ≫
        (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
          ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
            ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map
              (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).inv)) =
    (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
        (app (mapHomologicalComplex α (ComplexShape.down ℕ)) ((projectiveResolutions C).obj X).as))
[PROOFSTEP]
simp only [← Functor.map_comp]
[GOAL]
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
        ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).map
            (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
          app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex ≫
            (Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map
              (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).inv)) =
    (HomotopyCategory.homologyFunctor D (ComplexShape.down ℕ) n).map
      ((HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
        (app (mapHomologicalComplex α (ComplexShape.down ℕ)) ((projectiveResolutions C).obj X).as))
[PROOFSTEP]
congr 1
[GOAL]
case e_a
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ (HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
      ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).map
          (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
        app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex ≫
          (Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map
            (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).inv) =
    (HomotopyCategory.quotient D (ComplexShape.down ℕ)).map
      (app (mapHomologicalComplex α (ComplexShape.down ℕ)) ((projectiveResolutions C).obj X).as)
[PROOFSTEP]
apply HomotopyCategory.eq_of_homotopy
[GOAL]
case e_a.h
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ Homotopy
    ((Functor.mapHomologicalComplex F (ComplexShape.down ℕ)).map
        (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
      app (mapHomologicalComplex α (ComplexShape.down ℕ)) P.complex ≫
        (Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map
          (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).inv)
    (app (mapHomologicalComplex α (ComplexShape.down ℕ)) ((projectiveResolutions C).obj X).as)
[PROOFSTEP]
simp only [NatTrans.mapHomologicalComplex_naturality_assoc, ← Functor.map_comp]
[GOAL]
case e_a.h
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ Homotopy
    (app (mapHomologicalComplex α (ComplexShape.down ℕ)) ((projectiveResolutions C).obj X).as ≫
      (Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map
        ((ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
          (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).inv))
    (app (mapHomologicalComplex α (ComplexShape.down ℕ)) ((projectiveResolutions C).obj X).as)
[PROOFSTEP]
apply Homotopy.compLeftId
[GOAL]
case e_a.h.h
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ Homotopy
    ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map
      ((ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).hom ≫
        (ProjectiveResolution.homotopyEquiv (projectiveResolution X) P).inv))
    (𝟙 ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).obj ((projectiveResolutions C).obj X).as))
[PROOFSTEP]
refine' (Functor.mapHomotopy _ (HomotopyEquiv.homotopyHomInvId _)).trans _
[GOAL]
case e_a.h.h
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ Homotopy ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map (𝟙 ((projectiveResolutions C).obj X).as))
    (𝟙 ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).obj ((projectiveResolutions C).obj X).as))
[PROOFSTEP]
apply Homotopy.ofEq
[GOAL]
case e_a.h.h.h
C : Type u
inst✝¹³ : Category.{v, u} C
D : Type u_1
inst✝¹² : Category.{u_2, u_1} D
inst✝¹¹ : Preadditive C
inst✝¹⁰ : HasZeroObject C
inst✝⁹ : HasEqualizers C
inst✝⁸ : HasImages C
inst✝⁷ : HasProjectiveResolutions C
inst✝⁶ : Preadditive D
inst✝⁵ : HasEqualizers D
inst✝⁴ : HasCokernels D
inst✝³ : HasImages D
inst✝² : HasImageMaps D
F G : C ⥤ D
inst✝¹ : Functor.Additive F
inst✝ : Functor.Additive G
α : F ⟶ G
n : ℕ
X : C
P : ProjectiveResolution X
⊢ (Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).map (𝟙 ((projectiveResolutions C).obj X).as) =
    𝟙 ((Functor.mapHomologicalComplex G (ComplexShape.down ℕ)).obj ((projectiveResolutions C).obj X).as)
[PROOFSTEP]
simp only [Functor.map_id]


[GOAL]
n : ℕ
hn1 : n ≠ 1
hn : Odd n
⊢ (n + 1)# = n#
[PROOFSTEP]
refine prod_congr ?_ fun _ _ ↦ rfl
[GOAL]
n : ℕ
hn1 : n ≠ 1
hn : Odd n
⊢ filter Nat.Prime (range (n + 1 + 1)) = filter Nat.Prime (range (n + 1))
[PROOFSTEP]
rw [range_succ, filter_insert, if_neg fun h ↦ odd_iff_not_even.mp hn _]
[GOAL]
n : ℕ
hn1 : n ≠ 1
hn : Odd n
⊢ Nat.Prime (n + 1) → Even n
[PROOFSTEP]
exact fun h ↦ h.even_sub_one <| mt succ.inj hn1
[GOAL]
m n : ℕ
⊢ (m + n)# = m# * ∏ p in filter Nat.Prime (Ico (m + 1) (m + n + 1)), p
[PROOFSTEP]
rw [primorial, primorial, ← Ico_zero_eq_range, ← prod_union, ← filter_union, Ico_union_Ico_eq_Ico]
[GOAL]
case hab
m n : ℕ
⊢ 0 ≤ m + 1
case hbc
m n : ℕ
⊢ m + 1 ≤ m + n + 1
m n : ℕ ⊢ Disjoint (filter Nat.Prime (Ico 0 (m + 1))) (filter Nat.Prime (Ico (m + 1) (m + n + 1)))
[PROOFSTEP]
exacts [Nat.zero_le _, add_le_add_right (Nat.le_add_right _ _) _,
  disjoint_filter_filter <| Ico_disjoint_Ico_consecutive _ _ _]
[GOAL]
m n : ℕ
h : n ≤ m
p : ℕ
hp : p ∈ filter Nat.Prime (Ico (m + 1) (m + n + 1))
⊢ p ∣ Nat.choose (m + n) m
[PROOFSTEP]
rw [mem_filter, mem_Ico] at hp
[GOAL]
m n : ℕ
h : n ≤ m
p : ℕ
hp : (m + 1 ≤ p ∧ p < m + n + 1) ∧ Nat.Prime p
⊢ p ∣ Nat.choose (m + n) m
[PROOFSTEP]
exact hp.2.dvd_choose_add hp.1.1 (h.trans_lt (m.lt_succ_self.trans_le hp.1.1)) (Nat.lt_succ_iff.1 hp.1.2)
[GOAL]
n : ℕ
⊢ n# ≤ 4 ^ n
[PROOFSTEP]
induction' n using Nat.strong_induction_on with n ihn
[GOAL]
case h
n : ℕ
ihn : ∀ (m : ℕ), m < n → m# ≤ 4 ^ m
⊢ n# ≤ 4 ^ n
[PROOFSTEP]
cases' n with n
[GOAL]
case h.zero
ihn : ∀ (m : ℕ), m < zero → m# ≤ 4 ^ m
⊢ zero# ≤ 4 ^ zero
[PROOFSTEP]
rfl
[GOAL]
case h.succ
n : ℕ
ihn : ∀ (m : ℕ), m < succ n → m# ≤ 4 ^ m
⊢ succ n# ≤ 4 ^ succ n
[PROOFSTEP]
rcases n.even_or_odd with (⟨m, rfl⟩ | ho)
[GOAL]
case h.succ.inl.intro
m : ℕ
ihn : ∀ (m_1 : ℕ), m_1 < succ (m + m) → m_1# ≤ 4 ^ m_1
⊢ succ (m + m)# ≤ 4 ^ succ (m + m)
[PROOFSTEP]
rcases m.eq_zero_or_pos with (rfl | hm)
[GOAL]
case h.succ.inl.intro.inl
ihn : ∀ (m : ℕ), m < succ (0 + 0) → m# ≤ 4 ^ m
⊢ succ (0 + 0)# ≤ 4 ^ succ (0 + 0)
[PROOFSTEP]
decide
[GOAL]
case h.succ.inl.intro.inr
m : ℕ
ihn : ∀ (m_1 : ℕ), m_1 < succ (m + m) → m_1# ≤ 4 ^ m_1
hm : m > 0
⊢ succ (m + m)# ≤ 4 ^ succ (m + m)
[PROOFSTEP]
calc
  (m + m + 1)# = (m + 1 + m)# := by rw [add_right_comm]
  _ ≤ (m + 1)# * choose (m + 1 + m) (m + 1) := (primorial_add_le m.le_succ)
  _ = (m + 1)# * choose (2 * m + 1) m := by rw [choose_symm_add, two_mul, add_right_comm]
  _ ≤ 4 ^ (m + 1) * 4 ^ m :=
    (mul_le_mul' (ihn _ <| succ_lt_succ <| (lt_add_iff_pos_left _).2 hm) (choose_middle_le_pow _))
  _ ≤ 4 ^ (m + m + 1) := by rw [← pow_add, add_right_comm]
[GOAL]
m : ℕ
ihn : ∀ (m_1 : ℕ), m_1 < succ (m + m) → m_1# ≤ 4 ^ m_1
hm : m > 0
⊢ (m + m + 1)# = (m + 1 + m)#
[PROOFSTEP]
rw [add_right_comm]
[GOAL]
m : ℕ
ihn : ∀ (m_1 : ℕ), m_1 < succ (m + m) → m_1# ≤ 4 ^ m_1
hm : m > 0
⊢ (m + 1)# * Nat.choose (m + 1 + m) (m + 1) = (m + 1)# * Nat.choose (2 * m + 1) m
[PROOFSTEP]
rw [choose_symm_add, two_mul, add_right_comm]
[GOAL]
m : ℕ
ihn : ∀ (m_1 : ℕ), m_1 < succ (m + m) → m_1# ≤ 4 ^ m_1
hm : m > 0
⊢ 4 ^ (m + 1) * 4 ^ m ≤ 4 ^ (m + m + 1)
[PROOFSTEP]
rw [← pow_add, add_right_comm]
[GOAL]
case h.succ.inr
n : ℕ
ihn : ∀ (m : ℕ), m < succ n → m# ≤ 4 ^ m
ho : Odd n
⊢ succ n# ≤ 4 ^ succ n
[PROOFSTEP]
rcases Decidable.eq_or_ne n 1 with (rfl | hn)
[GOAL]
case h.succ.inr.inl
ihn : ∀ (m : ℕ), m < succ 1 → m# ≤ 4 ^ m
ho : Odd 1
⊢ succ 1# ≤ 4 ^ succ 1
[PROOFSTEP]
decide
[GOAL]
case h.succ.inr.inr
n : ℕ
ihn : ∀ (m : ℕ), m < succ n → m# ≤ 4 ^ m
ho : Odd n
hn : n ≠ 1
⊢ succ n# ≤ 4 ^ succ n
[PROOFSTEP]
calc
  (n + 1)# = n# := primorial_succ hn ho
  _ ≤ 4 ^ n := (ihn n n.lt_succ_self)
  _ ≤ 4 ^ (n + 1) := pow_le_pow_of_le_right four_pos n.le_succ


[GOAL]
⊢ StableUnderComposition @FiniteType
[PROOFSTEP]
introv R hf hg
[GOAL]
R S T : Type u_1
inst✝² : CommRing R
inst✝¹ : CommRing S
inst✝ : CommRing T
f : R →+* S
g : S →+* T
hf : FiniteType f
hg : FiniteType g
⊢ FiniteType (comp g f)
[PROOFSTEP]
exact hg.comp hf
[GOAL]
⊢ HoldsForLocalizationAway @FiniteType
[PROOFSTEP]
introv R _
[GOAL]
R S : Type u_1
inst✝³ : CommRing R
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
⊢ FiniteType (algebraMap R S)
[PROOFSTEP]
suffices Algebra.FiniteType R S by
  rw [RingHom.FiniteType]
  convert this; ext; rw [Algebra.smul_def]; rfl
[GOAL]
R S : Type u_1
inst✝³ : CommRing R
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
this : Algebra.FiniteType R S
⊢ FiniteType (algebraMap R S)
[PROOFSTEP]
rw [RingHom.FiniteType]
[GOAL]
R S : Type u_1
inst✝³ : CommRing R
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
this : Algebra.FiniteType R S
⊢ Algebra.FiniteType R S
[PROOFSTEP]
convert this
[GOAL]
case h.e'_5
R S : Type u_1
inst✝³ : CommRing R
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
this : Algebra.FiniteType R S
⊢ toAlgebra (algebraMap R S) = inst✝¹
[PROOFSTEP]
ext
[GOAL]
case h.e'_5.h
R S : Type u_1
inst✝³ : CommRing R
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
this : Algebra.FiniteType R S
r✝ : R
x✝ : S
⊢ (let_fun I := toAlgebra (algebraMap R S);
    r✝ • x✝) =
    r✝ • x✝
[PROOFSTEP]
rw [Algebra.smul_def]
[GOAL]
case h.e'_5.h
R S : Type u_1
inst✝³ : CommRing R
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
this : Algebra.FiniteType R S
r✝ : R
x✝ : S
⊢ (let_fun I := toAlgebra (algebraMap R S);
    r✝ • x✝) =
    ↑(algebraMap R S) r✝ * x✝
[PROOFSTEP]
rfl
[GOAL]
R S : Type u_1
inst✝³ : CommRing R
inst✝² : CommRing S
inst✝¹ : Algebra R S
r : R
inst✝ : IsLocalization.Away r S
⊢ Algebra.FiniteType R S
[PROOFSTEP]
exact IsLocalization.finiteType_of_monoid_fg (Submonoid.powers r) S
[GOAL]
⊢ OfLocalizationSpanTarget @FiniteType
[PROOFSTEP]
rw [ofLocalizationSpanTarget_iff_finite]
[GOAL]
⊢ OfLocalizationFiniteSpanTarget @FiniteType
[PROOFSTEP]
introv R hs H
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
H : ∀ (r : { x // x ∈ s }), FiniteType (comp (algebraMap S (Localization.Away ↑r)) f)
⊢ FiniteType f
[PROOFSTEP]
classical
letI := f.toAlgebra
replace H : ∀ r : s, Algebra.FiniteType R (Localization.Away (r : S))
· intro r; simp_rw [RingHom.FiniteType] at H ; convert H r; ext; simp_rw [Algebra.smul_def]; rfl
replace H := fun r => (H r).1
constructor
  -- Suppose `s : Finset S` spans `S`, and each `Sᵣ` is finitely generated as an `R`-algebra.
    -- Say `t r : Finset Sᵣ` generates `Sᵣ`. By assumption, we may find `lᵢ` such that
    -- `∑ lᵢ * sᵢ = 1`. I claim that all `s` and `l` and the numerators of `t` and generates `S`.
choose t ht using H
obtain ⟨l, hl⟩ :=
  (Finsupp.mem_span_iff_total S (s : Set S) 1).mp (show (1 : S) ∈ Ideal.span (s : Set S) by rw [hs]; trivial)
let sf := fun x : s => IsLocalization.finsetIntegerMultiple (Submonoid.powers (x : S)) (t x)
use s.attach.biUnion sf ∪ s ∪ l.support.image l
rw [eq_top_iff]
  -- We need to show that every `x` falls in the subalgebra generated by those elements.
    -- Since all `s` and `l` are in the subalgebra, it suffices to check that `sᵢ ^ nᵢ • x` falls in
    -- the algebra for each `sᵢ` and some `nᵢ`.
rintro x -
apply Subalgebra.mem_of_span_eq_top_of_smul_pow_mem _ (s : Set S) l hl _ _ x _
· intro x hx
  apply Algebra.subset_adjoin
  rw [Finset.coe_union, Finset.coe_union]
  exact Or.inl (Or.inr hx)
· intro i
  by_cases h : l i = 0; · rw [h]; exact zero_mem _
  apply Algebra.subset_adjoin
  rw [Finset.coe_union, Finset.coe_image]
  exact Or.inr (Set.mem_image_of_mem _ (Finsupp.mem_support_iff.mpr h))
· intro r
  rw [Finset.coe_union, Finset.coe_union, Finset.coe_biUnion]
    -- Since all `sᵢ` and numerators of `t r` are in the algebra, it suffices to show that the
        -- image of `x` in `Sᵣ` falls in the `R`-adjoin of `t r`, which is of course true.
        -- Porting note: The following `obtain` fails because Lean wants to know right away what the
        -- placeholders are, so we need to provide a little more guidance
        -- obtain ⟨⟨_, n₂, rfl⟩, hn₂⟩ := IsLocalization.exists_smul_mem_of_mem_adjoin
        --   (Submonoid.powers (r : S)) x (t r) (Algebra.adjoin R _) _ _ _
  rw [show
      ∀ A : Set S,
        (∃ n, (r : S) ^ n • x ∈ Algebra.adjoin R A) ↔
          (∃ m : (Submonoid.powers (r : S)), (m : S) • x ∈ Algebra.adjoin R A)
      by {exact fun _ => by simp [Submonoid.mem_powers_iff]
    }]
  refine IsLocalization.exists_smul_mem_of_mem_adjoin (Submonoid.powers (r : S)) x (t r) (Algebra.adjoin R _) ?_ ?_ ?_
  · intro x hx
    apply Algebra.subset_adjoin
    exact Or.inl (Or.inl ⟨_, ⟨r, rfl⟩, _, ⟨s.mem_attach r, rfl⟩, hx⟩)
  · rw [Submonoid.powers_eq_closure, Submonoid.closure_le, Set.singleton_subset_iff]
    apply Algebra.subset_adjoin
    exact Or.inl (Or.inr r.2)
  · rw [ht]; trivial
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
H : ∀ (r : { x // x ∈ s }), FiniteType (comp (algebraMap S (Localization.Away ↑r)) f)
⊢ FiniteType f
[PROOFSTEP]
letI := f.toAlgebra
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
H : ∀ (r : { x // x ∈ s }), FiniteType (comp (algebraMap S (Localization.Away ↑r)) f)
this : Algebra R S := toAlgebra f
⊢ FiniteType f
[PROOFSTEP]
replace H : ∀ r : s, Algebra.FiniteType R (Localization.Away (r : S))
[GOAL]
case H
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
H : ∀ (r : { x // x ∈ s }), FiniteType (comp (algebraMap S (Localization.Away ↑r)) f)
this : Algebra R S := toAlgebra f
⊢ ∀ (r : { x // x ∈ s }), Algebra.FiniteType R (Localization.Away ↑r)
[PROOFSTEP]
intro r
[GOAL]
case H
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
H : ∀ (r : { x // x ∈ s }), FiniteType (comp (algebraMap S (Localization.Away ↑r)) f)
this : Algebra R S := toAlgebra f
r : { x // x ∈ s }
⊢ Algebra.FiniteType R (Localization.Away ↑r)
[PROOFSTEP]
simp_rw [RingHom.FiniteType] at H
[GOAL]
case H
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
H : ∀ (r : { x // x ∈ s }), Algebra.FiniteType R (Localization.Away ↑r)
this : Algebra R S := toAlgebra f
r : { x // x ∈ s }
⊢ Algebra.FiniteType R (Localization.Away ↑r)
[PROOFSTEP]
convert H r
[GOAL]
case h.e'_5
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
H : ∀ (r : { x // x ∈ s }), Algebra.FiniteType R (Localization.Away ↑r)
this : Algebra R S := toAlgebra f
r : { x // x ∈ s }
⊢ Localization.algebra = toAlgebra (comp (algebraMap S (Localization.Away ↑r)) f)
[PROOFSTEP]
ext
[GOAL]
case h.e'_5.h
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
H : ∀ (r : { x // x ∈ s }), Algebra.FiniteType R (Localization.Away ↑r)
this : Algebra R S := toAlgebra f
r : { x // x ∈ s }
r✝ : R
x✝ : Localization (Submonoid.powers ↑r)
⊢ (let_fun I := Localization.algebra;
    r✝ • x✝) =
    r✝ • x✝
[PROOFSTEP]
simp_rw [Algebra.smul_def]
[GOAL]
case h.e'_5.h
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
H : ∀ (r : { x // x ∈ s }), Algebra.FiniteType R (Localization.Away ↑r)
this : Algebra R S := toAlgebra f
r : { x // x ∈ s }
r✝ : R
x✝ : Localization (Submonoid.powers ↑r)
⊢ ↑(algebraMap R (Localization (Submonoid.powers ↑r))) r✝ * x✝ = r✝ • x✝
[PROOFSTEP]
rfl
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
H : ∀ (r : { x // x ∈ s }), Algebra.FiniteType R (Localization.Away ↑r)
⊢ FiniteType f
[PROOFSTEP]
replace H := fun r => (H r).1
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
H : ∀ (r : { x // x ∈ s }), Subalgebra.FG ⊤
⊢ FiniteType f
[PROOFSTEP]
constructor
  -- Suppose `s : Finset S` spans `S`, and each `Sᵣ` is finitely generated as an `R`-algebra.
    -- Say `t r : Finset Sᵣ` generates `Sᵣ`. By assumption, we may find `lᵢ` such that
    -- `∑ lᵢ * sᵢ = 1`. I claim that all `s` and `l` and the numerators of `t` and generates `S`.
[GOAL]
case out
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
H : ∀ (r : { x // x ∈ s }), Subalgebra.FG ⊤
⊢ Subalgebra.FG ⊤
[PROOFSTEP]
choose t ht using H
[GOAL]
case out
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
⊢ Subalgebra.FG ⊤
[PROOFSTEP]
obtain ⟨l, hl⟩ :=
  (Finsupp.mem_span_iff_total S (s : Set S) 1).mp (show (1 : S) ∈ Ideal.span (s : Set S) by rw [hs]; trivial)
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
⊢ 1 ∈ Ideal.span ↑s
[PROOFSTEP]
rw [hs]
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
⊢ 1 ∈ ⊤
[PROOFSTEP]
trivial
[GOAL]
case out.intro
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
⊢ Subalgebra.FG ⊤
[PROOFSTEP]
let sf := fun x : s => IsLocalization.finsetIntegerMultiple (Submonoid.powers (x : S)) (t x)
[GOAL]
case out.intro
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
⊢ Subalgebra.FG ⊤
[PROOFSTEP]
use s.attach.biUnion sf ∪ s ∪ l.support.image l
[GOAL]
case h
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
⊢ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support) = ⊤
[PROOFSTEP]
rw [eq_top_iff]
  -- We need to show that every `x` falls in the subalgebra generated by those elements.
    -- Since all `s` and `l` are in the subalgebra, it suffices to check that `sᵢ ^ nᵢ • x` falls in
    -- the algebra for each `sᵢ` and some `nᵢ`.
[GOAL]
case h
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
⊢ ⊤ ≤ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
rintro x -
[GOAL]
case h
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
⊢ x ∈ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
apply Subalgebra.mem_of_span_eq_top_of_smul_pow_mem _ (s : Set S) l hl _ _ x _
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
⊢ ↑s ⊆ ↑(Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support))
[PROOFSTEP]
intro x hx
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x✝ x : S
hx : x ∈ ↑s
⊢ x ∈ ↑(Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support))
[PROOFSTEP]
apply Algebra.subset_adjoin
[GOAL]
case a
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x✝ x : S
hx : x ∈ ↑s
⊢ x ∈ ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
rw [Finset.coe_union, Finset.coe_union]
[GOAL]
case a
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x✝ x : S
hx : x ∈ ↑s
⊢ x ∈ ↑(Finset.biUnion (Finset.attach s) sf) ∪ ↑s ∪ ↑(Finset.image (↑l) l.support)
[PROOFSTEP]
exact Or.inl (Or.inr hx)
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
⊢ ∀ (i : ↑↑s), ↑l i ∈ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
intro i
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
i : ↑↑s
⊢ ↑l i ∈ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
by_cases h : l i = 0
[GOAL]
case pos
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
i : ↑↑s
h : ↑l i = 0
⊢ ↑l i ∈ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
rw [h]
[GOAL]
case pos
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
i : ↑↑s
h : ↑l i = 0
⊢ 0 ∈ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
exact zero_mem _
[GOAL]
case neg
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
i : ↑↑s
h : ¬↑l i = 0
⊢ ↑l i ∈ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
apply Algebra.subset_adjoin
[GOAL]
case neg.a
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
i : ↑↑s
h : ¬↑l i = 0
⊢ ↑l i ∈ ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
rw [Finset.coe_union, Finset.coe_image]
[GOAL]
case neg.a
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
i : ↑↑s
h : ¬↑l i = 0
⊢ ↑l i ∈ ↑(Finset.biUnion (Finset.attach s) sf ∪ s) ∪ ↑l '' ↑l.support
[PROOFSTEP]
exact Or.inr (Set.mem_image_of_mem _ (Finsupp.mem_support_iff.mpr h))
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
⊢ ∀ (r : ↑↑s),
    ∃ n, ↑r ^ n • x ∈ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
intro r
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ∃ n, ↑r ^ n • x ∈ Algebra.adjoin R ↑(Finset.biUnion (Finset.attach s) sf ∪ s ∪ Finset.image (↑l) l.support)
[PROOFSTEP]
rw [Finset.coe_union, Finset.coe_union, Finset.coe_biUnion]
  -- Since all `sᵢ` and numerators of `t r` are in the algebra, it suffices to show that the
      -- image of `x` in `Sᵣ` falls in the `R`-adjoin of `t r`, which is of course true.
      -- Porting note: The following `obtain` fails because Lean wants to know right away what the
      -- placeholders are, so we need to provide a little more guidance
      -- obtain ⟨⟨_, n₂, rfl⟩, hn₂⟩ := IsLocalization.exists_smul_mem_of_mem_adjoin
      --   (Submonoid.powers (r : S)) x (t r) (Algebra.adjoin R _) _ _ _
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ∃ n,
    ↑r ^ n • x ∈
      Algebra.adjoin R
        ((⋃ (x : { x // x ∈ s }) (_ : x ∈ ↑(Finset.attach s)), ↑(sf x)) ∪ ↑s ∪ ↑(Finset.image (↑l) l.support))
[PROOFSTEP]
rw [show
    ∀ A : Set S,
      (∃ n, (r : S) ^ n • x ∈ Algebra.adjoin R A) ↔ (∃ m : (Submonoid.powers (r : S)), (m : S) • x ∈ Algebra.adjoin R A)
    by {exact fun _ => by simp [Submonoid.mem_powers_iff]
  }]
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ∀ (A : Set S), (∃ n, ↑r ^ n • x ∈ Algebra.adjoin R A) ↔ ∃ m, ↑m • x ∈ Algebra.adjoin R A
[PROOFSTEP]
{exact fun _ => by simp [Submonoid.mem_powers_iff]
}
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ∀ (A : Set S), (∃ n, ↑r ^ n • x ∈ Algebra.adjoin R A) ↔ ∃ m, ↑m • x ∈ Algebra.adjoin R A
[PROOFSTEP]
exact fun _ => by simp [Submonoid.mem_powers_iff]
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
x✝ : Set S
⊢ (∃ n, ↑r ^ n • x ∈ Algebra.adjoin R x✝) ↔ ∃ m, ↑m • x ∈ Algebra.adjoin R x✝
[PROOFSTEP]
simp [Submonoid.mem_powers_iff]
[GOAL]
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ∃ m,
    ↑m • x ∈
      Algebra.adjoin R
        ((⋃ (x : { x // x ∈ s }) (_ : x ∈ ↑(Finset.attach s)), ↑(sf x)) ∪ ↑s ∪ ↑(Finset.image (↑l) l.support))
[PROOFSTEP]
refine IsLocalization.exists_smul_mem_of_mem_adjoin (Submonoid.powers (r : S)) x (t r) (Algebra.adjoin R _) ?_ ?_ ?_
[GOAL]
case refine_1
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ↑(IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑r) (t r)) ⊆
    ↑(Algebra.adjoin R
        ((⋃ (x : { x // x ∈ s }) (_ : x ∈ ↑(Finset.attach s)), ↑(sf x)) ∪ ↑s ∪ ↑(Finset.image (↑l) l.support)))
[PROOFSTEP]
intro x hx
[GOAL]
case refine_1
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x✝ : S
r : ↑↑s
x : S
hx : x ∈ ↑(IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑r) (t r))
⊢ x ∈
    ↑(Algebra.adjoin R
        ((⋃ (x : { x // x ∈ s }) (_ : x ∈ ↑(Finset.attach s)), ↑(sf x)) ∪ ↑s ∪ ↑(Finset.image (↑l) l.support)))
[PROOFSTEP]
apply Algebra.subset_adjoin
[GOAL]
case refine_1.a
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x✝ : S
r : ↑↑s
x : S
hx : x ∈ ↑(IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑r) (t r))
⊢ x ∈ (⋃ (x : { x // x ∈ s }) (_ : x ∈ ↑(Finset.attach s)), ↑(sf x)) ∪ ↑s ∪ ↑(Finset.image (↑l) l.support)
[PROOFSTEP]
exact Or.inl (Or.inl ⟨_, ⟨r, rfl⟩, _, ⟨s.mem_attach r, rfl⟩, hx⟩)
[GOAL]
case refine_2
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ Submonoid.powers ↑r ≤
    (Algebra.adjoin R
          ((⋃ (x : { x // x ∈ s }) (_ : x ∈ ↑(Finset.attach s)), ↑(sf x)) ∪ ↑s ∪
            ↑(Finset.image (↑l) l.support))).toSubsemiring.toSubmonoid
[PROOFSTEP]
rw [Submonoid.powers_eq_closure, Submonoid.closure_le, Set.singleton_subset_iff]
[GOAL]
case refine_2
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ↑r ∈
    ↑(Algebra.adjoin R
            ((⋃ (x : { x // x ∈ s }) (_ : x ∈ ↑(Finset.attach s)), ↑(sf x)) ∪ ↑s ∪
              ↑(Finset.image (↑l) l.support))).toSubsemiring.toSubmonoid
[PROOFSTEP]
apply Algebra.subset_adjoin
[GOAL]
case refine_2.a
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ↑r ∈ (⋃ (x : { x // x ∈ s }) (_ : x ∈ ↑(Finset.attach s)), ↑(sf x)) ∪ ↑s ∪ ↑(Finset.image (↑l) l.support)
[PROOFSTEP]
exact Or.inl (Or.inr r.2)
[GOAL]
case refine_3
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ↑(algebraMap S (Localization.Away ↑r)) x ∈ Algebra.adjoin R ↑(t r)
[PROOFSTEP]
rw [ht]
[GOAL]
case refine_3
R S : Type u_1
inst✝¹ : CommRing R
inst✝ : CommRing S
f : R →+* S
s : Finset S
hs : Ideal.span ↑s = ⊤
this : Algebra R S := toAlgebra f
t : (r : { x // x ∈ s }) → Finset (Localization.Away ↑r)
ht : ∀ (r : { x // x ∈ s }), Algebra.adjoin R ↑(t r) = ⊤
l : ↑↑s →₀ S
hl : ↑(Finsupp.total (↑↑s) S S Subtype.val) l = 1
sf : { x // x ∈ s } → Finset S := fun x => IsLocalization.finsetIntegerMultiple (Submonoid.powers ↑x) (t x)
x : S
r : ↑↑s
⊢ ↑(algebraMap S (Localization.Away ↑r)) x ∈ ⊤
[PROOFSTEP]
trivial