l3lab/ntp-mathlib huggingface dataset:
/-- Morphisms from an `ℕ`-indexed chain complex `C`
to a single object chain complex with `X` concentrated in degree 0
are the same as morphisms `f : C.X 0 ⟶ X` such that `C.d 1 0 ≫ f = 0`.
-/
@[simps apply_coe]
noncomputable def toSingle₀Equiv (C : ChainComplex V ℕ) (X : V) :
    (C ⟶ (single₀ V).obj X) ≃ { f : C.X 0 ⟶ X // C.d 1 0 ≫ f = 0 } where
  toFun φ := ⟨φ.f 0, by rw [← φ.comm 1 0, HomologicalComplex.single_obj_d, comp_zero]⟩
  invFun f := HomologicalComplex.mkHomToSingle f.1 (fun i hi => by
    obtain rfl : i = 1 := by simpa using hi.symm
    exact f.2)
  left_inv φ := by aesop_cat
  right_inv f := by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : ChainComplex V ℕ
X : V
f : { f // HomologicalComplex.d C 1 0 ≫ f = 0 }
⊢ (fun φ =>
        { val := HomologicalComplex.Hom.f φ 0,
          property := (_ : HomologicalComplex.d C 1 0 ≫ HomologicalComplex.Hom.f φ 0 = 0) })
      ((fun f =>
          HomologicalComplex.mkHomToSingle ↑f
            (_ : ∀ (i : ℕ), ComplexShape.Rel (ComplexShape.down ℕ) i 0 → HomologicalComplex.d C i 0 ≫ ↑f = 0))
        f) =
    f

Next tactic:
aesop_cat
@[simp]
lemma toSingle₀Equiv_symm_apply_f_zero {C : ChainComplex V ℕ} {X : V}
    (f : C.X 0 ⟶ X) (hf : C.d 1 0 ≫ f = 0) :
    ((toSingle₀Equiv C X).symm ⟨f, hf⟩).f 0 = f := by
  

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : ChainComplex V ℕ
X : V
f : HomologicalComplex.X C 0 ⟶ X
hf : HomologicalComplex.d C 1 0 ≫ f = 0
⊢ HomologicalComplex.Hom.f ((toSingle₀Equiv C X).symm { val := f, property := hf }) 0 = f

Next tactic:
simp [toSingle₀Equiv]
/-- Morphisms from a single object chain complex with `X` concentrated in degree 0
to an `ℕ`-indexed chain complex `C` are the same as morphisms `f : X → C.X 0`.
-/
@[simps apply]
noncomputable def fromSingle₀Equiv (C : ChainComplex V ℕ) (X : V) :
    ((single₀ V).obj X ⟶ C) ≃ (X ⟶ C.X 0) where
  toFun f := f.f 0
  invFun f := HomologicalComplex.mkHomFromSingle f (fun i hi => by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : ChainComplex V ℕ
X : V
f : X ⟶ HomologicalComplex.X C 0
i : ℕ
hi : ComplexShape.Rel (ComplexShape.down ℕ) 0 i
⊢ f ≫ HomologicalComplex.d C 0 i = 0

Next tactic:
simp at hi
/-- Morphisms from a single object chain complex with `X` concentrated in degree 0
to an `ℕ`-indexed chain complex `C` are the same as morphisms `f : X → C.X 0`.
-/
@[simps apply]
noncomputable def fromSingle₀Equiv (C : ChainComplex V ℕ) (X : V) :
    ((single₀ V).obj X ⟶ C) ≃ (X ⟶ C.X 0) where
  toFun f := f.f 0
  invFun f := HomologicalComplex.mkHomFromSingle f (fun i hi => by simp at hi)
  left_inv := by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : ChainComplex V ℕ
X : V
⊢ Function.LeftInverse
    (fun f =>
      HomologicalComplex.mkHomFromSingle f
        (_ : ∀ (i : ℕ), ComplexShape.Rel (ComplexShape.down ℕ) 0 i → f ≫ HomologicalComplex.d C 0 i = 0))
    fun f => HomologicalComplex.Hom.f f 0

Next tactic:
aesop_cat
/-- Morphisms from a single object chain complex with `X` concentrated in degree 0
to an `ℕ`-indexed chain complex `C` are the same as morphisms `f : X → C.X 0`.
-/
@[simps apply]
noncomputable def fromSingle₀Equiv (C : ChainComplex V ℕ) (X : V) :
    ((single₀ V).obj X ⟶ C) ≃ (X ⟶ C.X 0) where
  toFun f := f.f 0
  invFun f := HomologicalComplex.mkHomFromSingle f (fun i hi => by simp at hi)
  left_inv := by aesop_cat
  right_inv := by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : ChainComplex V ℕ
X : V
⊢ Function.RightInverse
    (fun f =>
      HomologicalComplex.mkHomFromSingle f
        (_ : ∀ (i : ℕ), ComplexShape.Rel (ComplexShape.down ℕ) 0 i → f ≫ HomologicalComplex.d C 0 i = 0))
    fun f => HomologicalComplex.Hom.f f 0

Next tactic:
aesop_cat
@[simp]
lemma fromSingle₀Equiv_symm_apply_f_zero
    {C : ChainComplex V ℕ} {X : V} (f : X ⟶ C.X 0) :
    ((fromSingle₀Equiv C X).symm f).f 0 = f := by
  

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : ChainComplex V ℕ
X : V
f : X ⟶ HomologicalComplex.X C 0
⊢ HomologicalComplex.Hom.f ((fromSingle₀Equiv C X).symm f) 0 = f

Next tactic:
simp [fromSingle₀Equiv]
@[simp]
lemma single₀_map_f_zero {A B : V} (f : A ⟶ B) :
    ((single₀ V).map f).f 0 = f := by
  rw [HomologicalComplex.single_map_f_self]
  

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
A B : V
f : A ⟶ B
⊢ (HomologicalComplex.singleObjXSelf (ComplexShape.up ℕ) 0 A).hom ≫
      f ≫ (HomologicalComplex.singleObjXSelf (ComplexShape.up ℕ) 0 B).inv =
    f

Next tactic:
dsimp [HomologicalComplex.singleObjXSelf, HomologicalComplex.singleObjXIsoOfEq]
/-- Morphisms from a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C`
are the same as morphisms `f : X ⟶ C.X 0` such that `f ≫ C.d 0 1 = 0`. -/
@[simps apply_coe]
noncomputable def fromSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
    ((single₀ V).obj X ⟶ C) ≃ { f : X ⟶ C.X 0 // f ≫ C.d 0 1 = 0 } where
  toFun φ := ⟨φ.f 0, by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
φ : (single₀ V).obj X ⟶ C
⊢ HomologicalComplex.Hom.f φ 0 ≫ HomologicalComplex.d C 0 1 = 0

Next tactic:
rw [φ.comm 0 1, HomologicalComplex.single_obj_d, zero_comp]
/-- Morphisms from a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C`
are the same as morphisms `f : X ⟶ C.X 0` such that `f ≫ C.d 0 1 = 0`. -/
@[simps apply_coe]
noncomputable def fromSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
    ((single₀ V).obj X ⟶ C) ≃ { f : X ⟶ C.X 0 // f ≫ C.d 0 1 = 0 } where
  toFun φ := ⟨φ.f 0, by rw [φ.comm 0 1, HomologicalComplex.single_obj_d, zero_comp]⟩
  invFun f := HomologicalComplex.mkHomFromSingle f.1 (fun i hi => by
    

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
f : { f // f ≫ HomologicalComplex.d C 0 1 = 0 }
i : ℕ
hi : ComplexShape.Rel (ComplexShape.up ℕ) 0 i
⊢ ↑f ≫ HomologicalComplex.d C 0 i = 0

Next tactic:
obtain rfl : i = 1 := by simpa using hi.symm
/-- Morphisms from a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C`
are the same as morphisms `f : X ⟶ C.X 0` such that `f ≫ C.d 0 1 = 0`. -/
@[simps apply_coe]
noncomputable def fromSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
    ((single₀ V).obj X ⟶ C) ≃ { f : X ⟶ C.X 0 // f ≫ C.d 0 1 = 0 } where
  toFun φ := ⟨φ.f 0, by rw [φ.comm 0 1, HomologicalComplex.single_obj_d, zero_comp]⟩
  invFun f := HomologicalComplex.mkHomFromSingle f.1 (fun i hi => by
    obtain rfl : i = 1 := by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
f : { f // f ≫ HomologicalComplex.d C 0 1 = 0 }
i : ℕ
hi : ComplexShape.Rel (ComplexShape.up ℕ) 0 i
⊢ i = 1

Next tactic:
simpa using hi.symm
/-- Morphisms from a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C`
are the same as morphisms `f : X ⟶ C.X 0` such that `f ≫ C.d 0 1 = 0`. -/
@[simps apply_coe]
noncomputable def fromSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
    ((single₀ V).obj X ⟶ C) ≃ { f : X ⟶ C.X 0 // f ≫ C.d 0 1 = 0 } where
  toFun φ := ⟨φ.f 0, by rw [φ.comm 0 1, HomologicalComplex.single_obj_d, zero_comp]⟩
  invFun f := HomologicalComplex.mkHomFromSingle f.1 (fun i hi => by
    obtain rfl : i = 1 := by simpa using hi.symm
    

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
f : { f // f ≫ HomologicalComplex.d C 0 1 = 0 }
hi : ComplexShape.Rel (ComplexShape.up ℕ) 0 1
⊢ ↑f ≫ HomologicalComplex.d C 0 1 = 0

Next tactic:
exact f.2
/-- Morphisms from a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C`
are the same as morphisms `f : X ⟶ C.X 0` such that `f ≫ C.d 0 1 = 0`. -/
@[simps apply_coe]
noncomputable def fromSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
    ((single₀ V).obj X ⟶ C) ≃ { f : X ⟶ C.X 0 // f ≫ C.d 0 1 = 0 } where
  toFun φ := ⟨φ.f 0, by rw [φ.comm 0 1, HomologicalComplex.single_obj_d, zero_comp]⟩
  invFun f := HomologicalComplex.mkHomFromSingle f.1 (fun i hi => by
    obtain rfl : i = 1 := by simpa using hi.symm
    exact f.2)
  left_inv φ := by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
φ : (single₀ V).obj X ⟶ C
⊢ (fun f =>
        HomologicalComplex.mkHomFromSingle ↑f
          (_ : ∀ (i : ℕ), ComplexShape.Rel (ComplexShape.up ℕ) 0 i → ↑f ≫ HomologicalComplex.d C 0 i = 0))
      ((fun φ =>
          { val := HomologicalComplex.Hom.f φ 0,
            property := (_ : HomologicalComplex.Hom.f φ 0 ≫ HomologicalComplex.d C 0 1 = 0) })
        φ) =
    φ

Next tactic:
aesop_cat
/-- Morphisms from a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C`
are the same as morphisms `f : X ⟶ C.X 0` such that `f ≫ C.d 0 1 = 0`. -/
@[simps apply_coe]
noncomputable def fromSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
    ((single₀ V).obj X ⟶ C) ≃ { f : X ⟶ C.X 0 // f ≫ C.d 0 1 = 0 } where
  toFun φ := ⟨φ.f 0, by rw [φ.comm 0 1, HomologicalComplex.single_obj_d, zero_comp]⟩
  invFun f := HomologicalComplex.mkHomFromSingle f.1 (fun i hi => by
    obtain rfl : i = 1 := by simpa using hi.symm
    exact f.2)
  left_inv φ := by aesop_cat
  right_inv := by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
⊢ Function.RightInverse
    (fun f =>
      HomologicalComplex.mkHomFromSingle ↑f
        (_ : ∀ (i : ℕ), ComplexShape.Rel (ComplexShape.up ℕ) 0 i → ↑f ≫ HomologicalComplex.d C 0 i = 0))
    fun φ =>
    { val := HomologicalComplex.Hom.f φ 0,
      property := (_ : HomologicalComplex.Hom.f φ 0 ≫ HomologicalComplex.d C 0 1 = 0) }

Next tactic:
aesop_cat
@[simp]
lemma fromSingle₀Equiv_symm_apply_f_zero {C : CochainComplex V ℕ} {X : V}
    (f : X ⟶ C.X 0) (hf : f ≫ C.d 0 1 = 0) :
    ((fromSingle₀Equiv C X).symm ⟨f, hf⟩).f 0 = f := by
  

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
f : X ⟶ HomologicalComplex.X C 0
hf : f ≫ HomologicalComplex.d C 0 1 = 0
⊢ HomologicalComplex.Hom.f ((fromSingle₀Equiv C X).symm { val := f, property := hf }) 0 = f

Next tactic:
simp [fromSingle₀Equiv]
/-- Morphisms to a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C` are the same as morphisms `f : C.X 0 ⟶ X`.
-/
@[simps apply]
noncomputable def toSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
    (C ⟶ (single₀ V).obj X) ≃ (C.X 0 ⟶ X) where
  toFun f := f.f 0
  invFun f := HomologicalComplex.mkHomToSingle f (fun i hi => by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
f : HomologicalComplex.X C 0 ⟶ X
i : ℕ
hi : ComplexShape.Rel (ComplexShape.up ℕ) i 0
⊢ HomologicalComplex.d C i 0 ≫ f = 0

Next tactic:
simp at hi
/-- Morphisms to a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C` are the same as morphisms `f : C.X 0 ⟶ X`.
-/
@[simps apply]
noncomputable def toSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
    (C ⟶ (single₀ V).obj X) ≃ (C.X 0 ⟶ X) where
  toFun f := f.f 0
  invFun f := HomologicalComplex.mkHomToSingle f (fun i hi => by simp at hi)
  left_inv := by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
⊢ Function.LeftInverse
    (fun f =>
      HomologicalComplex.mkHomToSingle f
        (_ : ∀ (i : ℕ), ComplexShape.Rel (ComplexShape.up ℕ) i 0 → HomologicalComplex.d C i 0 ≫ f = 0))
    fun f => HomologicalComplex.Hom.f f 0

Next tactic:
aesop_cat
/-- Morphisms to a single object cochain complex with `X` concentrated in degree 0
to an `ℕ`-indexed cochain complex `C` are the same as morphisms `f : C.X 0 ⟶ X`.
-/
@[simps apply]
noncomputable def toSingle₀Equiv (C : CochainComplex V ℕ) (X : V) :
    (C ⟶ (single₀ V).obj X) ≃ (C.X 0 ⟶ X) where
  toFun f := f.f 0
  invFun f := HomologicalComplex.mkHomToSingle f (fun i hi => by simp at hi)
  left_inv := by aesop_cat
  right_inv := by 

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
⊢ Function.RightInverse
    (fun f =>
      HomologicalComplex.mkHomToSingle f
        (_ : ∀ (i : ℕ), ComplexShape.Rel (ComplexShape.up ℕ) i 0 → HomologicalComplex.d C i 0 ≫ f = 0))
    fun f => HomologicalComplex.Hom.f f 0

Next tactic:
aesop_cat
@[simp]
lemma toSingle₀Equiv_symm_apply_f_zero
    {C : CochainComplex V ℕ} {X : V} (f : C.X 0 ⟶ X) :
    ((toSingle₀Equiv C X).symm f).f 0 = f := by
  

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
f : HomologicalComplex.X C 0 ⟶ X
⊢ HomologicalComplex.Hom.f ((toSingle₀Equiv C X).symm f) 0 = f

Next tactic:
simp [toSingle₀Equiv]
@[simp]
lemma toSingle₀Equiv_symm_apply_f_succ
    {C : CochainComplex V ℕ} {X : V} (f : C.X 0 ⟶ X) (n : ℕ) :
    ((toSingle₀Equiv C X).symm f).f (n + 1) = 0 := by
  

Proof state:
V : Type u
inst✝² : Category.{v, u} V
inst✝¹ : HasZeroMorphisms V
inst✝ : HasZeroObject V
C : CochainComplex V ℕ
X : V
f : HomologicalComplex.X C 0 ⟶ X
n : ℕ
⊢ HomologicalComplex.Hom.f ((toSingle₀Equiv C X).symm f) (n + 1) = 0

Next tactic:
rfl
theorem cardinal_mk_le_sigma_polynomial :
    #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) :=
  @mk_le_of_injective L (Σ p : R[X], {x : L | x ∈ p.aroots L})
    (fun x : L =>
      let p := Classical.indefiniteDescription _ (halg x)
      ⟨p.1, x, by
        

Proof state:
R L : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing L
inst✝² : IsDomain L
inst✝¹ : Algebra R L
inst✝ : NoZeroSMulDivisors R L
halg : IsAlgebraic R L
x : L
p : { x_1 // x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0 } :=
  Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0) (_ : _root_.IsAlgebraic R x)
⊢ x ∈ {x_1 | x_1 ∈ Polynomial.aroots (↑p) L}

Next tactic:
dsimp
theorem cardinal_mk_le_sigma_polynomial :
    #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) :=
  @mk_le_of_injective L (Σ p : R[X], {x : L | x ∈ p.aroots L})
    (fun x : L =>
      let p := Classical.indefiniteDescription _ (halg x)
      ⟨p.1, x, by
        dsimp
        

Proof state:
R L : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing L
inst✝² : IsDomain L
inst✝¹ : Algebra R L
inst✝ : NoZeroSMulDivisors R L
halg : IsAlgebraic R L
x : L
p : { x_1 // x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0 } :=
  Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0) (_ : _root_.IsAlgebraic R x)
⊢ x ∈
    Polynomial.aroots
      (↑(Classical.indefiniteDescription (fun x_1 => ¬x_1 = 0 ∧ (Polynomial.aeval x) x_1 = 0)
          (_ : _root_.IsAlgebraic R x)))
      L

Next tactic:
have h : p.1.map (algebraMap R L) ≠ 0 := by
          rw [Ne.def, ← Polynomial.degree_eq_bot,
            Polynomial.degree_map_eq_of_injective (NoZeroSMulDivisors.algebraMap_injective R L),
            Polynomial.degree_eq_bot]
          exact p.2.1
theorem cardinal_mk_le_sigma_polynomial :
    #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) :=
  @mk_le_of_injective L (Σ p : R[X], {x : L | x ∈ p.aroots L})
    (fun x : L =>
      let p := Classical.indefiniteDescription _ (halg x)
      ⟨p.1, x, by
        dsimp
        have h : p.1.map (algebraMap R L) ≠ 0 := by
          

Proof state:
R L : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing L
inst✝² : IsDomain L
inst✝¹ : Algebra R L
inst✝ : NoZeroSMulDivisors R L
halg : IsAlgebraic R L
x : L
p : { x_1 // x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0 } :=
  Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0) (_ : _root_.IsAlgebraic R x)
⊢ Polynomial.map (algebraMap R L) ↑p ≠ 0

Next tactic:
rw [Ne.def, ← Polynomial.degree_eq_bot,
            Polynomial.degree_map_eq_of_injective (NoZeroSMulDivisors.algebraMap_injective R L),
            Polynomial.degree_eq_bot]
theorem cardinal_mk_le_sigma_polynomial :
    #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) :=
  @mk_le_of_injective L (Σ p : R[X], {x : L | x ∈ p.aroots L})
    (fun x : L =>
      let p := Classical.indefiniteDescription _ (halg x)
      ⟨p.1, x, by
        dsimp
        have h : p.1.map (algebraMap R L) ≠ 0 := by
          rw [Ne.def, ← Polynomial.degree_eq_bot,
            Polynomial.degree_map_eq_of_injective (NoZeroSMulDivisors.algebraMap_injective R L),
            Polynomial.degree_eq_bot]
          

Proof state:
R L : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing L
inst✝² : IsDomain L
inst✝¹ : Algebra R L
inst✝ : NoZeroSMulDivisors R L
halg : IsAlgebraic R L
x : L
p : { x_1 // x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0 } :=
  Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0) (_ : _root_.IsAlgebraic R x)
⊢ ¬↑p = 0

Next tactic:
exact p.2.1
theorem cardinal_mk_le_sigma_polynomial :
    #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) :=
  @mk_le_of_injective L (Σ p : R[X], {x : L | x ∈ p.aroots L})
    (fun x : L =>
      let p := Classical.indefiniteDescription _ (halg x)
      ⟨p.1, x, by
        dsimp
        have h : p.1.map (algebraMap R L) ≠ 0 := by
          rw [Ne.def, ← Polynomial.degree_eq_bot,
            Polynomial.degree_map_eq_of_injective (NoZeroSMulDivisors.algebraMap_injective R L),
            Polynomial.degree_eq_bot]
          exact p.2.1
        

Proof state:
R L : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing L
inst✝² : IsDomain L
inst✝¹ : Algebra R L
inst✝ : NoZeroSMulDivisors R L
halg : IsAlgebraic R L
x : L
p : { x_1 // x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0 } :=
  Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0) (_ : _root_.IsAlgebraic R x)
h : Polynomial.map (algebraMap R L) ↑p ≠ 0
⊢ x ∈
    Polynomial.aroots
      (↑(Classical.indefiniteDescription (fun x_1 => ¬x_1 = 0 ∧ (Polynomial.aeval x) x_1 = 0)
          (_ : _root_.IsAlgebraic R x)))
      L

Next tactic:
erw [Polynomial.mem_roots h, Polynomial.IsRoot, Polynomial.eval_map, ← Polynomial.aeval_def,
          p.2.2]
theorem cardinal_mk_le_sigma_polynomial :
    #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) :=
  @mk_le_of_injective L (Σ p : R[X], {x : L | x ∈ p.aroots L})
    (fun x : L =>
      let p := Classical.indefiniteDescription _ (halg x)
      ⟨p.1, x, by
        dsimp
        have h : p.1.map (algebraMap R L) ≠ 0 := by
          rw [Ne.def, ← Polynomial.degree_eq_bot,
            Polynomial.degree_map_eq_of_injective (NoZeroSMulDivisors.algebraMap_injective R L),
            Polynomial.degree_eq_bot]
          exact p.2.1
        erw [Polynomial.mem_roots h, Polynomial.IsRoot, Polynomial.eval_map, ← Polynomial.aeval_def,
          p.2.2]⟩)
    fun x y => by
      

Proof state:
R L : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing L
inst✝² : IsDomain L
inst✝¹ : Algebra R L
inst✝ : NoZeroSMulDivisors R L
halg : IsAlgebraic R L
x y : L
⊢ (fun x =>
          let p :=
            Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0)
              (_ : _root_.IsAlgebraic R x);
          { fst := ↑p, snd := { val := x, property := (_ : x ∈ {x_1 | x_1 ∈ Polynomial.aroots (↑p) L}) } })
        x =
      (fun x =>
          let p :=
            Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0)
              (_ : _root_.IsAlgebraic R x);
          { fst := ↑p, snd := { val := x, property := (_ : x ∈ {x_1 | x_1 ∈ Polynomial.aroots (↑p) L}) } })
        y →
    x = y

Next tactic:
intro h
theorem cardinal_mk_le_sigma_polynomial :
    #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) :=
  @mk_le_of_injective L (Σ p : R[X], {x : L | x ∈ p.aroots L})
    (fun x : L =>
      let p := Classical.indefiniteDescription _ (halg x)
      ⟨p.1, x, by
        dsimp
        have h : p.1.map (algebraMap R L) ≠ 0 := by
          rw [Ne.def, ← Polynomial.degree_eq_bot,
            Polynomial.degree_map_eq_of_injective (NoZeroSMulDivisors.algebraMap_injective R L),
            Polynomial.degree_eq_bot]
          exact p.2.1
        erw [Polynomial.mem_roots h, Polynomial.IsRoot, Polynomial.eval_map, ← Polynomial.aeval_def,
          p.2.2]⟩)
    fun x y => by
      intro h
      

Proof state:
R L : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing L
inst✝² : IsDomain L
inst✝¹ : Algebra R L
inst✝ : NoZeroSMulDivisors R L
halg : IsAlgebraic R L
x y : L
h :
  (fun x =>
        let p :=
          Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0)
            (_ : _root_.IsAlgebraic R x);
        { fst := ↑p, snd := { val := x, property := (_ : x ∈ {x_1 | x_1 ∈ Polynomial.aroots (↑p) L}) } })
      x =
    (fun x =>
        let p :=
          Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0)
            (_ : _root_.IsAlgebraic R x);
        { fst := ↑p, snd := { val := x, property := (_ : x ∈ {x_1 | x_1 ∈ Polynomial.aroots (↑p) L}) } })
      y
⊢ x = y

Next tactic:
simp? at h says simp only [Set.coe_setOf, ne_eq, Set.mem_setOf_eq, Sigma.mk.inj_iff] at h
theorem cardinal_mk_le_sigma_polynomial :
    #L ≤ #(Σ p : R[X], { x : L // x ∈ p.aroots L }) :=
  @mk_le_of_injective L (Σ p : R[X], {x : L | x ∈ p.aroots L})
    (fun x : L =>
      let p := Classical.indefiniteDescription _ (halg x)
      ⟨p.1, x, by
        dsimp
        have h : p.1.map (algebraMap R L) ≠ 0 := by
          rw [Ne.def, ← Polynomial.degree_eq_bot,
            Polynomial.degree_map_eq_of_injective (NoZeroSMulDivisors.algebraMap_injective R L),
            Polynomial.degree_eq_bot]
          exact p.2.1
        erw [Polynomial.mem_roots h, Polynomial.IsRoot, Polynomial.eval_map, ← Polynomial.aeval_def,
          p.2.2]⟩)
    fun x y => by
      intro h
      simp? at h says 

Proof state:
R L : Type u
inst✝⁴ : CommRing R
inst✝³ : CommRing L
inst✝² : IsDomain L
inst✝¹ : Algebra R L
inst✝ : NoZeroSMulDivisors R L
halg : IsAlgebraic R L
x y : L
h :
  (fun x =>
        let p :=
          Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0)
            (_ : _root_.IsAlgebraic R x);
        { fst := ↑p, snd := { val := x, property := (_ : x ∈ {x_1 | x_1 ∈ Polynomial.aroots (↑p) L}) } })
      x =
    (fun x =>
        let p :=
          Classical.indefiniteDescription (fun x_1 => x_1 ≠ 0 ∧ (Polynomial.aeval x) x_1 = 0)
            (_ : _root_.IsAlgebraic R x);
        { fst := ↑p, snd := { val := x, property := (_ : x ∈ {x_1 | x_1 ∈ Polynomial.aroots (↑p) L}) } })
      y
⊢ x = y

Next tactic:
simp only [Set.coe_setOf, ne_eq, Set.mem_setOf_eq, Sigma.mk.inj_iff] at h