l3lab/ntp-mathlib huggingface dataset:
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  

Proof state:
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
⊢ ∑ σ : L →ₐ[K] E, map (↑σ) ((x ^ r / (aeval x) (derivative (minpoly K x))) • minpolyDiv K x) - X ^ r = 0

Next tactic:
have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  

Proof state:
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
⊢ ∑ σ : L →ₐ[K] E, map (↑σ) ((x ^ r / (aeval x) (derivative (minpoly K x))) • minpolyDiv K x) - X ^ r = 0

Next tactic:
apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · 

Proof state:
case heval
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
⊢ ∀ (i : L →ₐ[K] E),
    eval (i x) (∑ σ : L →ₐ[K] E, map (↑σ) ((x ^ r / (aeval x) (derivative (minpoly K x))) • minpolyDiv K x) - X ^ r) = 0

Next tactic:
intro σ
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    

Proof state:
case heval
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
σ : L →ₐ[K] E
⊢ eval (σ x) (∑ σ : L →ₐ[K] E, map (↑σ) ((x ^ r / (aeval x) (derivative (minpoly K x))) • minpolyDiv K x) - X ^ r) = 0

Next tactic:
simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
    

Proof state:
case heval
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
σ : L →ₐ[K] E
⊢ σ x ^ r / σ ((aeval x) (derivative (minpoly K x))) * σ ((aeval x) (derivative (minpoly K x))) - σ x ^ r = 0

Next tactic:
rw [sub_eq_zero, div_mul_cancel]
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
    rw [sub_eq_zero, div_mul_cancel]
    

Proof state:
case heval.h
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
σ : L →ₐ[K] E
⊢ σ ((aeval x) (derivative (minpoly K x))) ≠ 0

Next tactic:
rw [ne_eq, map_eq_zero_iff σ σ.toRingHom.injective]
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
    rw [sub_eq_zero, div_mul_cancel]
    rw [ne_eq, map_eq_zero_iff σ σ.toRingHom.injective]
    

Proof state:
case heval.h
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
σ : L →ₐ[K] E
⊢ ¬(aeval x) (derivative (minpoly K x)) = 0

Next tactic:
exact (IsSeparable.separable _ _).aeval_derivative_ne_zero (minpoly.aeval _ _)
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
    rw [sub_eq_zero, div_mul_cancel]
    rw [ne_eq, map_eq_zero_iff σ σ.toRingHom.injective]
    exact (IsSeparable.separable _ _).aeval_derivative_ne_zero (minpoly.aeval _ _)
  · 

Proof state:
case hcard
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
⊢ natDegree (∑ σ : L →ₐ[K] E, map (↑σ) ((x ^ r / (aeval x) (derivative (minpoly K x))) • minpolyDiv K x) - X ^ r) <
    Fintype.card (L →ₐ[K] E)

Next tactic:
refine (Polynomial.natDegree_sub_le _ _).trans_lt
      (max_lt ((Polynomial.natDegree_sum_le _ _).trans_lt ?_) ?_)
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
    rw [sub_eq_zero, div_mul_cancel]
    rw [ne_eq, map_eq_zero_iff σ σ.toRingHom.injective]
    exact (IsSeparable.separable _ _).aeval_derivative_ne_zero (minpoly.aeval _ _)
  · refine (Polynomial.natDegree_sub_le _ _).trans_lt
      (max_lt ((Polynomial.natDegree_sum_le _ _).trans_lt ?_) ?_)
    · 

Proof state:
case hcard.refine_1
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
⊢ Finset.fold max 0 (natDegree ∘ fun σ => map (↑σ) ((x ^ r / (aeval x) (derivative (minpoly K x))) • minpolyDiv K x))
      Finset.univ <
    Fintype.card (L →ₐ[K] E)

Next tactic:
simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul,
        map_div₀, map_pow, RingHom.coe_coe, AlgHom.coe_coe, Function.comp_apply,
        Finset.mem_univ, forall_true_left, true_and, Finset.fold_max_lt, AlgHom.card]
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
    rw [sub_eq_zero, div_mul_cancel]
    rw [ne_eq, map_eq_zero_iff σ σ.toRingHom.injective]
    exact (IsSeparable.separable _ _).aeval_derivative_ne_zero (minpoly.aeval _ _)
  · refine (Polynomial.natDegree_sub_le _ _).trans_lt
      (max_lt ((Polynomial.natDegree_sum_le _ _).trans_lt ?_) ?_)
    · simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul,
        map_div₀, map_pow, RingHom.coe_coe, AlgHom.coe_coe, Function.comp_apply,
        Finset.mem_univ, forall_true_left, true_and, Finset.fold_max_lt, AlgHom.card]
      

Proof state:
case hcard.refine_1
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
⊢ 0 < finrank K L ∧
    ∀ (x_1 : L →ₐ[K] E),
      natDegree ((x_1 x ^ r / x_1 ((aeval x) (derivative (minpoly K x)))) • map (↑x_1) (minpolyDiv K x)) < finrank K L

Next tactic:
refine ⟨finrank_pos, ?_⟩
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
    rw [sub_eq_zero, div_mul_cancel]
    rw [ne_eq, map_eq_zero_iff σ σ.toRingHom.injective]
    exact (IsSeparable.separable _ _).aeval_derivative_ne_zero (minpoly.aeval _ _)
  · refine (Polynomial.natDegree_sub_le _ _).trans_lt
      (max_lt ((Polynomial.natDegree_sum_le _ _).trans_lt ?_) ?_)
    · simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul,
        map_div₀, map_pow, RingHom.coe_coe, AlgHom.coe_coe, Function.comp_apply,
        Finset.mem_univ, forall_true_left, true_and, Finset.fold_max_lt, AlgHom.card]
      refine ⟨finrank_pos, ?_⟩
      

Proof state:
case hcard.refine_1
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
⊢ ∀ (x_1 : L →ₐ[K] E),
    natDegree ((x_1 x ^ r / x_1 ((aeval x) (derivative (minpoly K x)))) • map (↑x_1) (minpolyDiv K x)) < finrank K L

Next tactic:
intro σ
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
    rw [sub_eq_zero, div_mul_cancel]
    rw [ne_eq, map_eq_zero_iff σ σ.toRingHom.injective]
    exact (IsSeparable.separable _ _).aeval_derivative_ne_zero (minpoly.aeval _ _)
  · refine (Polynomial.natDegree_sub_le _ _).trans_lt
      (max_lt ((Polynomial.natDegree_sum_le _ _).trans_lt ?_) ?_)
    · simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul,
        map_div₀, map_pow, RingHom.coe_coe, AlgHom.coe_coe, Function.comp_apply,
        Finset.mem_univ, forall_true_left, true_and, Finset.fold_max_lt, AlgHom.card]
      refine ⟨finrank_pos, ?_⟩
      intro σ
      

Proof state:
case hcard.refine_1
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
σ : L →ₐ[K] E
⊢ natDegree ((σ x ^ r / σ ((aeval x) (derivative (minpoly K x)))) • map (↑σ) (minpolyDiv K x)) < finrank K L

Next tactic:
exact ((Polynomial.natDegree_smul_le _ _).trans (natDegree_map_le _ _)).trans_lt
        ((natDegree_minpolyDiv_lt (Algebra.IsIntegral.of_finite _ _ x)).trans_le
          (minpoly.natDegree_le _))
lemma sum_smul_minpolyDiv_eq_X_pow (E) [Field E] [Algebra K E] [IsAlgClosed E]
    [FiniteDimensional K L] [IsSeparable K L]
    {x : L} (hxL : Algebra.adjoin K {x} = ⊤) {r : ℕ} (hr : r < finrank K L) :
    ∑ σ : L →ₐ[K] E, ((x ^ r / aeval x (derivative <| minpoly K x)) •
      minpolyDiv K x).map σ = (X ^ r : E[X]) := by
  classical
  rw [← sub_eq_zero]
  have : Function.Injective (fun σ : L →ₐ[K] E ↦ σ x) := fun _ _ h =>
    AlgHom.ext_of_adjoin_eq_top hxL (fun _ hx ↦ hx ▸ h)
  apply Polynomial.eq_zero_of_natDegree_lt_card_of_eval_eq_zero _ this
  · intro σ
    simp only [Polynomial.map_smul, map_div₀, map_pow, RingHom.coe_coe, eval_sub, eval_finset_sum,
      eval_smul, eval_map, eval₂_minpolyDiv_self, this.eq_iff, smul_eq_mul, mul_ite, mul_zero,
      Finset.sum_ite_eq', Finset.mem_univ, ite_true, eval_pow, eval_X]
    rw [sub_eq_zero, div_mul_cancel]
    rw [ne_eq, map_eq_zero_iff σ σ.toRingHom.injective]
    exact (IsSeparable.separable _ _).aeval_derivative_ne_zero (minpoly.aeval _ _)
  · refine (Polynomial.natDegree_sub_le _ _).trans_lt
      (max_lt ((Polynomial.natDegree_sum_le _ _).trans_lt ?_) ?_)
    · simp only [AlgEquiv.toAlgHom_eq_coe, Polynomial.map_smul,
        map_div₀, map_pow, RingHom.coe_coe, AlgHom.coe_coe, Function.comp_apply,
        Finset.mem_univ, forall_true_left, true_and, Finset.fold_max_lt, AlgHom.card]
      refine ⟨finrank_pos, ?_⟩
      intro σ
      exact ((Polynomial.natDegree_smul_le _ _).trans (natDegree_map_le _ _)).trans_lt
        ((natDegree_minpolyDiv_lt (Algebra.IsIntegral.of_finite _ _ x)).trans_le
          (minpoly.natDegree_le _))
    · 

Proof state:
case hcard.refine_2
R : Type ?u.413236
K : Type u_2
L : Type u_3
S : Type ?u.413245
inst✝¹⁰ : CommRing R
inst✝⁹ : Field K
inst✝⁸ : Field L
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : Algebra K L
x✝ : S
hx : IsIntegral R x✝
E : Type u_1
inst✝⁴ : Field E
inst✝³ : Algebra K E
inst✝² : IsAlgClosed E
inst✝¹ : FiniteDimensional K L
inst✝ : IsSeparable K L
x : L
hxL : Algebra.adjoin K {x} = ⊤
r : ℕ
hr : r < finrank K L
this : Function.Injective fun σ => σ x
⊢ natDegree (X ^ r) < Fintype.card (L →ₐ[K] E)

Next tactic:
rwa [natDegree_pow, natDegree_X, mul_one, AlgHom.card]
@[simp]
lemma fromColumns_toColumns (A : Matrix m (n₁ ⊕ n₂) R) :
    fromColumns A.toColumns₁ A.toColumns₂ = A := by
  

Proof state:
R : Type u_1
m : Type u_2
m₁ : Type u_3
m₂ : Type u_4
n : Type u_5
n₁ : Type u_6
n₂ : Type u_7
inst✝¹¹ : Fintype m
inst✝¹⁰ : Fintype m₁
inst✝⁹ : Fintype m₂
inst✝⁸ : Fintype n
inst✝⁷ : Fintype n₁
inst✝⁶ : Fintype n₂
inst✝⁵ : DecidableEq m
inst✝⁴ : DecidableEq m₁
inst✝³ : DecidableEq m₂
inst✝² : DecidableEq n
inst✝¹ : DecidableEq n₁
inst✝ : DecidableEq n₂
A : Matrix m (n₁ ⊕ n₂) R
⊢ fromColumns (toColumns₁ A) (toColumns₂ A) = A

Next tactic:
ext i (j | j)
@[simp]
lemma fromColumns_toColumns (A : Matrix m (n₁ ⊕ n₂) R) :
    fromColumns A.toColumns₁ A.toColumns₂ = A := by
  ext i (j | j) <;> 

Proof state:
case a.h.inl
R : Type u_1
m : Type u_2
m₁ : Type u_3
m₂ : Type u_4
n : Type u_5
n₁ : Type u_6
n₂ : Type u_7
inst✝¹¹ : Fintype m
inst✝¹⁰ : Fintype m₁
inst✝⁹ : Fintype m₂
inst✝⁸ : Fintype n
inst✝⁷ : Fintype n₁
inst✝⁶ : Fintype n₂
inst✝⁵ : DecidableEq m
inst✝⁴ : DecidableEq m₁
inst✝³ : DecidableEq m₂
inst✝² : DecidableEq n
inst✝¹ : DecidableEq n₁
inst✝ : DecidableEq n₂
A : Matrix m (n₁ ⊕ n₂) R
i : m
j : n₁
⊢ fromColumns (toColumns₁ A) (toColumns₂ A) i (Sum.inl j) = A i (Sum.inl j)

Next tactic:
simp
@[simp]
lemma fromColumns_toColumns (A : Matrix m (n₁ ⊕ n₂) R) :
    fromColumns A.toColumns₁ A.toColumns₂ = A := by
  ext i (j | j) <;> 

Proof state:
case a.h.inr
R : Type u_1
m : Type u_2
m₁ : Type u_3
m₂ : Type u_4
n : Type u_5
n₁ : Type u_6
n₂ : Type u_7
inst✝¹¹ : Fintype m
inst✝¹⁰ : Fintype m₁
inst✝⁹ : Fintype m₂
inst✝⁸ : Fintype n
inst✝⁷ : Fintype n₁
inst✝⁶ : Fintype n₂
inst✝⁵ : DecidableEq m
inst✝⁴ : DecidableEq m₁
inst✝³ : DecidableEq m₂
inst✝² : DecidableEq n
inst✝¹ : DecidableEq n₁
inst✝ : DecidableEq n₂
A : Matrix m (n₁ ⊕ n₂) R
i : m
j : n₂
⊢ fromColumns (toColumns₁ A) (toColumns₂ A) i (Sum.inr j) = A i (Sum.inr j)

Next tactic:
simp
@[simp]
lemma fromRows_toRows (A : Matrix (m₁ ⊕ m₂) n R) : fromRows A.toRows₁ A.toRows₂ = A := by
  

Proof state:
R : Type u_1
m : Type u_2
m₁ : Type u_3
m₂ : Type u_4
n : Type u_5
n₁ : Type u_6
n₂ : Type u_7
inst✝¹¹ : Fintype m
inst✝¹⁰ : Fintype m₁
inst✝⁹ : Fintype m₂
inst✝⁸ : Fintype n
inst✝⁷ : Fintype n₁
inst✝⁶ : Fintype n₂
inst✝⁵ : DecidableEq m
inst✝⁴ : DecidableEq m₁
inst✝³ : DecidableEq m₂
inst✝² : DecidableEq n
inst✝¹ : DecidableEq n₁
inst✝ : DecidableEq n₂
A : Matrix (m₁ ⊕ m₂) n R
⊢ fromRows (toRows₁ A) (toRows₂ A) = A

Next tactic:
ext (i | i) j