l3lab/ntp-mathlib huggingface dataset:
set_option synthInstance.maxHeartbeats 40000 in
theorem AlgebraicIndependent.aeval_comp_mvPolynomialOptionEquivPolynomialAdjoin
    (hx : AlgebraicIndependent R x) (a : A) :
    RingHom.comp
        (↑(Polynomial.aeval a : Polynomial (adjoin R (Set.range x)) →ₐ[_] A) :
          Polynomial (adjoin R (Set.range x)) →+* A)
        hx.mvPolynomialOptionEquivPolynomialAdjoin.toRingHom =
      ↑(MvPolynomial.aeval fun o : Option ι => o.elim a x : MvPolynomial (Option ι) R →ₐ[R] A) := by
  refine' MvPolynomial.ringHom_ext _ _ <;>
    simp only [RingHom.comp_apply, RingEquiv.toRingHom_eq_coe, RingEquiv.coe_toRingHom,
      AlgHom.coe_toRingHom, AlgHom.coe_toRingHom]
  · intro r
    rw [hx.mvPolynomialOptionEquivPolynomialAdjoin_C, aeval_C, Polynomial.aeval_C,
      IsScalarTower.algebraMap_apply R (adjoin R (range x)) A]
  · rintro (⟨⟩ | ⟨i⟩)
    · rw [hx.mvPolynomialOptionEquivPolynomialAdjoin_X_none, aeval_X, Polynomial.aeval_X,
        Option.elim]
    · 

Proof state:
case refine'_2.some
ι : Type u_1
ι' : Type u_2
R : Type u_3
K : Type u_4
A : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι → A
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : CommRing A'
inst✝³ : CommRing A''
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R A''
a✝ b : R
hx : AlgebraicIndependent R x
a : A
i : ι
⊢ (Polynomial.aeval a) ((mvPolynomialOptionEquivPolynomialAdjoin hx) (X (some i))) =
    (aeval fun o => Option.elim o a x) (X (some i))

Next tactic:
rw [hx.mvPolynomialOptionEquivPolynomialAdjoin_X_some, Polynomial.aeval_C,
        hx.algebraMap_aevalEquiv, aeval_X, aeval_X, Option.elim]
theorem AlgebraicIndependent.option_iff (hx : AlgebraicIndependent R x) (a : A) :
    (AlgebraicIndependent R fun o : Option ι => o.elim a x) ↔
      ¬IsAlgebraic (adjoin R (Set.range x)) a := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
K : Type u_4
A : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι → A
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : CommRing A'
inst✝³ : CommRing A''
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R A''
a✝ b : R
hx : AlgebraicIndependent R x
a : A
⊢ (AlgebraicIndependent R fun o => Option.elim o a x) ↔ ¬_root_.IsAlgebraic (↥(adjoin R (range x))) a

Next tactic:
rw [algebraicIndependent_iff_injective_aeval, isAlgebraic_iff_not_injective, Classical.not_not, ←
    AlgHom.coe_toRingHom, ← hx.aeval_comp_mvPolynomialOptionEquivPolynomialAdjoin,
    RingHom.coe_comp]
theorem AlgebraicIndependent.option_iff (hx : AlgebraicIndependent R x) (a : A) :
    (AlgebraicIndependent R fun o : Option ι => o.elim a x) ↔
      ¬IsAlgebraic (adjoin R (Set.range x)) a := by
  rw [algebraicIndependent_iff_injective_aeval, isAlgebraic_iff_not_injective, Classical.not_not, ←
    AlgHom.coe_toRingHom, ← hx.aeval_comp_mvPolynomialOptionEquivPolynomialAdjoin,
    RingHom.coe_comp]
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
K : Type u_4
A : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι → A
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : CommRing A'
inst✝³ : CommRing A''
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R A''
a✝ b : R
hx : AlgebraicIndependent R x
a : A
⊢ Injective (⇑↑(Polynomial.aeval a) ∘ ⇑(RingEquiv.toRingHom (mvPolynomialOptionEquivPolynomialAdjoin hx))) ↔
    Injective ⇑(Polynomial.aeval a)

Next tactic:
exact Injective.of_comp_iff' (Polynomial.aeval a)
    (mvPolynomialOptionEquivPolynomialAdjoin hx).bijective
theorem exists_isTranscendenceBasis (h : Injective (algebraMap R A)) :
    ∃ s : Set A, IsTranscendenceBasis R ((↑) : s → A) := by
  

Proof state:
ι : Type u_1
ι' : Type u_2
R : Type u_3
K : Type u_4
A : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι → A
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : CommRing A'
inst✝³ : CommRing A''
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R A''
a b : R
h : Injective ⇑(algebraMap R A)
⊢ ∃ s, IsTranscendenceBasis R Subtype.val

Next tactic:
cases' exists_maximal_algebraicIndependent (∅ : Set A) Set.univ (Set.subset_univ _)
      ((algebraicIndependent_empty_iff R A).2 h) with
    s hs
theorem exists_isTranscendenceBasis (h : Injective (algebraMap R A)) :
    ∃ s : Set A, IsTranscendenceBasis R ((↑) : s → A) := by
  cases' exists_maximal_algebraicIndependent (∅ : Set A) Set.univ (Set.subset_univ _)
      ((algebraicIndependent_empty_iff R A).2 h) with
    s hs
  

Proof state:
case intro
ι : Type u_1
ι' : Type u_2
R : Type u_3
K : Type u_4
A : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι → A
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : CommRing A'
inst✝³ : CommRing A''
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R A''
a b : R
h : Injective ⇑(algebraMap R A)
s : Set A
hs :
  AlgebraicIndependent R Subtype.val ∧
    ∅ ⊆ s ∧ s ⊆ univ ∧ ∀ (x : Set A), AlgebraicIndependent R Subtype.val → s ⊆ x → x ⊆ univ → x = s
⊢ ∃ s, IsTranscendenceBasis R Subtype.val

Next tactic:
use s, hs.1
theorem exists_isTranscendenceBasis (h : Injective (algebraMap R A)) :
    ∃ s : Set A, IsTranscendenceBasis R ((↑) : s → A) := by
  cases' exists_maximal_algebraicIndependent (∅ : Set A) Set.univ (Set.subset_univ _)
      ((algebraicIndependent_empty_iff R A).2 h) with
    s hs
  use s, hs.1
  

Proof state:
case right
ι : Type u_1
ι' : Type u_2
R : Type u_3
K : Type u_4
A : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι → A
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : CommRing A'
inst✝³ : CommRing A''
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R A''
a b : R
h : Injective ⇑(algebraMap R A)
s : Set A
hs :
  AlgebraicIndependent R Subtype.val ∧
    ∅ ⊆ s ∧ s ⊆ univ ∧ ∀ (x : Set A), AlgebraicIndependent R Subtype.val → s ⊆ x → x ⊆ univ → x = s
⊢ ∀ (s_1 : Set A), AlgebraicIndependent R Subtype.val → range Subtype.val ≤ s_1 → range Subtype.val = s_1

Next tactic:
intro t ht hr
theorem exists_isTranscendenceBasis (h : Injective (algebraMap R A)) :
    ∃ s : Set A, IsTranscendenceBasis R ((↑) : s → A) := by
  cases' exists_maximal_algebraicIndependent (∅ : Set A) Set.univ (Set.subset_univ _)
      ((algebraicIndependent_empty_iff R A).2 h) with
    s hs
  use s, hs.1
  intro t ht hr
  

Proof state:
case right
ι : Type u_1
ι' : Type u_2
R : Type u_3
K : Type u_4
A : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι → A
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : CommRing A'
inst✝³ : CommRing A''
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R A''
a b : R
h : Injective ⇑(algebraMap R A)
s : Set A
hs :
  AlgebraicIndependent R Subtype.val ∧
    ∅ ⊆ s ∧ s ⊆ univ ∧ ∀ (x : Set A), AlgebraicIndependent R Subtype.val → s ⊆ x → x ⊆ univ → x = s
t : Set A
ht : AlgebraicIndependent R Subtype.val
hr : range Subtype.val ≤ t
⊢ range Subtype.val = t

Next tactic:
simp only [Subtype.range_coe_subtype, setOf_mem_eq] at *
theorem exists_isTranscendenceBasis (h : Injective (algebraMap R A)) :
    ∃ s : Set A, IsTranscendenceBasis R ((↑) : s → A) := by
  cases' exists_maximal_algebraicIndependent (∅ : Set A) Set.univ (Set.subset_univ _)
      ((algebraicIndependent_empty_iff R A).2 h) with
    s hs
  use s, hs.1
  intro t ht hr
  simp only [Subtype.range_coe_subtype, setOf_mem_eq] at *
  

Proof state:
case right
ι : Type u_1
ι' : Type u_2
R : Type u_3
K : Type u_4
A : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι → A
inst✝⁶ : CommRing R
inst✝⁵ : CommRing A
inst✝⁴ : CommRing A'
inst✝³ : CommRing A''
inst✝² : Algebra R A
inst✝¹ : Algebra R A'
inst✝ : Algebra R A''
a b : R
h : Injective ⇑(algebraMap R A)
s : Set A
hs :
  AlgebraicIndependent R Subtype.val ∧
    ∅ ⊆ s ∧ s ⊆ univ ∧ ∀ (x : Set A), AlgebraicIndependent R Subtype.val → s ⊆ x → x ⊆ univ → x = s
t : Set A
ht : AlgebraicIndependent R Subtype.val
hr : s ≤ t
⊢ s = t

Next tactic:
exact Eq.symm (hs.2.2.2 t ht hr (Set.subset_univ _))
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  

Proof state:
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
⊢ IsTranscendenceBasis R x ↔
    ∀ (κ : Type v) (w : κ → A), AlgebraicIndependent R w → ∀ (j : ι → κ), w ∘ j = x → Surjective j

Next tactic:
fconstructor
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · 

Proof state:
case mp
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
⊢ IsTranscendenceBasis R x →
    ∀ (κ : Type v) (w : κ → A), AlgebraicIndependent R w → ∀ (j : ι → κ), w ∘ j = x → Surjective j

Next tactic:
rintro p κ w i' j rfl
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    

Proof state:
case mp
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
κ : Type v
w : κ → A
i' : AlgebraicIndependent R w
j : ι → κ
i : AlgebraicIndependent R (w ∘ j)
p : IsTranscendenceBasis R (w ∘ j)
⊢ Surjective j

Next tactic:
have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    

Proof state:
case mp
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
κ : Type v
w : κ → A
i' : AlgebraicIndependent R w
j : ι → κ
i : AlgebraicIndependent R (w ∘ j)
p✝ : IsTranscendenceBasis R (w ∘ j)
p : range (w ∘ j) = range w
⊢ Surjective j

Next tactic:
rw [range_comp, ← @image_univ _ _ w] at p
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    rw [range_comp, ← @image_univ _ _ w] at p
    

Proof state:
case mp
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
κ : Type v
w : κ → A
i' : AlgebraicIndependent R w
j : ι → κ
i : AlgebraicIndependent R (w ∘ j)
p✝ : IsTranscendenceBasis R (w ∘ j)
p : w '' range j = w '' univ
⊢ Surjective j

Next tactic:
exact range_iff_surjective.mp (image_injective.mpr i'.injective p)
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    rw [range_comp, ← @image_univ _ _ w] at p
    exact range_iff_surjective.mp (image_injective.mpr i'.injective p)
  · 

Proof state:
case mpr
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
⊢ (∀ (κ : Type v) (w : κ → A), AlgebraicIndependent R w → ∀ (j : ι → κ), w ∘ j = x → Surjective j) →
    IsTranscendenceBasis R x

Next tactic:
intro p
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    rw [range_comp, ← @image_univ _ _ w] at p
    exact range_iff_surjective.mp (image_injective.mpr i'.injective p)
  · intro p
    

Proof state:
case mpr
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
p : ∀ (κ : Type v) (w : κ → A), AlgebraicIndependent R w → ∀ (j : ι → κ), w ∘ j = x → Surjective j
⊢ IsTranscendenceBasis R x

Next tactic:
use i
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    rw [range_comp, ← @image_univ _ _ w] at p
    exact range_iff_surjective.mp (image_injective.mpr i'.injective p)
  · intro p
    use i
    

Proof state:
case right
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
p : ∀ (κ : Type v) (w : κ → A), AlgebraicIndependent R w → ∀ (j : ι → κ), w ∘ j = x → Surjective j
⊢ ∀ (s : Set A), AlgebraicIndependent R Subtype.val → range x ≤ s → range x = s

Next tactic:
intro w i' h
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    rw [range_comp, ← @image_univ _ _ w] at p
    exact range_iff_surjective.mp (image_injective.mpr i'.injective p)
  · intro p
    use i
    intro w i' h
    

Proof state:
case right
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
p : ∀ (κ : Type v) (w : κ → A), AlgebraicIndependent R w → ∀ (j : ι → κ), w ∘ j = x → Surjective j
w : Set A
i' : AlgebraicIndependent R Subtype.val
h : range x ≤ w
⊢ range x = w

Next tactic:
specialize p w ((↑) : w → A) i' (fun i => ⟨x i, range_subset_iff.mp h i⟩) (by ext; simp)
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    rw [range_comp, ← @image_univ _ _ w] at p
    exact range_iff_surjective.mp (image_injective.mpr i'.injective p)
  · intro p
    use i
    intro w i' h
    specialize p w ((↑) : w → A) i' (fun i => ⟨x i, range_subset_iff.mp h i⟩) (by 

Proof state:
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
p : ∀ (κ : Type v) (w : κ → A), AlgebraicIndependent R w → ∀ (j : ι → κ), w ∘ j = x → Surjective j
w : Set A
i' : AlgebraicIndependent R Subtype.val
h : range x ≤ w
⊢ (Subtype.val ∘ fun i => { val := x i, property := (_ : x i ∈ w) }) = x

Next tactic:
ext
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    rw [range_comp, ← @image_univ _ _ w] at p
    exact range_iff_surjective.mp (image_injective.mpr i'.injective p)
  · intro p
    use i
    intro w i' h
    specialize p w ((↑) : w → A) i' (fun i => ⟨x i, range_subset_iff.mp h i⟩) (by ext; 

Proof state:
case h
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝¹ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
p : ∀ (κ : Type v) (w : κ → A), AlgebraicIndependent R w → ∀ (j : ι → κ), w ∘ j = x → Surjective j
w : Set A
i' : AlgebraicIndependent R Subtype.val
h : range x ≤ w
x✝ : ι
⊢ (Subtype.val ∘ fun i => { val := x i, property := (_ : x i ∈ w) }) x✝ = x x✝

Next tactic:
simp
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    rw [range_comp, ← @image_univ _ _ w] at p
    exact range_iff_surjective.mp (image_injective.mpr i'.injective p)
  · intro p
    use i
    intro w i' h
    specialize p w ((↑) : w → A) i' (fun i => ⟨x i, range_subset_iff.mp h i⟩) (by ext; simp)
    

Proof state:
case right
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
w : Set A
i' : AlgebraicIndependent R Subtype.val
h : range x ≤ w
p : Surjective fun i => { val := x i, property := (_ : x i ∈ w) }
⊢ range x = w

Next tactic:
have q := congr_arg (fun s => ((↑) : w → A) '' s) p.range_eq
theorem AlgebraicIndependent.isTranscendenceBasis_iff {ι : Type w} {R : Type u} [CommRing R]
    [Nontrivial R] {A : Type v} [CommRing A] [Algebra R A] {x : ι → A}
    (i : AlgebraicIndependent R x) :
    IsTranscendenceBasis R x ↔
      ∀ (κ : Type v) (w : κ → A) (_ : AlgebraicIndependent R w) (j : ι → κ) (_ : w ∘ j = x),
        Surjective j := by
  fconstructor
  · rintro p κ w i' j rfl
    have p := p.2 (range w) i'.coe_range (range_comp_subset_range _ _)
    rw [range_comp, ← @image_univ _ _ w] at p
    exact range_iff_surjective.mp (image_injective.mpr i'.injective p)
  · intro p
    use i
    intro w i' h
    specialize p w ((↑) : w → A) i' (fun i => ⟨x i, range_subset_iff.mp h i⟩) (by ext; simp)
    have q := congr_arg (fun s => ((↑) : w → A) '' s) p.range_eq
    

Proof state:
case right
ι✝ : Type u_1
ι' : Type u_2
R✝ : Type u_3
K : Type u_4
A✝ : Type u_5
A' : Type u_6
A'' : Type u_7
V : Type u
V' : Type u_8
x✝ : ι✝ → A✝
inst✝¹⁰ : CommRing R✝
inst✝⁹ : CommRing A✝
inst✝⁸ : CommRing A'
inst✝⁷ : CommRing A''
inst✝⁶ : Algebra R✝ A✝
inst✝⁵ : Algebra R✝ A'
inst✝⁴ : Algebra R✝ A''
a b : R✝
ι : Type w
R : Type u
inst✝³ : CommRing R
inst✝² : Nontrivial R
A : Type v
inst✝¹ : CommRing A
inst✝ : Algebra R A
x : ι → A
i : AlgebraicIndependent R x
w : Set A
i' : AlgebraicIndependent R Subtype.val
h : range x ≤ w
p : Surjective fun i => { val := x i, property := (_ : x i ∈ w) }
q :
  (fun s => Subtype.val '' s) (range fun i => { val := x i, property := (_ : x i ∈ w) }) =
    (fun s => Subtype.val '' s) univ
⊢ range x = w

Next tactic:
dsimp at q