[GOAL]
k : Type u
inst✝ : Field k
s : Finset (MonicIrreducible k)
f : MonicIrreducible k
hf : f ∈ s
⊢ ↑(toSplittingField k s) (evalXSelf k f) = 0
[PROOFSTEP]
rw [toSplittingField, evalXSelf, ← AlgHom.coe_toRingHom, hom_eval₂, AlgHom.coe_toRingHom, MvPolynomial.aeval_X,
  dif_pos hf, ← algebraMap_eq, AlgHom.comp_algebraMap]
[GOAL]
k : Type u
inst✝ : Field k
s : Finset (MonicIrreducible k)
f : MonicIrreducible k
hf : f ∈ s
⊢ Polynomial.eval₂ (algebraMap k (SplittingField (∏ x in s, ↑x)))
      (rootOfSplits (algebraMap k (SplittingField (∏ x in s, ↑x)))
        (_ : Splits (algebraMap k (SplittingField (∏ x in s, ↑x))) ↑f) (_ : ¬degree ↑f = 0))
      ↑f =
    0
[PROOFSTEP]
exact map_rootOfSplits _ _ _
[GOAL]
k : Type u
inst✝ : Field k
⊢ spanEval k ≠ ⊤
[PROOFSTEP]
rw [Ideal.ne_top_iff_one, spanEval, Ideal.span, ← Set.image_univ, Finsupp.mem_span_image_iff_total]
[GOAL]
k : Type u
inst✝ : Field k
⊢ ¬∃ l,
      l ∈ Finsupp.supported (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible k) k) Set.univ ∧
        ↑(Finsupp.total (MonicIrreducible k) (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible k) k)
                (evalXSelf k))
            l =
          1
[PROOFSTEP]
rintro ⟨v, _, hv⟩
[GOAL]
case intro.intro
k : Type u
inst✝ : Field k
v : MonicIrreducible k →₀ MvPolynomial (MonicIrreducible k) k
left✝ : v ∈ Finsupp.supported (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible k) k) Set.univ
hv :
  ↑(Finsupp.total (MonicIrreducible k) (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible k) k)
          (evalXSelf k))
      v =
    1
⊢ False
[PROOFSTEP]
replace hv := congr_arg (toSplittingField k v.support) hv
[GOAL]
case intro.intro
k : Type u
inst✝ : Field k
v : MonicIrreducible k →₀ MvPolynomial (MonicIrreducible k) k
left✝ : v ∈ Finsupp.supported (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible k) k) Set.univ
hv :
  ↑(toSplittingField k v.support)
      (↑(Finsupp.total (MonicIrreducible k) (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible k) k)
            (evalXSelf k))
        v) =
    ↑(toSplittingField k v.support) 1
⊢ False
[PROOFSTEP]
rw [AlgHom.map_one, Finsupp.total_apply, Finsupp.sum, AlgHom.map_sum, Finset.sum_eq_zero] at hv
[GOAL]
case intro.intro
k : Type u
inst✝ : Field k
v : MonicIrreducible k →₀ MvPolynomial (MonicIrreducible k) k
left✝ : v ∈ Finsupp.supported (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible k) k) Set.univ
hv : 0 = 1
⊢ False
[PROOFSTEP]
exact zero_ne_one hv
[GOAL]
case intro.intro
k : Type u
inst✝ : Field k
v : MonicIrreducible k →₀ MvPolynomial (MonicIrreducible k) k
left✝ : v ∈ Finsupp.supported (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible k) k) Set.univ
hv : ∑ x in v.support, ↑(toSplittingField k v.support) (↑v x • evalXSelf k x) = 1
⊢ ∀ (x : MonicIrreducible k), x ∈ v.support → ↑(toSplittingField k v.support) (↑v x • evalXSelf k x) = 0
[PROOFSTEP]
intro j hj
[GOAL]
case intro.intro
k : Type u
inst✝ : Field k
v : MonicIrreducible k →₀ MvPolynomial (MonicIrreducible k) k
left✝ : v ∈ Finsupp.supported (MvPolynomial (MonicIrreducible k) k) (MvPolynomial (MonicIrreducible k) k) Set.univ
hv : ∑ x in v.support, ↑(toSplittingField k v.support) (↑v x • evalXSelf k x) = 1
j : MonicIrreducible k
hj : j ∈ v.support
⊢ ↑(toSplittingField k v.support) (↑v j • evalXSelf k j) = 0
[PROOFSTEP]
rw [smul_eq_mul, AlgHom.map_mul, toSplittingField_evalXSelf (s := v.support) hj, mul_zero]
[GOAL]
k : Type u
inst✝ : Field k
z : AdjoinMonic k
⊢ IsIntegral k z
[PROOFSTEP]
let ⟨p, hp⟩ := Ideal.Quotient.mk_surjective z
[GOAL]
k : Type u
inst✝ : Field k
z : AdjoinMonic k
p : MvPolynomial (MonicIrreducible k) k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) p = z
⊢ IsIntegral k z
[PROOFSTEP]
rw [← hp]
[GOAL]
k : Type u
inst✝ : Field k
z : AdjoinMonic k
p : MvPolynomial (MonicIrreducible k) k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) p = z
⊢ IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) p)
[PROOFSTEP]
induction p using MvPolynomial.induction_on generalizing z with
| h_C => exact isIntegral_algebraMap
| h_add _ _ ha hb => exact isIntegral_add (ha _ rfl) (hb _ rfl)
| h_X p f ih =>
  · refine @isIntegral_mul k _ _ _ _ _ (Ideal.Quotient.mk (maxIdeal k) _) (ih _ rfl) ?_
    refine ⟨f, f.2.1, ?_⟩
    erw [AdjoinMonic.algebraMap, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
    exact le_maxIdeal k (Ideal.subset_span ⟨f, rfl⟩)
[GOAL]
k : Type u
inst✝ : Field k
z : AdjoinMonic k
p : MvPolynomial (MonicIrreducible k) k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) p = z
⊢ IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) p)
[PROOFSTEP]
induction p using MvPolynomial.induction_on generalizing z with
| h_C => exact isIntegral_algebraMap
| h_add _ _ ha hb => exact isIntegral_add (ha _ rfl) (hb _ rfl)
| h_X p f ih =>
  · refine @isIntegral_mul k _ _ _ _ _ (Ideal.Quotient.mk (maxIdeal k) _) (ih _ rfl) ?_
    refine ⟨f, f.2.1, ?_⟩
    erw [AdjoinMonic.algebraMap, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
    exact le_maxIdeal k (Ideal.subset_span ⟨f, rfl⟩)
[GOAL]
case h_C
k : Type u
inst✝ : Field k
a✝ : k
z : AdjoinMonic k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) (↑MvPolynomial.C a✝) = z
⊢ IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) (↑MvPolynomial.C a✝))
[PROOFSTEP]

| h_C => exact isIntegral_algebraMap
[GOAL]
case h_C
k : Type u
inst✝ : Field k
a✝ : k
z : AdjoinMonic k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) (↑MvPolynomial.C a✝) = z
⊢ IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) (↑MvPolynomial.C a✝))
[PROOFSTEP]
exact isIntegral_algebraMap
[GOAL]
case h_add
k : Type u
inst✝ : Field k
p✝ q✝ : MvPolynomial (MonicIrreducible k) k
ha :
  ∀ (z : AdjoinMonic k), ↑(Ideal.Quotient.mk (maxIdeal k)) p✝ = z → IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) p✝)
hb :
  ∀ (z : AdjoinMonic k), ↑(Ideal.Quotient.mk (maxIdeal k)) q✝ = z → IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) q✝)
z : AdjoinMonic k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) (p✝ + q✝) = z
⊢ IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) (p✝ + q✝))
[PROOFSTEP]

| h_add _ _ ha hb => exact isIntegral_add (ha _ rfl) (hb _ rfl)
[GOAL]
case h_add
k : Type u
inst✝ : Field k
p✝ q✝ : MvPolynomial (MonicIrreducible k) k
ha :
  ∀ (z : AdjoinMonic k), ↑(Ideal.Quotient.mk (maxIdeal k)) p✝ = z → IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) p✝)
hb :
  ∀ (z : AdjoinMonic k), ↑(Ideal.Quotient.mk (maxIdeal k)) q✝ = z → IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) q✝)
z : AdjoinMonic k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) (p✝ + q✝) = z
⊢ IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) (p✝ + q✝))
[PROOFSTEP]
exact isIntegral_add (ha _ rfl) (hb _ rfl)
[GOAL]
case h_X
k : Type u
inst✝ : Field k
p : MvPolynomial (MonicIrreducible k) k
f : MonicIrreducible k
ih : ∀ (z : AdjoinMonic k), ↑(Ideal.Quotient.mk (maxIdeal k)) p = z → IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) p)
z : AdjoinMonic k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) (p * MvPolynomial.X f) = z
⊢ IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) (p * MvPolynomial.X f))
[PROOFSTEP]

| h_X p f ih =>
  · refine @isIntegral_mul k _ _ _ _ _ (Ideal.Quotient.mk (maxIdeal k) _) (ih _ rfl) ?_
    refine ⟨f, f.2.1, ?_⟩
    erw [AdjoinMonic.algebraMap, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
    exact le_maxIdeal k (Ideal.subset_span ⟨f, rfl⟩)
[GOAL]
case h_X
k : Type u
inst✝ : Field k
p : MvPolynomial (MonicIrreducible k) k
f : MonicIrreducible k
ih : ∀ (z : AdjoinMonic k), ↑(Ideal.Quotient.mk (maxIdeal k)) p = z → IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) p)
z : AdjoinMonic k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) (p * MvPolynomial.X f) = z
⊢ IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) (p * MvPolynomial.X f))
[PROOFSTEP]
refine @isIntegral_mul k _ _ _ _ _ (Ideal.Quotient.mk (maxIdeal k) _) (ih _ rfl) ?_
[GOAL]
case h_X
k : Type u
inst✝ : Field k
p : MvPolynomial (MonicIrreducible k) k
f : MonicIrreducible k
ih : ∀ (z : AdjoinMonic k), ↑(Ideal.Quotient.mk (maxIdeal k)) p = z → IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) p)
z : AdjoinMonic k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) (p * MvPolynomial.X f) = z
⊢ IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) (MvPolynomial.X f))
[PROOFSTEP]
refine ⟨f, f.2.1, ?_⟩
[GOAL]
case h_X
k : Type u
inst✝ : Field k
p : MvPolynomial (MonicIrreducible k) k
f : MonicIrreducible k
ih : ∀ (z : AdjoinMonic k), ↑(Ideal.Quotient.mk (maxIdeal k)) p = z → IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) p)
z : AdjoinMonic k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) (p * MvPolynomial.X f) = z
⊢ Polynomial.eval₂
      (_root_.algebraMap k ((fun x => MvPolynomial (MonicIrreducible k) k ⧸ maxIdeal k) (MvPolynomial.X f)))
      (↑(Ideal.Quotient.mk (maxIdeal k)) (MvPolynomial.X f)) ↑f =
    0
[PROOFSTEP]
erw [AdjoinMonic.algebraMap, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
[GOAL]
case h_X
k : Type u
inst✝ : Field k
p : MvPolynomial (MonicIrreducible k) k
f : MonicIrreducible k
ih : ∀ (z : AdjoinMonic k), ↑(Ideal.Quotient.mk (maxIdeal k)) p = z → IsIntegral k (↑(Ideal.Quotient.mk (maxIdeal k)) p)
z : AdjoinMonic k
hp : ↑(Ideal.Quotient.mk (maxIdeal k)) (p * MvPolynomial.X f) = z
⊢ Polynomial.eval₂ MvPolynomial.C (MvPolynomial.X f) ↑f ∈ maxIdeal k
[PROOFSTEP]
exact le_maxIdeal k (Ideal.subset_span ⟨f, rfl⟩)
[GOAL]
k : Type u
inst✝ : Field k
f : k[X]
hfm : Monic f
hfi : Irreducible f
⊢ Polynomial.eval₂ (toAdjoinMonic k)
      (↑(Ideal.Quotient.mk (maxIdeal k)) (MvPolynomial.X { val := f, property := (_ : Monic f ∧ Irreducible f) })) f =
    0
[PROOFSTEP]
rw [toAdjoinMonic, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
[GOAL]
k : Type u
inst✝ : Field k
f : k[X]
hfm : Monic f
hfi : Irreducible f
⊢ Polynomial.eval₂ MvPolynomial.C (MvPolynomial.X { val := f, property := (_ : Monic f ∧ Irreducible f) }) f ∈
    maxIdeal k
[PROOFSTEP]
exact le_maxIdeal k (Ideal.subset_span <| ⟨_, rfl⟩)
[GOAL]
k : Type u
inst✝ : Field k
n : ℕ
f : (Step k n)[X]
hfm : Monic f
hfi : Irreducible f
⊢ ∃ x, Polynomial.eval₂ (toStepSucc k n) x f = 0
[PROOFSTEP]
obtain ⟨x, hx⟩ := @AdjoinMonic.exists_root _ (Step.field k n) _ hfm hfi
[GOAL]
case intro
k : Type u
inst✝ : Field k
n : ℕ
f : (Step k n)[X]
hfm : Monic f
hfi : Irreducible f
x : AdjoinMonic (Step k n)
hx : Polynomial.eval₂ (toAdjoinMonic (Step k n)) x f = 0
⊢ ∃ x, Polynomial.eval₂ (toStepSucc k n) x f = 0
[PROOFSTEP]
exact ⟨x, by apply hx⟩
[GOAL]
k : Type u
inst✝ : Field k
n : ℕ
f : (Step k n)[X]
hfm : Monic f
hfi : Irreducible f
x : AdjoinMonic (Step k n)
hx : Polynomial.eval₂ (toAdjoinMonic (Step k n)) x f = 0
⊢ Polynomial.eval₂ (toStepSucc k n) x f = 0
[PROOFSTEP]
apply hx
[GOAL]
k : Type u
inst✝ : Field k
m n : ℕ
h : m ≤ n
⊢ AlgebraicClosure.toStepOfLE' k m (Nat.succ n) (_ : m ≤ Nat.succ n) =
    ↑(toStepSucc k n) ∘ AlgebraicClosure.toStepOfLE' k m n h
[PROOFSTEP]
ext x
[GOAL]
case h
k : Type u
inst✝ : Field k
m n : ℕ
h : m ≤ n
x : Step k m
⊢ AlgebraicClosure.toStepOfLE' k m (Nat.succ n) (_ : m ≤ Nat.succ n) x =
    (↑(toStepSucc k n) ∘ AlgebraicClosure.toStepOfLE' k m n h) x
[PROOFSTEP]
convert Nat.leRecOn_succ h x
[GOAL]
case h.convert_1
k : Type u
inst✝ : Field k
m n : ℕ
h : m ≤ n
x : Step k m
⊢ m ≤ n + 1
[PROOFSTEP]
exact h.trans n.le_succ
[GOAL]
k : Type u
inst✝ : Field k
m n : ℕ
h : m ≤ n
⊢ AlgebraicClosure.toStepOfLE' k m n h 1 = 1
[PROOFSTEP]
induction' h with a h ih
[GOAL]
case refl
k : Type u
inst✝ : Field k
m n : ℕ
⊢ AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1
[PROOFSTEP]
exact Nat.leRecOn_self 1
[GOAL]
case step
k : Type u
inst✝ : Field k
m n a : ℕ
h : Nat.le m a
ih : AlgebraicClosure.toStepOfLE' k m a h 1 = 1
⊢ AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1
[PROOFSTEP]
rw [toStepOfLE'.succ k m a h]
[GOAL]
case step
k : Type u
inst✝ : Field k
m n a : ℕ
h : Nat.le m a
ih : AlgebraicClosure.toStepOfLE' k m a h 1 = 1
⊢ (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) 1 = 1
[PROOFSTEP]
simp [ih]
[GOAL]
k : Type u
inst✝ : Field k
m n : ℕ
h : m ≤ n
x y : Step k m
⊢ OneHom.toFun
      { toFun := AlgebraicClosure.toStepOfLE' k m n h, map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
      (x * y) =
    OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m n h, map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
        x *
      OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m n h, map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
        y
[PROOFSTEP]
induction' h with a h ih
[GOAL]
case refl
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
⊢ OneHom.toFun
      { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
      (x * y) =
    OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
        x *
      OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
        y
[PROOFSTEP]
dsimp [toStepOfLE']
[GOAL]
case refl
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
⊢ Nat.leRecOn (_ : Nat.le m m) (fun a => ↑(toStepSucc k a)) (x * y) =
    Nat.leRecOn (_ : Nat.le m m) (fun a => ↑(toStepSucc k a)) x *
      Nat.leRecOn (_ : Nat.le m m) (fun a => ↑(toStepSucc k a)) y
[PROOFSTEP]
simp_rw [Nat.leRecOn_self]
[GOAL]
case step
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
a : ℕ
h : Nat.le m a
ih :
  OneHom.toFun
      { toFun := AlgebraicClosure.toStepOfLE' k m a h, map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
      (x * y) =
    OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m a h, map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
        x *
      OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m a h, map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
        y
⊢ OneHom.toFun
      { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
      (x * y) =
    OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
        x *
      OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
        y
[PROOFSTEP]
simp_rw [toStepOfLE'.succ k m a h]
[GOAL]
case step
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
a : ℕ
h : Nat.le m a
ih :
  OneHom.toFun
      { toFun := AlgebraicClosure.toStepOfLE' k m a h, map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
      (x * y) =
    OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m a h, map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
        x *
      OneHom.toFun
        { toFun := AlgebraicClosure.toStepOfLE' k m a h, map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
        y
⊢ (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) (x * y) =
    (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) x *
      (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) y
[PROOFSTEP]
simp only at ih
[GOAL]
case step
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
a : ℕ
h : Nat.le m a
ih :
  AlgebraicClosure.toStepOfLE' k m a h (x * y) =
    AlgebraicClosure.toStepOfLE' k m a h x * AlgebraicClosure.toStepOfLE' k m a h y
⊢ (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) (x * y) =
    (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) x *
      (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) y
[PROOFSTEP]
simp [ih]
  -- Porting note: original proof was `induction' h with n h ih; · exact Nat.leRecOn_self 0`
  --                                   `rw [Nat.leRecOn_succ h, ih, RingHom.map_zero]`
[GOAL]
k : Type u
inst✝ : Field k
m n : ℕ
h : m ≤ n
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m n h,
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                      map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                      y) })
      0 =
    0
[PROOFSTEP]
induction' h with a h ih
[GOAL]
case refl
k : Type u
inst✝ : Field k
m n : ℕ
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                      map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                      y) })
      0 =
    0
[PROOFSTEP]
exact Nat.leRecOn_self 0
[GOAL]
case step
k : Type u
inst✝ : Field k
m n a : ℕ
h : Nat.le m a
ih :
  OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m a h,
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                      map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      y) })
      0 =
    0
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                      map_one' :=
                        (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                        map_one' :=
                          (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                        map_one' :=
                          (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                      y) })
      0 =
    0
[PROOFSTEP]
simp_rw [toStepOfLE'.succ k m a h]
[GOAL]
case step
k : Type u
inst✝ : Field k
m n a : ℕ
h : Nat.le m a
ih :
  OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m a h,
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                      map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      y) })
      0 =
    0
⊢ (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) 0 = 0
[PROOFSTEP]
simp only at ih
[GOAL]
case step
k : Type u
inst✝ : Field k
m n a : ℕ
h : Nat.le m a
ih : AlgebraicClosure.toStepOfLE' k m a h 0 = 0
⊢ (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) 0 = 0
[PROOFSTEP]
simp [ih]
[GOAL]
k : Type u
inst✝ : Field k
m n : ℕ
h : m ≤ n
x y : Step k m
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m n h,
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                      map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                      y) })
      (x + y) =
    OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                        y) })
        x +
      OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m n h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m n h 1 = 1) }
                        y) })
        y
[PROOFSTEP]
induction' h with a h ih
[GOAL]
case refl
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                      map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                      y) })
      (x + y) =
    OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                        y) })
        x +
      OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m),
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m m (_ : Nat.le m m) 1 = 1) }
                        y) })
        y
[PROOFSTEP]
dsimp [toStepOfLE']
[GOAL]
case refl
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
⊢ Nat.leRecOn (_ : Nat.le m m) (fun a => ↑(toStepSucc k a)) (x + y) =
    Nat.leRecOn (_ : Nat.le m m) (fun a => ↑(toStepSucc k a)) x +
      Nat.leRecOn (_ : Nat.le m m) (fun a => ↑(toStepSucc k a)) y
[PROOFSTEP]
simp_rw [Nat.leRecOn_self]
[GOAL]
case step
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
a : ℕ
h : Nat.le m a
ih :
  OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m a h,
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                      map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      y) })
      (x + y) =
    OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                        y) })
        x +
      OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                        y) })
        y
⊢ OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                      map_one' :=
                        (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                        map_one' :=
                          (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                        map_one' :=
                          (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                      y) })
      (x + y) =
    OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                        map_one' :=
                          (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                          map_one' :=
                            (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                          map_one' :=
                            (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                        y) })
        x +
      OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                        map_one' :=
                          (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                          map_one' :=
                            (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)),
                          map_one' :=
                            (_ : AlgebraicClosure.toStepOfLE' k m (Nat.succ a) (_ : Nat.le m (Nat.succ a)) 1 = 1) }
                        y) })
        y
[PROOFSTEP]
simp_rw [toStepOfLE'.succ k m a h]
[GOAL]
case step
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
a : ℕ
h : Nat.le m a
ih :
  OneHom.toFun
      (↑{
          toOneHom :=
            { toFun := AlgebraicClosure.toStepOfLE' k m a h,
              map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) },
          map_mul' :=
            (_ :
              ∀ (x y : Step k m),
                OneHom.toFun
                    { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                      map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                    (x * y) =
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      x *
                    OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      y) })
      (x + y) =
    OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                        y) })
        x +
      OneHom.toFun
        (↑{
            toOneHom :=
              { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) },
            map_mul' :=
              (_ :
                ∀ (x y : Step k m),
                  OneHom.toFun
                      { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                        map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                      (x * y) =
                    OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                        x *
                      OneHom.toFun
                        { toFun := AlgebraicClosure.toStepOfLE' k m a h,
                          map_one' := (_ : AlgebraicClosure.toStepOfLE' k m a h 1 = 1) }
                        y) })
        y
⊢ (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) (x + y) =
    (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) x +
      (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) y
[PROOFSTEP]
simp only at ih
[GOAL]
case step
k : Type u
inst✝ : Field k
m n : ℕ
x y : Step k m
a : ℕ
h : Nat.le m a
ih :
  AlgebraicClosure.toStepOfLE' k m a h (x + y) =
    AlgebraicClosure.toStepOfLE' k m a h x + AlgebraicClosure.toStepOfLE' k m a h y
⊢ (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) (x + y) =
    (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) x +
      (↑(toStepSucc k a) ∘ AlgebraicClosure.toStepOfLE' k m a h) y
[PROOFSTEP]
simp [ih]
[GOAL]
k : Type u
inst✝ : Field k
n : ℕ
h : 0 ≤ n
⊢ toStepOfLE k 0 (n + 1) (_ : 0 ≤ n + 1) = RingHom.comp (toStepSucc k n) (toStepOfLE k 0 n h)
[PROOFSTEP]
ext1 x
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
h : 0 ≤ n
x : Step k 0
⊢ ↑(toStepOfLE k 0 (n + 1) (_ : 0 ≤ n + 1)) x = ↑(RingHom.comp (toStepSucc k n) (toStepOfLE k 0 n h)) x
[PROOFSTEP]
rw [RingHom.comp_apply]
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
h : 0 ≤ n
x : Step k 0
⊢ ↑(toStepOfLE k 0 (n + 1) (_ : 0 ≤ n + 1)) x = ↑(toStepSucc k n) (↑(toStepOfLE k 0 n h) x)
[PROOFSTEP]
simp only [toStepOfLE, RingHom.coe_mk, MonoidHom.coe_mk, OneHom.coe_mk]
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
h : 0 ≤ n
x : Step k 0
⊢ AlgebraicClosure.toStepOfLE' k 0 (n + 1) (_ : 0 ≤ n + 1) x =
    ↑(toStepSucc k n) (AlgebraicClosure.toStepOfLE' k 0 n h x)
[PROOFSTEP]
change _ = (_ ∘ _) x
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
h : 0 ≤ n
x : Step k 0
⊢ AlgebraicClosure.toStepOfLE' k 0 (n + 1) (_ : 0 ≤ n + 1) x =
    (↑(toStepSucc k n) ∘ AlgebraicClosure.toStepOfLE' k 0 n h) x
[PROOFSTEP]
rw [toStepOfLE'.succ k 0 n h]
[GOAL]
k : Type u
inst✝ : Field k
n : ℕ
⊢ ∀ (z : Step k n), IsIntegral k z
[PROOFSTEP]
induction' n with a h
[GOAL]
case zero
k : Type u
inst✝ : Field k
⊢ ∀ (z : Step k Nat.zero), IsIntegral k z
[PROOFSTEP]
intro z
[GOAL]
case zero
k : Type u
inst✝ : Field k
z : Step k Nat.zero
⊢ IsIntegral k z
[PROOFSTEP]
exact isIntegral_algebraMap
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ ∀ (z : Step k (Nat.succ a)), IsIntegral k z
[PROOFSTEP]
intro z
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
z : Step k (Nat.succ a)
⊢ IsIntegral k z
[PROOFSTEP]
change RingHom.IsIntegralElem _ _
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
z : Step k (Nat.succ a)
⊢ RingHom.IsIntegralElem (algebraMap k (Step k (Nat.succ a))) z
[PROOFSTEP]
revert z
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ ∀ (z : Step k (Nat.succ a)), RingHom.IsIntegralElem (algebraMap k (Step k (Nat.succ a))) z
[PROOFSTEP]
change RingHom.IsIntegral _
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral (algebraMap k (Step k (Nat.succ a)))
[PROOFSTEP]
unfold algebraMap
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral Algebra.toRingHom
[PROOFSTEP]
unfold Algebra.toRingHom
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral (algebra k (Nat.succ a)).2
[PROOFSTEP]
unfold algebra
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral (RingHom.toAlgebra (toStepOfLE k 0 (Nat.succ a) (_ : 0 ≤ Nat.succ a))).2
[PROOFSTEP]
unfold RingHom.toAlgebra
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral
    (RingHom.toAlgebra' (toStepOfLE k 0 (Nat.succ a) (_ : 0 ≤ Nat.succ a))
        (_ :
          ∀ (x : Step k 0) (b : (fun x => Step k (Nat.succ a)) x),
            ↑(toStepOfLE k 0 (Nat.succ a) (_ : 0 ≤ Nat.succ a)) x * b =
              b * ↑(toStepOfLE k 0 (Nat.succ a) (_ : 0 ≤ Nat.succ a)) x)).2
[PROOFSTEP]
unfold RingHom.toAlgebra'
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral
    (Algebra.mk (toStepOfLE k 0 (Nat.succ a) (_ : 0 ≤ Nat.succ a))
        (_ :
          ∀ (x : Step k 0) (b : (fun x => Step k (Nat.succ a)) x),
            ↑(toStepOfLE k 0 (Nat.succ a) (_ : 0 ≤ Nat.succ a)) x * b =
              b * ↑(toStepOfLE k 0 (Nat.succ a) (_ : 0 ≤ Nat.succ a)) x)
        (_ : ∀ (x : Step k 0) (x_1 : Step k (Nat.succ a)), x • x_1 = x • x_1)).2
[PROOFSTEP]
simp only
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral (toStepOfLE k 0 (Nat.succ a) (_ : 0 ≤ Nat.succ a))
[PROOFSTEP]
rw [toStepOfLE.succ k a a.zero_le]
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral (RingHom.comp (toStepSucc k a) (toStepOfLE k 0 a (_ : 0 ≤ a)))
[PROOFSTEP]
apply
  @RingHom.isIntegral_trans (Step k 0) (Step k a) (Step k (a + 1)) _ _ _ (toStepOfLE k 0 a (a.zero_le : 0 ≤ a))
    (toStepSucc k a) _
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral (toStepSucc k a)
[PROOFSTEP]
intro z
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
z : Step k (a + 1)
⊢ RingHom.IsIntegralElem (toStepSucc k a) z
[PROOFSTEP]
have := AdjoinMonic.isIntegral (Step k a) (z : Step k (a + 1))
[GOAL]
case succ
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
z : Step k (a + 1)
this : IsIntegral (Step k a) z
⊢ RingHom.IsIntegralElem (toStepSucc k a) z
[PROOFSTEP]
convert this
[GOAL]
k : Type u
inst✝ : Field k
a : ℕ
h : ∀ (z : Step k a), IsIntegral k z
⊢ RingHom.IsIntegral (toStepOfLE k 0 a (_ : 0 ≤ a))
[PROOFSTEP]
convert h
[GOAL]
k : Type u
inst✝ : Field k
n : ℕ
⊢ RingHom.comp (ofStep k (n + 1)) (toStepSucc k n) = ofStep k n
[PROOFSTEP]
ext x
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
x : Step k n
⊢ ↑(RingHom.comp (ofStep k (n + 1)) (toStepSucc k n)) x = ↑(ofStep k n) x
[PROOFSTEP]
have hx : toStepOfLE' k n (n + 1) n.le_succ x = toStepSucc k n x := Nat.leRecOn_succ' x
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
x : Step k n
hx : AlgebraicClosure.toStepOfLE' k n (n + 1) (_ : n ≤ Nat.succ n) x = ↑(toStepSucc k n) x
⊢ ↑(RingHom.comp (ofStep k (n + 1)) (toStepSucc k n)) x = ↑(ofStep k n) x
[PROOFSTEP]
unfold ofStep
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
x : Step k n
hx : AlgebraicClosure.toStepOfLE' k n (n + 1) (_ : n ≤ Nat.succ n) x = ↑(toStepSucc k n) x
⊢ ↑(RingHom.comp (Ring.DirectLimit.of (Step k) (fun i j h => ↑(toStepOfLE k i j h)) (n + 1)) (toStepSucc k n)) x =
    ↑(Ring.DirectLimit.of (Step k) (fun i j h => ↑(toStepOfLE k i j h)) n) x
[PROOFSTEP]
rw [RingHom.comp_apply]
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
x : Step k n
hx : AlgebraicClosure.toStepOfLE' k n (n + 1) (_ : n ≤ Nat.succ n) x = ↑(toStepSucc k n) x
⊢ ↑(Ring.DirectLimit.of (Step k) (fun i j h => ↑(toStepOfLE k i j h)) (n + 1)) (↑(toStepSucc k n) x) =
    ↑(Ring.DirectLimit.of (Step k) (fun i j h => ↑(toStepOfLE k i j h)) n) x
[PROOFSTEP]
dsimp [toStepOfLE]
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
x : Step k n
hx : AlgebraicClosure.toStepOfLE' k n (n + 1) (_ : n ≤ Nat.succ n) x = ↑(toStepSucc k n) x
⊢ ↑(Ring.DirectLimit.of (Step k) (fun i j h => AlgebraicClosure.toStepOfLE' k i j h) (n + 1)) (↑(toStepSucc k n) x) =
    ↑(Ring.DirectLimit.of (Step k) (fun i j h => AlgebraicClosure.toStepOfLE' k i j h) n) x
[PROOFSTEP]
rw [← hx]
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
x : Step k n
hx : AlgebraicClosure.toStepOfLE' k n (n + 1) (_ : n ≤ Nat.succ n) x = ↑(toStepSucc k n) x
⊢ ↑(Ring.DirectLimit.of (Step k) (fun i j h => AlgebraicClosure.toStepOfLE' k i j h) (n + 1))
      (AlgebraicClosure.toStepOfLE' k n (n + 1) (_ : n ≤ Nat.succ n) x) =
    ↑(Ring.DirectLimit.of (Step k) (fun i j h => AlgebraicClosure.toStepOfLE' k i j h) n) x
[PROOFSTEP]
change Ring.DirectLimit.of (Step k) (toStepOfLE' k) (n + 1) (_) = Ring.DirectLimit.of (Step k) (toStepOfLE' k) n x
[GOAL]
case a
k : Type u
inst✝ : Field k
n : ℕ
x : Step k n
hx : AlgebraicClosure.toStepOfLE' k n (n + 1) (_ : n ≤ Nat.succ n) x = ↑(toStepSucc k n) x
⊢ ↑(Ring.DirectLimit.of (Step k) (AlgebraicClosure.toStepOfLE' k) (n + 1))
      (AlgebraicClosure.toStepOfLE' k n (n + 1) (_ : n ≤ Nat.succ n) x) =
    ↑(Ring.DirectLimit.of (Step k) (AlgebraicClosure.toStepOfLE' k) n) x
[PROOFSTEP]
convert Ring.DirectLimit.of_f n.le_succ x
[GOAL]
k : Type u
inst✝ : Field k
f : (AlgebraicClosure k)[X]
hfm : Monic f
hfi : Irreducible f
⊢ ∃ x, eval x f = 0
[PROOFSTEP]
have : ∃ n p, Polynomial.map (ofStep k n) p = f := by convert Ring.DirectLimit.Polynomial.exists_of f
[GOAL]
k : Type u
inst✝ : Field k
f : (AlgebraicClosure k)[X]
hfm : Monic f
hfi : Irreducible f
⊢ ∃ n p, map (ofStep k n) p = f
[PROOFSTEP]
convert Ring.DirectLimit.Polynomial.exists_of f
[GOAL]
k : Type u
inst✝ : Field k
f : (AlgebraicClosure k)[X]
hfm : Monic f
hfi : Irreducible f
this : ∃ n p, map (ofStep k n) p = f
⊢ ∃ x, eval x f = 0
[PROOFSTEP]
obtain ⟨n, p, rfl⟩ := this
[GOAL]
case intro.intro
k : Type u
inst✝ : Field k
n : ℕ
p : (Step k n)[X]
hfm : Monic (map (ofStep k n) p)
hfi : Irreducible (map (ofStep k n) p)
⊢ ∃ x, eval x (map (ofStep k n) p) = 0
[PROOFSTEP]
rw [monic_map_iff] at hfm
[GOAL]
case intro.intro
k : Type u
inst✝ : Field k
n : ℕ
p : (Step k n)[X]
hfm : Monic p
hfi : Irreducible (map (ofStep k n) p)
⊢ ∃ x, eval x (map (ofStep k n) p) = 0
[PROOFSTEP]
have := hfm.irreducible_of_irreducible_map (ofStep k n) p hfi
[GOAL]
case intro.intro
k : Type u
inst✝ : Field k
n : ℕ
p : (Step k n)[X]
hfm : Monic p
hfi : Irreducible (map (ofStep k n) p)
this : Irreducible p
⊢ ∃ x, eval x (map (ofStep k n) p) = 0
[PROOFSTEP]
obtain ⟨x, hx⟩ := toStepSucc.exists_root k hfm this
[GOAL]
case intro.intro.intro
k : Type u
inst✝ : Field k
n : ℕ
p : (Step k n)[X]
hfm : Monic p
hfi : Irreducible (map (ofStep k n) p)
this : Irreducible p
x : Step k (n + 1)
hx : eval₂ (toStepSucc k n) x p = 0
⊢ ∃ x, eval x (map (ofStep k n) p) = 0
[PROOFSTEP]
refine' ⟨ofStep k (n + 1) x, _⟩
[GOAL]
case intro.intro.intro
k : Type u
inst✝ : Field k
n : ℕ
p : (Step k n)[X]
hfm : Monic p
hfi : Irreducible (map (ofStep k n) p)
this : Irreducible p
x : Step k (n + 1)
hx : eval₂ (toStepSucc k n) x p = 0
⊢ eval (↑(ofStep k (n + 1)) x) (map (ofStep k n) p) = 0
[PROOFSTEP]
rw [← ofStep_succ k n, eval_map, ← hom_eval₂, hx, RingHom.map_zero]
[GOAL]
k : Type u
inst✝⁶ : Field k
R : Type u_1
S : Type u_2
inst✝⁵ : CommSemiring R
inst✝⁴ : CommSemiring S
inst✝³ : Algebra R S
inst✝² : Algebra S k
inst✝¹ : Algebra R k
inst✝ : IsScalarTower R S k
⊢ IsScalarTower R S (AlgebraicClosure k)
[PROOFSTEP]
apply IsScalarTower.of_algebraMap_eq _
[GOAL]
k : Type u
inst✝⁶ : Field k
R : Type u_1
S : Type u_2
inst✝⁵ : CommSemiring R
inst✝⁴ : CommSemiring S
inst✝³ : Algebra R S
inst✝² : Algebra S k
inst✝¹ : Algebra R k
inst✝ : IsScalarTower R S k
⊢ ∀ (x : R), ↑(algebraMap R (AlgebraicClosure k)) x = ↑(algebraMap S (AlgebraicClosure k)) (↑(algebraMap R S) x)
[PROOFSTEP]
intro x
[GOAL]
k : Type u
inst✝⁶ : Field k
R : Type u_1
S : Type u_2
inst✝⁵ : CommSemiring R
inst✝⁴ : CommSemiring S
inst✝³ : Algebra R S
inst✝² : Algebra S k
inst✝¹ : Algebra R k
inst✝ : IsScalarTower R S k
x : R
⊢ ↑(algebraMap R (AlgebraicClosure k)) x = ↑(algebraMap S (AlgebraicClosure k)) (↑(algebraMap R S) x)
[PROOFSTEP]
simp only [algebraMap_def]
[GOAL]
k : Type u
inst✝⁶ : Field k
R : Type u_1
S : Type u_2
inst✝⁵ : CommSemiring R
inst✝⁴ : CommSemiring S
inst✝³ : Algebra R S
inst✝² : Algebra S k
inst✝¹ : Algebra R k
inst✝ : IsScalarTower R S k
x : R
⊢ ↑(RingHom.comp (ofStep k 0) (algebraMap R (Step k 0))) x =
    ↑(RingHom.comp (ofStep k 0) (algebraMap S (Step k 0))) (↑(algebraMap R S) x)
[PROOFSTEP]
rw [RingHom.comp_apply, RingHom.comp_apply]
[GOAL]
k : Type u
inst✝⁶ : Field k
R : Type u_1
S : Type u_2
inst✝⁵ : CommSemiring R
inst✝⁴ : CommSemiring S
inst✝³ : Algebra R S
inst✝² : Algebra S k
inst✝¹ : Algebra R k
inst✝ : IsScalarTower R S k
x : R
⊢ ↑(ofStep k 0) (↑(algebraMap R (Step k 0)) x) = ↑(ofStep k 0) (↑(algebraMap S (Step k 0)) (↑(algebraMap R S) x))
[PROOFSTEP]
exact
  RingHom.congr_arg _
    (IsScalarTower.algebraMap_apply R S k x : _)
      -- Porting Note: Original proof (without `by`) didn't work anymore, I think it couldn't figure
        -- out `algebraMap_def`. Orignally:
        -- IsScalarTower.of_algebraMap_eq fun x =>
        --   RingHom.congr_arg _ (IsScalarTower.algebraMap_apply R S k x : _)
[GOAL]
k : Type u
inst✝ : Field k
n : ℕ
src✝ : Step k n →+* AlgebraicClosure k := ofStep k n
⊢ ∀ (r : k),
    OneHom.toFun
        (↑↑{ toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
              map_add' :=
                (_ :
                  ∀ (x y : Step k n),
                    OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) })
        (↑(algebraMap k (Step k n)) r) =
      ↑(algebraMap k (AlgebraicClosure k)) r
[PROOFSTEP]
intro x
[GOAL]
k : Type u
inst✝ : Field k
n : ℕ
src✝ : Step k n →+* AlgebraicClosure k := ofStep k n
x : k
⊢ OneHom.toFun
      (↑↑{ toMonoidHom := ↑src✝, map_zero' := (_ : OneHom.toFun (↑↑src✝) 0 = 0),
            map_add' :=
              (_ :
                ∀ (x y : Step k n),
                  OneHom.toFun (↑↑src✝) (x + y) = OneHom.toFun (↑↑src✝) x + OneHom.toFun (↑↑src✝) y) })
      (↑(algebraMap k (Step k n)) x) =
    ↑(algebraMap k (AlgebraicClosure k)) x
[PROOFSTEP]
simp only [RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe, MonoidHom.toOneHom_coe, MonoidHom.coe_coe]
[GOAL]
k : Type u
inst✝ : Field k
n : ℕ
src✝ : Step k n →+* AlgebraicClosure k := ofStep k n
x : k
⊢ ↑(ofStep k n) (↑(algebraMap k (Step k n)) x) = ↑(algebraMap k (AlgebraicClosure k)) x
[PROOFSTEP]
convert @Ring.DirectLimit.of_f ℕ _ (Step k) _ (fun m n h => (toStepOfLE k m n h : _ → _)) 0 n n.zero_le x


[GOAL]
p✝ n✝ k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ n / p < n
[PROOFSTEP]
apply Nat.div_lt_self
[GOAL]
case hLtN
p✝ n✝ k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ 0 < n
[PROOFSTEP]
aesop
[GOAL]
case hLtK
p✝ n✝ k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ 1 < p
[PROOFSTEP]
aesop
[GOAL]
k p n : ℕ
⊢ go k p n = if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1) p (n / p) else k
[PROOFSTEP]
dsimp [go, go._unary]
[GOAL]
k p n : ℕ
⊢ WellFounded.fix go._unary.proof_1
      (fun _x a =>
        if h : 1 < _x.snd.fst ∧ 0 < _x.snd.snd ∧ _x.snd.snd % _x.snd.fst = 0 then
          a { fst := _x.fst + 1, snd := { fst := _x.snd.fst, snd := _x.snd.snd / _x.snd.fst } }
            (_ : _x.snd.snd / _x.snd.fst < _x.snd.snd)
        else _x.fst)
      { fst := k, snd := { fst := p, snd := n } } =
    if 1 < p ∧ 0 < n ∧ n % p = 0 then
      WellFounded.fix go._unary.proof_1
        (fun _x a =>
          if h : 1 < _x.snd.fst ∧ 0 < _x.snd.snd ∧ _x.snd.snd % _x.snd.fst = 0 then
            a { fst := _x.fst + 1, snd := { fst := _x.snd.fst, snd := _x.snd.snd / _x.snd.fst } }
              (_ : _x.snd.snd / _x.snd.fst < _x.snd.snd)
          else _x.fst)
        { fst := k + 1, snd := { fst := p, snd := n / p } }
    else k
[PROOFSTEP]
rw [WellFounded.fix_eq]
[GOAL]
k p n : ℕ
⊢ (if h :
        1 < { fst := k, snd := { fst := p, snd := n } }.snd.fst ∧
          0 < { fst := k, snd := { fst := p, snd := n } }.snd.snd ∧
            { fst := k, snd := { fst := p, snd := n } }.snd.snd % { fst := k, snd := { fst := p, snd := n } }.snd.fst =
              0 then
      (fun y x =>
          WellFounded.fix go._unary.proof_1
            (fun _x a =>
              if h : 1 < _x.snd.fst ∧ 0 < _x.snd.snd ∧ _x.snd.snd % _x.snd.fst = 0 then
                a { fst := _x.fst + 1, snd := { fst := _x.snd.fst, snd := _x.snd.snd / _x.snd.fst } }
                  (_ : _x.snd.snd / _x.snd.fst < _x.snd.snd)
              else _x.fst)
            y)
        { fst := { fst := k, snd := { fst := p, snd := n } }.fst + 1,
          snd :=
            { fst := { fst := k, snd := { fst := p, snd := n } }.snd.fst,
              snd :=
                { fst := k, snd := { fst := p, snd := n } }.snd.snd /
                  { fst := k, snd := { fst := p, snd := n } }.snd.fst } }
        (_ :
          { fst := k, snd := { fst := p, snd := n } }.snd.snd / { fst := k, snd := { fst := p, snd := n } }.snd.fst <
            { fst := k, snd := { fst := p, snd := n } }.snd.snd)
    else { fst := k, snd := { fst := p, snd := n } }.fst) =
    if 1 < p ∧ 0 < n ∧ n % p = 0 then
      WellFounded.fix go._unary.proof_1
        (fun _x a =>
          if h : 1 < _x.snd.fst ∧ 0 < _x.snd.snd ∧ _x.snd.snd % _x.snd.fst = 0 then
            a { fst := _x.fst + 1, snd := { fst := _x.snd.fst, snd := _x.snd.snd / _x.snd.fst } }
              (_ : _x.snd.snd / _x.snd.fst < _x.snd.snd)
          else _x.fst)
        { fst := k + 1, snd := { fst := p, snd := n / p } }
    else k
[PROOFSTEP]
simp
[GOAL]
k p n : ℕ
⊢ go (k + 1) p n = go k p n + 1
[PROOFSTEP]
rw [go_eq]
[GOAL]
k p n : ℕ
⊢ (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1 + 1) p (n / p) else k + 1) = go k p n + 1
[PROOFSTEP]
conv_rhs => rw [go_eq]
[GOAL]
k p n : ℕ
| go k p n + 1
[PROOFSTEP]
rw [go_eq]
[GOAL]
k p n : ℕ
| go k p n + 1
[PROOFSTEP]
rw [go_eq]
[GOAL]
k p n : ℕ
| go k p n + 1
[PROOFSTEP]
rw [go_eq]
[GOAL]
k p n : ℕ
⊢ (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1 + 1) p (n / p) else k + 1) =
    (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1) p (n / p) else k) + 1
[PROOFSTEP]
by_cases (1 < p ∧ 0 < n ∧ n % p = 0)
[GOAL]
k p n : ℕ
⊢ (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1 + 1) p (n / p) else k + 1) =
    (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1) p (n / p) else k) + 1
[PROOFSTEP]
by_cases (1 < p ∧ 0 < n ∧ n % p = 0)
[GOAL]
case pos
k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1 + 1) p (n / p) else k + 1) =
    (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1) p (n / p) else k) + 1
case neg
k p n : ℕ
h : ¬(1 < p ∧ 0 < n ∧ n % p = 0)
⊢ (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1 + 1) p (n / p) else k + 1) =
    (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1) p (n / p) else k) + 1
[PROOFSTEP]
swap
[GOAL]
case neg
k p n : ℕ
h : ¬(1 < p ∧ 0 < n ∧ n % p = 0)
⊢ (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1 + 1) p (n / p) else k + 1) =
    (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1) p (n / p) else k) + 1
[PROOFSTEP]
simp only [if_neg h]
[GOAL]
case pos
k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1 + 1) p (n / p) else k + 1) =
    (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1) p (n / p) else k) + 1
[PROOFSTEP]
have : n / p < n := by apply Nat.div_lt_self <;> aesop
[GOAL]
k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ n / p < n
[PROOFSTEP]
apply Nat.div_lt_self
[GOAL]
case hLtN
k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ 0 < n
[PROOFSTEP]
aesop
[GOAL]
case hLtK
k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ 1 < p
[PROOFSTEP]
aesop
[GOAL]
case pos
k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
⊢ (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1 + 1) p (n / p) else k + 1) =
    (if 1 < p ∧ 0 < n ∧ n % p = 0 then go (k + 1) p (n / p) else k) + 1
[PROOFSTEP]
simp only [if_pos h]
[GOAL]
case pos
k p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
⊢ go (k + 1 + 1) p (n / p) = go (k + 1) p (n / p) + 1
[PROOFSTEP]
apply go_succ
[GOAL]
n : ℕ
⊢ maxPowDiv 0 n = 0
[PROOFSTEP]
dsimp [maxPowDiv]
[GOAL]
n : ℕ
⊢ go 0 0 n = 0
[PROOFSTEP]
rw [maxPowDiv.go_eq]
[GOAL]
n : ℕ
⊢ (if 1 < 0 ∧ 0 < n ∧ n % 0 = 0 then go (0 + 1) 0 (n / 0) else 0) = 0
[PROOFSTEP]
simp
[GOAL]
p : ℕ
⊢ maxPowDiv p 0 = 0
[PROOFSTEP]
dsimp [maxPowDiv]
[GOAL]
p : ℕ
⊢ go 0 p 0 = 0
[PROOFSTEP]
rw [maxPowDiv.go_eq]
[GOAL]
p : ℕ
⊢ (if 1 < p ∧ 0 < 0 ∧ 0 % p = 0 then go (0 + 1) p (0 / p) else 0) = 0
[PROOFSTEP]
simp
[GOAL]
p n : ℕ
hp : 1 < p
hn : 0 < n
⊢ maxPowDiv p (p * n) = maxPowDiv p n + 1
[PROOFSTEP]
have : 0 < p := lt_trans (b := 1) (by simp) hp
[GOAL]
p n : ℕ
hp : 1 < p
hn : 0 < n
⊢ 0 < 1
[PROOFSTEP]
simp
[GOAL]
p n : ℕ
hp : 1 < p
hn : 0 < n
this : 0 < p
⊢ maxPowDiv p (p * n) = maxPowDiv p n + 1
[PROOFSTEP]
dsimp [maxPowDiv]
[GOAL]
p n : ℕ
hp : 1 < p
hn : 0 < n
this : 0 < p
⊢ go 0 p (p * n) = go 0 p n + 1
[PROOFSTEP]
rw [maxPowDiv.go_eq, if_pos, mul_div_right _ this]
[GOAL]
p n : ℕ
hp : 1 < p
hn : 0 < n
this : 0 < p
⊢ go (0 + 1) p n = go 0 p n + 1
[PROOFSTEP]
apply go_succ
[GOAL]
case hc
p n : ℕ
hp : 1 < p
hn : 0 < n
this : 0 < p
⊢ 1 < p ∧ 0 < p * n ∧ p * n % p = 0
[PROOFSTEP]
refine ⟨hp, ?_, by simp⟩
[GOAL]
p n : ℕ
hp : 1 < p
hn : 0 < n
this : 0 < p
⊢ p * n % p = 0
[PROOFSTEP]
simp
[GOAL]
case hc
p n : ℕ
hp : 1 < p
hn : 0 < n
this : 0 < p
⊢ 0 < p * n
[PROOFSTEP]
apply Nat.mul_pos this hn
[GOAL]
p n exp : ℕ
hp : 1 < p
hn : 0 < n
⊢ maxPowDiv p (p ^ exp * n) = maxPowDiv p n + exp
[PROOFSTEP]
match exp with
| 0 => simp
| e + 1 =>
  rw [pow_succ, mul_assoc, mul_comm, mul_assoc, base_mul_eq_succ hp, mul_comm, base_pow_mul hp hn]
  · ac_rfl
  · apply Nat.mul_pos hn <| pow_pos (pos_of_gt hp) e
[GOAL]
p n exp : ℕ
hp : 1 < p
hn : 0 < n
⊢ maxPowDiv p (p ^ 0 * n) = maxPowDiv p n + 0
[PROOFSTEP]
simp
[GOAL]
p n exp : ℕ
hp : 1 < p
hn : 0 < n
e : ℕ
⊢ maxPowDiv p (p ^ (e + 1) * n) = maxPowDiv p n + (e + 1)
[PROOFSTEP]
rw [pow_succ, mul_assoc, mul_comm, mul_assoc, base_mul_eq_succ hp, mul_comm, base_pow_mul hp hn]
[GOAL]
p n exp : ℕ
hp : 1 < p
hn : 0 < n
e : ℕ
⊢ maxPowDiv p n + e + 1 = maxPowDiv p n + (e + 1)
[PROOFSTEP]
ac_rfl
[GOAL]
p n exp : ℕ
hp : 1 < p
hn : 0 < n
e : ℕ
⊢ 0 < n * p ^ e
[PROOFSTEP]
apply Nat.mul_pos hn <| pow_pos (pos_of_gt hp) e
[GOAL]
p n : ℕ
⊢ p ^ maxPowDiv p n ∣ n
[PROOFSTEP]
dsimp [maxPowDiv]
[GOAL]
p n : ℕ
⊢ p ^ go 0 p n ∣ n
[PROOFSTEP]
rw [go_eq]
[GOAL]
p n : ℕ
⊢ (p ^ if 1 < p ∧ 0 < n ∧ n % p = 0 then go (0 + 1) p (n / p) else 0) ∣ n
[PROOFSTEP]
by_cases (1 < p ∧ 0 < n ∧ n % p = 0)
[GOAL]
p n : ℕ
⊢ (p ^ if 1 < p ∧ 0 < n ∧ n % p = 0 then go (0 + 1) p (n / p) else 0) ∣ n
[PROOFSTEP]
by_cases (1 < p ∧ 0 < n ∧ n % p = 0)
[GOAL]
case pos
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ (p ^ if 1 < p ∧ 0 < n ∧ n % p = 0 then go (0 + 1) p (n / p) else 0) ∣ n
[PROOFSTEP]
have : n / p < n := by apply Nat.div_lt_self <;> aesop
[GOAL]
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ n / p < n
[PROOFSTEP]
apply Nat.div_lt_self
[GOAL]
case hLtN
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ 0 < n
[PROOFSTEP]
aesop
[GOAL]
case hLtK
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
⊢ 1 < p
[PROOFSTEP]
aesop
[GOAL]
case pos
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
⊢ (p ^ if 1 < p ∧ 0 < n ∧ n % p = 0 then go (0 + 1) p (n / p) else 0) ∣ n
[PROOFSTEP]
rw [if_pos h]
[GOAL]
case pos
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
⊢ p ^ go (0 + 1) p (n / p) ∣ n
[PROOFSTEP]
have ⟨c, hc⟩ := pow_dvd p (n / p)
[GOAL]
case pos
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
c : ℕ
hc : n / p = p ^ maxPowDiv p (n / p) * c
⊢ p ^ go (0 + 1) p (n / p) ∣ n
[PROOFSTEP]
rw [go_succ, pow_succ]
[GOAL]
case pos
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
c : ℕ
hc : n / p = p ^ maxPowDiv p (n / p) * c
⊢ p ^ go 0 p (n / p) * p ∣ n
[PROOFSTEP]
nth_rw 2 [← mod_add_div' n p]
[GOAL]
case pos
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
c : ℕ
hc : n / p = p ^ maxPowDiv p (n / p) * c
⊢ p ^ go 0 p (n / p) * p ∣ n % p + n / p * p
[PROOFSTEP]
rw [h.right.right, zero_add]
[GOAL]
case pos
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
c : ℕ
hc : n / p = p ^ maxPowDiv p (n / p) * c
⊢ p ^ go 0 p (n / p) * p ∣ n / p * p
[PROOFSTEP]
exact ⟨c, by nth_rw 1 [hc]; ac_rfl⟩
[GOAL]
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
c : ℕ
hc : n / p = p ^ maxPowDiv p (n / p) * c
⊢ n / p * p = p ^ go 0 p (n / p) * p * c
[PROOFSTEP]
nth_rw 1 [hc]
[GOAL]
p n : ℕ
h : 1 < p ∧ 0 < n ∧ n % p = 0
this : n / p < n
c : ℕ
hc : n / p = p ^ maxPowDiv p (n / p) * c
⊢ p ^ maxPowDiv p (n / p) * c * p = p ^ go 0 p (n / p) * p * c
[PROOFSTEP]
ac_rfl
[GOAL]
case neg
p n : ℕ
h : ¬(1 < p ∧ 0 < n ∧ n % p = 0)
⊢ (p ^ if 1 < p ∧ 0 < n ∧ n % p = 0 then go (0 + 1) p (n / p) else 0) ∣ n
[PROOFSTEP]
rw [if_neg h]
[GOAL]
case neg
p n : ℕ
h : ¬(1 < p ∧ 0 < n ∧ n % p = 0)
⊢ p ^ 0 ∣ n
[PROOFSTEP]
simp
[GOAL]
p n pow : ℕ
hp : 1 < p
hn : 0 < n
h : p ^ pow ∣ n
⊢ pow ≤ maxPowDiv p n
[PROOFSTEP]
have ⟨c, hc⟩ := h
[GOAL]
p n pow : ℕ
hp : 1 < p
hn : 0 < n
h : p ^ pow ∣ n
c : ℕ
hc : n = p ^ pow * c
⊢ pow ≤ maxPowDiv p n
[PROOFSTEP]
have : 0 < c := by
  apply Nat.pos_of_ne_zero
  intro h'
  rw [h', mul_zero] at hc
  exact not_eq_zero_of_lt hn hc
[GOAL]
p n pow : ℕ
hp : 1 < p
hn : 0 < n
h : p ^ pow ∣ n
c : ℕ
hc : n = p ^ pow * c
⊢ 0 < c
[PROOFSTEP]
apply Nat.pos_of_ne_zero
[GOAL]
case a
p n pow : ℕ
hp : 1 < p
hn : 0 < n
h : p ^ pow ∣ n
c : ℕ
hc : n = p ^ pow * c
⊢ c ≠ 0
[PROOFSTEP]
intro h'
[GOAL]
case a
p n pow : ℕ
hp : 1 < p
hn : 0 < n
h : p ^ pow ∣ n
c : ℕ
hc : n = p ^ pow * c
h' : c = 0
⊢ False
[PROOFSTEP]
rw [h', mul_zero] at hc
[GOAL]
case a
p n pow : ℕ
hp : 1 < p
hn : 0 < n
h : p ^ pow ∣ n
c : ℕ
hc : n = 0
h' : c = 0
⊢ False
[PROOFSTEP]
exact not_eq_zero_of_lt hn hc
[GOAL]
p n pow : ℕ
hp : 1 < p
hn : 0 < n
h : p ^ pow ∣ n
c : ℕ
hc : n = p ^ pow * c
this : 0 < c
⊢ pow ≤ maxPowDiv p n
[PROOFSTEP]
simp [hc, base_pow_mul hp this]


[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ : ℕ
x✝ : ∃ p k, Prime p ∧ 0 < k ∧ p ^ k = n
p : R
k : ℕ
hp : Prime p
hk : 0 < k
hn : p ^ k = n
⊢ p ^ (?m.60081 x✝ p k hp hk hn + 1) = n
[PROOFSTEP]
rwa [Nat.sub_add_cancel hk]
[GOAL]
R : Type u_1
inst✝¹ : CommMonoidWithZero R
n p : R
k : ℕ
inst✝ : NoZeroDivisors R
⊢ ¬IsPrimePow 0
[PROOFSTEP]
simp only [isPrimePow_def, not_exists, not_and', and_imp]
[GOAL]
R : Type u_1
inst✝¹ : CommMonoidWithZero R
n p : R
k : ℕ
inst✝ : NoZeroDivisors R
⊢ ∀ (x : R) (x_1 : ℕ), 0 < x_1 → x ^ x_1 = 0 → ¬Prime x
[PROOFSTEP]
intro x n _hn hx
[GOAL]
R : Type u_1
inst✝¹ : CommMonoidWithZero R
n✝ p : R
k : ℕ
inst✝ : NoZeroDivisors R
x : R
n : ℕ
_hn : 0 < n
hx : x ^ n = 0
⊢ ¬Prime x
[PROOFSTEP]
rw [pow_eq_zero hx]
[GOAL]
R : Type u_1
inst✝¹ : CommMonoidWithZero R
n✝ p : R
k : ℕ
inst✝ : NoZeroDivisors R
x : R
n : ℕ
_hn : 0 < n
hx : x ^ n = 0
⊢ ¬Prime 0
[PROOFSTEP]
simp
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k : ℕ
p : R
hp : Prime p
⊢ p ^ 1 = p
[PROOFSTEP]
simp
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p✝ : R
k✝ : ℕ
n : R
hn✝ : IsPrimePow n
k : ℕ
hk : k ≠ 0
p : R
k' : ℕ
hp : Prime p
hk' : 0 < k'
hn : p ^ k' = n
⊢ p ^ (k * k') = n ^ k
[PROOFSTEP]
rw [pow_mul', hn]
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
⊢ IsPrimePow n ↔ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
simp only [isPrimePow_def, Nat.prime_iff]
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
⊢ IsPrimePow n ↔ ∃ p, p ≤ n ∧ ∃ k, k ≤ n ∧ Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
rw [isPrimePow_nat_iff]
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
⊢ (∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n) ↔ ∃ p, p ≤ n ∧ ∃ k, k ≤ n ∧ Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n : ℕ
⊢ (∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n) → ∃ p, p ≤ n ∧ ∃ k, k ≤ n ∧ Nat.Prime p ∧ 0 < k ∧ p ^ k = n
[PROOFSTEP]
rintro ⟨p, k, hp, hk, rfl⟩
[GOAL]
case intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
⊢ ∃ p_1, p_1 ≤ p ^ k ∧ ∃ k_1, k_1 ≤ p ^ k ∧ Nat.Prime p_1 ∧ 0 < k_1 ∧ p_1 ^ k_1 = p ^ k
[PROOFSTEP]
refine' ⟨p, _, k, (Nat.lt_pow_self hp.one_lt _).le, hp, hk, rfl⟩
[GOAL]
case intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
⊢ p ≤ p ^ k
[PROOFSTEP]
conv => {lhs; rw [← (pow_one p)]}
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
| p ≤ p ^ k
[PROOFSTEP]
{lhs; rw [← (pow_one p)]}
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
| p ≤ p ^ k
[PROOFSTEP]
{lhs; rw [← (pow_one p)]}
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
| p ≤ p ^ k
[PROOFSTEP]
lhs
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
| p
[PROOFSTEP]
rw [← (pow_one p)]
[GOAL]
case intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
hk : 0 < k
⊢ p ^ 1 ≤ p ^ k
[PROOFSTEP]
exact (Nat.pow_le_iff_le_right hp.two_le).mpr hk
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n m : ℕ
hn : IsPrimePow n
hm : m ∣ n
hm₁ : m ≠ 1
⊢ IsPrimePow m
[PROOFSTEP]
rw [isPrimePow_nat_iff] at hn ⊢
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k n m : ℕ
hn : ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n
hm : m ∣ n
hm₁ : m ≠ 1
⊢ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = m
[PROOFSTEP]
rcases hn with ⟨p, k, hp, _hk, rfl⟩
[GOAL]
case intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ m : ℕ
hm₁ : m ≠ 1
p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
hm : m ∣ p ^ k
⊢ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = m
[PROOFSTEP]
obtain ⟨i, hik, rfl⟩ := (Nat.dvd_prime_pow hp).1 hm
[GOAL]
case intro.intro.intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
i : ℕ
hik : i ≤ k
hm₁ : p ^ i ≠ 1
hm : p ^ i ∣ p ^ k
⊢ ∃ p_1 k, Nat.Prime p_1 ∧ 0 < k ∧ p_1 ^ k = p ^ i
[PROOFSTEP]
refine' ⟨p, i, hp, _, rfl⟩
[GOAL]
case intro.intro.intro.intro.intro.intro
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
i : ℕ
hik : i ≤ k
hm₁ : p ^ i ≠ 1
hm : p ^ i ∣ p ^ k
⊢ 0 < i
[PROOFSTEP]
apply Nat.pos_of_ne_zero
[GOAL]
case intro.intro.intro.intro.intro.intro.a
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
i : ℕ
hik : i ≤ k
hm₁ : p ^ i ≠ 1
hm : p ^ i ∣ p ^ k
⊢ i ≠ 0
[PROOFSTEP]
rintro rfl
[GOAL]
case intro.intro.intro.intro.intro.intro.a
R : Type u_1
inst✝ : CommMonoidWithZero R
n p✝ : R
k✝ p k : ℕ
hp : Nat.Prime p
_hk : 0 < k
hik : 0 ≤ k
hm₁ : p ^ 0 ≠ 1
hm : p ^ 0 ∣ p ^ k
⊢ False
[PROOFSTEP]
simp only [pow_zero, ne_eq] at hm₁
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n p : R
k a b : ℕ
hab : coprime a b
⊢ Disjoint (Finset.filter IsPrimePow (divisors a)) (Finset.filter IsPrimePow (divisors b))
[PROOFSTEP]
simp only [Finset.disjoint_left, Finset.mem_filter, and_imp, Nat.mem_divisors, not_and]
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n p : R
k a b : ℕ
hab : coprime a b
⊢ ∀ ⦃a_1 : ℕ⦄, a_1 ∣ a → a ≠ 0 → IsPrimePow a_1 → a_1 ∣ b → b ≠ 0 → ¬IsPrimePow a_1
[PROOFSTEP]
rintro n han _ha hn hbn _hb -
[GOAL]
R : Type u_1
inst✝ : CommMonoidWithZero R
n✝ p : R
k a b : ℕ
hab : coprime a b
n : ℕ
han : n ∣ a
_ha : a ≠ 0
hn : IsPrimePow n
hbn : n ∣ b
_hb : b ≠ 0
⊢ False
[PROOFSTEP]
exact hn.ne_one (Nat.eq_one_of_dvd_coprimes hab han hbn)


[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
N : ℕ
x : α
⊢ ↑(nearestPtInd e (N + 1)) x =
    if ∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x then N + 1 else ↑(nearestPtInd e N) x
[PROOFSTEP]
simp only [nearestPtInd, coe_piecewise, Set.piecewise]
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
N : ℕ
x : α
⊢ (if x ∈ ⋂ (k : ℕ) (_ : k ≤ Nat.add N 0), {x | edist (e (Nat.add N 0 + 1)) x < edist (e k) x} then
      ↑(const α (Nat.add N 0 + 1)) x
    else ↑(nearestPtInd e (Nat.add N 0)) x) =
    if ∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x then N + 1 else ↑(nearestPtInd e N) x
[PROOFSTEP]
congr
[GOAL]
case e_c
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
N : ℕ
x : α
⊢ (x ∈ ⋂ (k : ℕ) (_ : k ≤ Nat.add N 0), {x | edist (e (Nat.add N 0 + 1)) x < edist (e k) x}) =
    ∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x
[PROOFSTEP]
simp
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
N : ℕ
x : α
⊢ ↑(nearestPtInd e N) x ≤ N
[PROOFSTEP]
induction' N with N ihN
[GOAL]
case zero
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
⊢ ↑(nearestPtInd e Nat.zero) x ≤ Nat.zero
[PROOFSTEP]
simp
[GOAL]
case succ
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
N : ℕ
ihN : ↑(nearestPtInd e N) x ≤ N
⊢ ↑(nearestPtInd e (Nat.succ N)) x ≤ Nat.succ N
[PROOFSTEP]
simp only [nearestPtInd_succ]
[GOAL]
case succ
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
N : ℕ
ihN : ↑(nearestPtInd e N) x ≤ N
⊢ (if ∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x then N + 1 else ↑(nearestPtInd e N) x) ≤ Nat.succ N
[PROOFSTEP]
split_ifs
[GOAL]
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
N : ℕ
ihN : ↑(nearestPtInd e N) x ≤ N
h✝ : ∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x
⊢ N + 1 ≤ Nat.succ N
case neg
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
N : ℕ
ihN : ↑(nearestPtInd e N) x ≤ N
h✝ : ¬∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x
⊢ ↑(nearestPtInd e N) x ≤ Nat.succ N
[PROOFSTEP]
exacts [le_rfl, ihN.trans N.le_succ]
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k N : ℕ
hk : k ≤ N
⊢ edist (↑(nearestPt e N) x) x ≤ edist (e k) x
[PROOFSTEP]
induction' N with N ihN generalizing k
[GOAL]
case zero
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k✝ N : ℕ
hk✝ : k✝ ≤ N
k : ℕ
hk : k ≤ Nat.zero
⊢ edist (↑(nearestPt e Nat.zero) x) x ≤ edist (e k) x
[PROOFSTEP]
simp [nonpos_iff_eq_zero.1 hk, le_refl]
[GOAL]
case succ
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k✝ N✝ : ℕ
hk✝ : k✝ ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
k : ℕ
hk : k ≤ Nat.succ N
⊢ edist (↑(nearestPt e (Nat.succ N)) x) x ≤ edist (e k) x
[PROOFSTEP]
simp only [nearestPt, nearestPtInd_succ, map_apply]
[GOAL]
case succ
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k✝ N✝ : ℕ
hk✝ : k✝ ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
k : ℕ
hk : k ≤ Nat.succ N
⊢ edist (e (if ∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x then N + 1 else ↑(nearestPtInd e N) x)) x ≤
    edist (e k) x
[PROOFSTEP]
split_ifs with h
[GOAL]
case pos
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k✝ N✝ : ℕ
hk✝ : k✝ ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
k : ℕ
hk : k ≤ Nat.succ N
h : ∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x
⊢ edist (e (N + 1)) x ≤ edist (e k) x
[PROOFSTEP]
rcases hk.eq_or_lt with (rfl | hk)
[GOAL]
case pos.inl
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k N✝ : ℕ
hk✝ : k ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
h : ∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x
hk : Nat.succ N ≤ Nat.succ N
⊢ edist (e (N + 1)) x ≤ edist (e (Nat.succ N)) x
case pos.inr
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k✝ N✝ : ℕ
hk✝¹ : k✝ ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
k : ℕ
hk✝ : k ≤ Nat.succ N
h : ∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x
hk : k < Nat.succ N
⊢ edist (e (N + 1)) x ≤ edist (e k) x
[PROOFSTEP]
exacts [le_rfl, (h k (Nat.lt_succ_iff.1 hk)).le]
[GOAL]
case neg
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k✝ N✝ : ℕ
hk✝ : k✝ ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
k : ℕ
hk : k ≤ Nat.succ N
h : ¬∀ (k : ℕ), k ≤ N → edist (e (N + 1)) x < edist (e k) x
⊢ edist (e (↑(nearestPtInd e N) x)) x ≤ edist (e k) x
[PROOFSTEP]
push_neg at h
[GOAL]
case neg
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k✝ N✝ : ℕ
hk✝ : k✝ ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
k : ℕ
hk : k ≤ Nat.succ N
h : ∃ k, k ≤ N ∧ edist (e k) x ≤ edist (e (N + 1)) x
⊢ edist (e (↑(nearestPtInd e N) x)) x ≤ edist (e k) x
[PROOFSTEP]
rcases h with ⟨l, hlN, hxl⟩
[GOAL]
case neg.intro.intro
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k✝ N✝ : ℕ
hk✝ : k✝ ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
k : ℕ
hk : k ≤ Nat.succ N
l : ℕ
hlN : l ≤ N
hxl : edist (e l) x ≤ edist (e (N + 1)) x
⊢ edist (e (↑(nearestPtInd e N) x)) x ≤ edist (e k) x
[PROOFSTEP]
rcases hk.eq_or_lt with (rfl | hk)
[GOAL]
case neg.intro.intro.inl
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k N✝ : ℕ
hk✝ : k ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
l : ℕ
hlN : l ≤ N
hxl : edist (e l) x ≤ edist (e (N + 1)) x
hk : Nat.succ N ≤ Nat.succ N
⊢ edist (e (↑(nearestPtInd e N) x)) x ≤ edist (e (Nat.succ N)) x
case neg.intro.intro.inr
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
k✝ N✝ : ℕ
hk✝¹ : k✝ ≤ N✝
N : ℕ
ihN : ∀ {k : ℕ}, k ≤ N → edist (↑(nearestPt e N) x) x ≤ edist (e k) x
k : ℕ
hk✝ : k ≤ Nat.succ N
l : ℕ
hlN : l ≤ N
hxl : edist (e l) x ≤ edist (e (N + 1)) x
hk : k < Nat.succ N
⊢ edist (e (↑(nearestPtInd e N) x)) x ≤ edist (e k) x
[PROOFSTEP]
exacts [(ihN hlN).trans hxl, ihN (Nat.lt_succ_iff.1 hk)]
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
hx : x ∈ closure (Set.range e)
⊢ Tendsto (fun N => ↑(nearestPt e N) x) atTop (𝓝 x)
[PROOFSTEP]
refine' (atTop_basis.tendsto_iff nhds_basis_eball).2 fun ε hε => _
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
hx : x ∈ closure (Set.range e)
ε : ℝ≥0∞
hε : 0 < ε
⊢ ∃ ia, True ∧ ∀ (x_1 : ℕ), x_1 ∈ Set.Ici ia → ↑(nearestPt e x_1) x ∈ ball x ε
[PROOFSTEP]
rcases EMetric.mem_closure_iff.1 hx ε hε with ⟨_, ⟨N, rfl⟩, hN⟩
[GOAL]
case intro.intro.intro
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
hx : x ∈ closure (Set.range e)
ε : ℝ≥0∞
hε : 0 < ε
N : ℕ
hN : edist x (e N) < ε
⊢ ∃ ia, True ∧ ∀ (x_1 : ℕ), x_1 ∈ Set.Ici ia → ↑(nearestPt e x_1) x ∈ ball x ε
[PROOFSTEP]
rw [edist_comm] at hN
[GOAL]
case intro.intro.intro
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝² : MeasurableSpace α
inst✝¹ : PseudoEMetricSpace α
inst✝ : OpensMeasurableSpace α
e : ℕ → α
x : α
hx : x ∈ closure (Set.range e)
ε : ℝ≥0∞
hε : 0 < ε
N : ℕ
hN : edist (e N) x < ε
⊢ ∃ ia, True ∧ ∀ (x_1 : ℕ), x_1 ∈ Set.Ici ia → ↑(nearestPt e x_1) x ∈ ball x ε
[PROOFSTEP]
exact ⟨N, trivial, fun n hn => (edist_nearestPt_le e x hn).trans_lt hN⟩
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
n : ℕ
x : β
⊢ ↑(approxOn f hf s y₀ h₀ n) x ∈ s
[PROOFSTEP]
haveI : Nonempty s := ⟨⟨y₀, h₀⟩⟩
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
n : ℕ
x : β
this : Nonempty ↑s
⊢ ↑(approxOn f hf s y₀ h₀ n) x ∈ s
[PROOFSTEP]
suffices ∀ n, (Nat.casesOn n y₀ ((↑) ∘ denseSeq s) : α) ∈ s by apply this
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
n : ℕ
x : β
this✝ : Nonempty ↑s
this : ∀ (n : ℕ), Nat.casesOn n y₀ (Subtype.val ∘ denseSeq ↑s) ∈ s
⊢ ↑(approxOn f hf s y₀ h₀ n) x ∈ s
[PROOFSTEP]
apply this
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
n : ℕ
x : β
this : Nonempty ↑s
⊢ ∀ (n : ℕ), Nat.casesOn n y₀ (Subtype.val ∘ denseSeq ↑s) ∈ s
[PROOFSTEP]
rintro (_ | n)
[GOAL]
case zero
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
n : ℕ
x : β
this : Nonempty ↑s
⊢ Nat.casesOn Nat.zero y₀ (Subtype.val ∘ denseSeq ↑s) ∈ s
case succ
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
n✝ : ℕ
x : β
this : Nonempty ↑s
n : ℕ
⊢ Nat.casesOn (Nat.succ n) y₀ (Subtype.val ∘ denseSeq ↑s) ∈ s
[PROOFSTEP]
exacts [h₀, Subtype.mem _]
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
x : β
hx : f x ∈ closure s
⊢ Tendsto (fun n => ↑(approxOn f hf s y₀ h₀ n) x) atTop (𝓝 (f x))
[PROOFSTEP]
haveI : Nonempty s := ⟨⟨y₀, h₀⟩⟩
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
x : β
hx : f x ∈ closure s
this : Nonempty ↑s
⊢ Tendsto (fun n => ↑(approxOn f hf s y₀ h₀ n) x) atTop (𝓝 (f x))
[PROOFSTEP]
rw [← @Subtype.range_coe _ s, ← image_univ, ← (denseRange_denseSeq s).closure_eq] at hx
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
x : β
this : Nonempty ↑s
hx : f x ∈ closure (Subtype.val '' closure (Set.range (denseSeq ↑s)))
⊢ Tendsto (fun n => ↑(approxOn f hf s y₀ h₀ n) x) atTop (𝓝 (f x))
[PROOFSTEP]
simp (config := { iota := false }) only [approxOn, coe_comp]
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
x : β
this : Nonempty ↑s
hx : f x ∈ closure (Subtype.val '' closure (Set.range (denseSeq ↑s)))
⊢ Tendsto (fun n => (↑(nearestPt (fun k => Nat.casesOn k y₀ (Subtype.val ∘ denseSeq ↑s)) n) ∘ f) x) atTop (𝓝 (f x))
[PROOFSTEP]
refine' tendsto_nearestPt (closure_minimal _ isClosed_closure hx)
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
x : β
this : Nonempty ↑s
hx : f x ∈ closure (Subtype.val '' closure (Set.range (denseSeq ↑s)))
⊢ Subtype.val '' closure (Set.range (denseSeq ↑s)) ⊆
    closure (Set.range fun k => Nat.casesOn k y₀ (Subtype.val ∘ denseSeq ↑s))
[PROOFSTEP]
simp (config := { iota := false }) only [Nat.range_casesOn, closure_union, range_comp]
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
x : β
this : Nonempty ↑s
hx : f x ∈ closure (Subtype.val '' closure (Set.range (denseSeq ↑s)))
⊢ Subtype.val '' closure (Set.range (denseSeq ↑s)) ⊆ closure {y₀} ∪ closure (Subtype.val '' Set.range (denseSeq ↑s))
[PROOFSTEP]
exact Subset.trans (image_closure_subset_closure_image continuous_subtype_val) (subset_union_right _ _)
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
x : β
m n : ℕ
h : m ≤ n
⊢ edist (↑(approxOn f hf s y₀ h₀ n) x) (f x) ≤ edist (↑(approxOn f hf s y₀ h₀ m) x) (f x)
[PROOFSTEP]
dsimp only [approxOn, coe_comp, Function.comp]
[GOAL]
α : Type u_1
β : Type u_2
ι : Type u_3
E : Type u_4
F : Type u_5
𝕜 : Type u_6
inst✝⁴ : MeasurableSpace α
inst✝³ : PseudoEMetricSpace α
inst✝² : OpensMeasurableSpace α
inst✝¹ : MeasurableSpace β
f✝ f : β → α
hf : Measurable f
s : Set α
y₀ : α
h₀ : y₀ ∈ s
inst✝ : SeparableSpace ↑s
x : β
m n : ℕ
h : m ≤ n
⊢ edist (↑(nearestPt (fun k => Nat.rec y₀ (fun n n_ih => ↑(denseSeq (↑s) n)) k) n) (f x)) (f x) ≤
    edist (↑(nearestPt (fun k => Nat.rec y₀ (fun n n_ih => ↑(denseSeq (↑s) n)) k) m) (f x)) (f x)
[PROOFSTEP]
exact edist_nearestPt_le _ _ ((nearestPtInd_le _ _ _).trans h)


[GOAL]
M N : GroupWithZeroCat
f g : M ⟶ N
h : (fun f => f.toFun) f = (fun f => f.toFun) g
⊢ f = g
[PROOFSTEP]
cases f
[GOAL]
case mk
M N : GroupWithZeroCat
g : M ⟶ N
toZeroHom✝ : ZeroHom ↑M ↑N
map_one'✝ : ZeroHom.toFun toZeroHom✝ 1 = 1
map_mul'✝ : ∀ (x y : ↑M), ZeroHom.toFun toZeroHom✝ (x * y) = ZeroHom.toFun toZeroHom✝ x * ZeroHom.toFun toZeroHom✝ y
h : (fun f => f.toFun) { toZeroHom := toZeroHom✝, map_one' := map_one'✝, map_mul' := map_mul'✝ } = (fun f => f.toFun) g
⊢ { toZeroHom := toZeroHom✝, map_one' := map_one'✝, map_mul' := map_mul'✝ } = g
[PROOFSTEP]
cases g
[GOAL]
case mk.mk
M N : GroupWithZeroCat
toZeroHom✝¹ : ZeroHom ↑M ↑N
map_one'✝¹ : ZeroHom.toFun toZeroHom✝¹ 1 = 1
map_mul'✝¹ : ∀ (x y : ↑M), ZeroHom.toFun toZeroHom✝¹ (x * y) = ZeroHom.toFun toZeroHom✝¹ x * ZeroHom.toFun toZeroHom✝¹ y
toZeroHom✝ : ZeroHom ↑M ↑N
map_one'✝ : ZeroHom.toFun toZeroHom✝ 1 = 1
map_mul'✝ : ∀ (x y : ↑M), ZeroHom.toFun toZeroHom✝ (x * y) = ZeroHom.toFun toZeroHom✝ x * ZeroHom.toFun toZeroHom✝ y
h :
  (fun f => f.toFun) { toZeroHom := toZeroHom✝¹, map_one' := map_one'✝¹, map_mul' := map_mul'✝¹ } =
    (fun f => f.toFun) { toZeroHom := toZeroHom✝, map_one' := map_one'✝, map_mul' := map_mul'✝ }
⊢ { toZeroHom := toZeroHom✝¹, map_one' := map_one'✝¹, map_mul' := map_mul'✝¹ } =
    { toZeroHom := toZeroHom✝, map_one' := map_one'✝, map_mul' := map_mul'✝ }
[PROOFSTEP]
congr
[GOAL]
case mk.mk.e_toZeroHom
M N : GroupWithZeroCat
toZeroHom✝¹ : ZeroHom ↑M ↑N
map_one'✝¹ : ZeroHom.toFun toZeroHom✝¹ 1 = 1
map_mul'✝¹ : ∀ (x y : ↑M), ZeroHom.toFun toZeroHom✝¹ (x * y) = ZeroHom.toFun toZeroHom✝¹ x * ZeroHom.toFun toZeroHom✝¹ y
toZeroHom✝ : ZeroHom ↑M ↑N
map_one'✝ : ZeroHom.toFun toZeroHom✝ 1 = 1
map_mul'✝ : ∀ (x y : ↑M), ZeroHom.toFun toZeroHom✝ (x * y) = ZeroHom.toFun toZeroHom✝ x * ZeroHom.toFun toZeroHom✝ y
h :
  (fun f => f.toFun) { toZeroHom := toZeroHom✝¹, map_one' := map_one'✝¹, map_mul' := map_mul'✝¹ } =
    (fun f => f.toFun) { toZeroHom := toZeroHom✝, map_one' := map_one'✝, map_mul' := map_mul'✝ }
⊢ toZeroHom✝¹ = toZeroHom✝
[PROOFSTEP]
apply FunLike.coe_injective'
[GOAL]
case mk.mk.e_toZeroHom.a
M N : GroupWithZeroCat
toZeroHom✝¹ : ZeroHom ↑M ↑N
map_one'✝¹ : ZeroHom.toFun toZeroHom✝¹ 1 = 1
map_mul'✝¹ : ∀ (x y : ↑M), ZeroHom.toFun toZeroHom✝¹ (x * y) = ZeroHom.toFun toZeroHom✝¹ x * ZeroHom.toFun toZeroHom✝¹ y
toZeroHom✝ : ZeroHom ↑M ↑N
map_one'✝ : ZeroHom.toFun toZeroHom✝ 1 = 1
map_mul'✝ : ∀ (x y : ↑M), ZeroHom.toFun toZeroHom✝ (x * y) = ZeroHom.toFun toZeroHom✝ x * ZeroHom.toFun toZeroHom✝ y
h :
  (fun f => f.toFun) { toZeroHom := toZeroHom✝¹, map_one' := map_one'✝¹, map_mul' := map_mul'✝¹ } =
    (fun f => f.toFun) { toZeroHom := toZeroHom✝, map_one' := map_one'✝, map_mul' := map_mul'✝ }
⊢ ↑toZeroHom✝¹ = ↑toZeroHom✝
[PROOFSTEP]
exact h
[GOAL]
α β : GroupWithZeroCat
e : ↑α ≃* ↑β
⊢ ↑e ≫ ↑(MulEquiv.symm e) = 𝟙 α
[PROOFSTEP]
ext
[GOAL]
case w
α β : GroupWithZeroCat
e : ↑α ≃* ↑β
x✝ : (forget GroupWithZeroCat).obj α
⊢ ↑(↑e ≫ ↑(MulEquiv.symm e)) x✝ = ↑(𝟙 α) x✝
[PROOFSTEP]
exact e.symm_apply_apply _
[GOAL]
α β : GroupWithZeroCat
e : ↑α ≃* ↑β
⊢ ↑(MulEquiv.symm e) ≫ ↑e = 𝟙 β
[PROOFSTEP]
ext
[GOAL]
case w
α β : GroupWithZeroCat
e : ↑α ≃* ↑β
x✝ : (forget GroupWithZeroCat).obj β
⊢ ↑(↑(MulEquiv.symm e) ≫ ↑e) x✝ = ↑(𝟙 β) x✝
[PROOFSTEP]
exact e.apply_symm_apply _