l3lab/ntp-mathlib huggingface dataset:
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  

Proof state:
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
⊢ ∃ s b, ∀ (x : { x // x ∈ s }), IsIntegral A (b x)

Next tactic:
let bs' := IsNoetherian.finsetBasis K L
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  

Proof state:
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
⊢ ∃ s b, ∀ (x : { x // x ∈ s }), IsIntegral A (b x)

Next tactic:
obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  

Proof state:
case intro.intro
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
⊢ ∃ s b, ∀ (x : { x // x ∈ s }), IsIntegral A (b x)

Next tactic:
have hy' : algebraMap A L y ≠ 0 := by
    refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
    rw [IsScalarTower.algebraMap_eq A K L]
    exact (algebraMap K L).injective.comp (IsFractionRing.injective A K)
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  have hy' : algebraMap A L y ≠ 0 := by
    

Proof state:
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
⊢ (algebraMap A L) y ≠ 0

Next tactic:
refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  have hy' : algebraMap A L y ≠ 0 := by
    refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
    

Proof state:
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
⊢ Function.Injective ⇑(algebraMap A L)

Next tactic:
rw [IsScalarTower.algebraMap_eq A K L]
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  have hy' : algebraMap A L y ≠ 0 := by
    refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
    rw [IsScalarTower.algebraMap_eq A K L]
    

Proof state:
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
⊢ Function.Injective ⇑(RingHom.comp (algebraMap K L) (algebraMap A K))

Next tactic:
exact (algebraMap K L).injective.comp (IsFractionRing.injective A K)
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  have hy' : algebraMap A L y ≠ 0 := by
    refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
    rw [IsScalarTower.algebraMap_eq A K L]
    exact (algebraMap K L).injective.comp (IsFractionRing.injective A K)
  

Proof state:
case intro.intro
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
hy' : (algebraMap A L) y ≠ 0
⊢ ∃ s b, ∀ (x : { x // x ∈ s }), IsIntegral A (b x)

Next tactic:
refine ⟨s', bs'.map {Algebra.lmul _ _ (algebraMap A L y) with
    toFun := fun x => algebraMap A L y * x
    invFun := fun x => (algebraMap A L y)⁻¹ * x
    left_inv := ?_
    right_inv := ?_}, ?_⟩
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  have hy' : algebraMap A L y ≠ 0 := by
    refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
    rw [IsScalarTower.algebraMap_eq A K L]
    exact (algebraMap K L).injective.comp (IsFractionRing.injective A K)
  refine ⟨s', bs'.map {Algebra.lmul _ _ (algebraMap A L y) with
    toFun := fun x => algebraMap A L y * x
    invFun := fun x => (algebraMap A L y)⁻¹ * x
    left_inv := ?_
    right_inv := ?_}, ?_⟩
  · 

Proof state:
case intro.intro.refine_1
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
hy' : (algebraMap A L) y ≠ 0
src✝ : Module.End K L := (lmul K L) ((algebraMap A L) y)
⊢ Function.LeftInverse (fun x => ((algebraMap A L) y)⁻¹ * x)
    {
          toAddHom :=
            { toFun := fun x => (algebraMap A L) y * x,
              map_add' :=
                (_ :
                  ∀ (x y : L),
                    AddHom.toFun src✝.toAddHom (x + y) = AddHom.toFun src✝.toAddHom x + AddHom.toFun src✝.toAddHom y) },
          map_smul' :=
            (_ :
              ∀ (r : K) (x : L),
                AddHom.toFun src✝.toAddHom (r • x) = (RingHom.id K) r • AddHom.toFun src✝.toAddHom x) }.toAddHom.toFun

Next tactic:
intro x
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  have hy' : algebraMap A L y ≠ 0 := by
    refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
    rw [IsScalarTower.algebraMap_eq A K L]
    exact (algebraMap K L).injective.comp (IsFractionRing.injective A K)
  refine ⟨s', bs'.map {Algebra.lmul _ _ (algebraMap A L y) with
    toFun := fun x => algebraMap A L y * x
    invFun := fun x => (algebraMap A L y)⁻¹ * x
    left_inv := ?_
    right_inv := ?_}, ?_⟩
  · intro x; 

Proof state:
case intro.intro.refine_1
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
hy' : (algebraMap A L) y ≠ 0
src✝ : Module.End K L := (lmul K L) ((algebraMap A L) y)
x : L
⊢ (fun x => ((algebraMap A L) y)⁻¹ * x)
      (AddHom.toFun
        {
            toAddHom :=
              { toFun := fun x => (algebraMap A L) y * x,
                map_add' :=
                  (_ :
                    ∀ (x y : L),
                      AddHom.toFun src✝.toAddHom (x + y) =
                        AddHom.toFun src✝.toAddHom x + AddHom.toFun src✝.toAddHom y) },
            map_smul' :=
              (_ :
                ∀ (r : K) (x : L),
                  AddHom.toFun src✝.toAddHom (r • x) = (RingHom.id K) r • AddHom.toFun src✝.toAddHom x) }.toAddHom
        x) =
    x

Next tactic:
simp only [inv_mul_cancel_left₀ hy']
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  have hy' : algebraMap A L y ≠ 0 := by
    refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
    rw [IsScalarTower.algebraMap_eq A K L]
    exact (algebraMap K L).injective.comp (IsFractionRing.injective A K)
  refine ⟨s', bs'.map {Algebra.lmul _ _ (algebraMap A L y) with
    toFun := fun x => algebraMap A L y * x
    invFun := fun x => (algebraMap A L y)⁻¹ * x
    left_inv := ?_
    right_inv := ?_}, ?_⟩
  · intro x; simp only [inv_mul_cancel_left₀ hy']
  · 

Proof state:
case intro.intro.refine_2
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
hy' : (algebraMap A L) y ≠ 0
src✝ : Module.End K L := (lmul K L) ((algebraMap A L) y)
⊢ Function.RightInverse (fun x => ((algebraMap A L) y)⁻¹ * x)
    {
          toAddHom :=
            { toFun := fun x => (algebraMap A L) y * x,
              map_add' :=
                (_ :
                  ∀ (x y : L),
                    AddHom.toFun src✝.toAddHom (x + y) = AddHom.toFun src✝.toAddHom x + AddHom.toFun src✝.toAddHom y) },
          map_smul' :=
            (_ :
              ∀ (r : K) (x : L),
                AddHom.toFun src✝.toAddHom (r • x) = (RingHom.id K) r • AddHom.toFun src✝.toAddHom x) }.toAddHom.toFun

Next tactic:
intro x
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  have hy' : algebraMap A L y ≠ 0 := by
    refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
    rw [IsScalarTower.algebraMap_eq A K L]
    exact (algebraMap K L).injective.comp (IsFractionRing.injective A K)
  refine ⟨s', bs'.map {Algebra.lmul _ _ (algebraMap A L y) with
    toFun := fun x => algebraMap A L y * x
    invFun := fun x => (algebraMap A L y)⁻¹ * x
    left_inv := ?_
    right_inv := ?_}, ?_⟩
  · intro x; simp only [inv_mul_cancel_left₀ hy']
  · intro x; 

Proof state:
case intro.intro.refine_2
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
hy' : (algebraMap A L) y ≠ 0
src✝ : Module.End K L := (lmul K L) ((algebraMap A L) y)
x : L
⊢ AddHom.toFun
      {
          toAddHom :=
            { toFun := fun x => (algebraMap A L) y * x,
              map_add' :=
                (_ :
                  ∀ (x y : L),
                    AddHom.toFun src✝.toAddHom (x + y) = AddHom.toFun src✝.toAddHom x + AddHom.toFun src✝.toAddHom y) },
          map_smul' :=
            (_ :
              ∀ (r : K) (x : L),
                AddHom.toFun src✝.toAddHom (r • x) = (RingHom.id K) r • AddHom.toFun src✝.toAddHom x) }.toAddHom
      ((fun x => ((algebraMap A L) y)⁻¹ * x) x) =
    x

Next tactic:
simp only [mul_inv_cancel_left₀ hy']
/-- If `L` is a finite extension of `K = Frac(A)`,
then `L` has a basis over `A` consisting of integral elements. -/
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x) := by
  letI := Classical.decEq L
  letI : IsNoetherian K L := IsNoetherian.iff_fg.2 inferInstance
  let s' := IsNoetherian.finsetBasisIndex K L
  let bs' := IsNoetherian.finsetBasis K L
  obtain ⟨y, hy, his'⟩ := exists_integral_multiples A K (Finset.univ.image bs')
  have hy' : algebraMap A L y ≠ 0 := by
    refine' mt ((injective_iff_map_eq_zero (algebraMap A L)).mp _ _) hy
    rw [IsScalarTower.algebraMap_eq A K L]
    exact (algebraMap K L).injective.comp (IsFractionRing.injective A K)
  refine ⟨s', bs'.map {Algebra.lmul _ _ (algebraMap A L y) with
    toFun := fun x => algebraMap A L y * x
    invFun := fun x => (algebraMap A L y)⁻¹ * x
    left_inv := ?_
    right_inv := ?_}, ?_⟩
  · intro x; simp only [inv_mul_cancel_left₀ hy']
  · intro x; simp only [mul_inv_cancel_left₀ hy']
  · 

Proof state:
case intro.intro.refine_3
R : Type u_1
A : Type u_2
K : Type u_3
inst✝¹⁵ : CommRing R
inst✝¹⁴ : CommRing A
inst✝¹³ : Field K
inst✝¹² : IsDomain A
inst✝¹¹ : Algebra A K
inst✝¹⁰ : IsFractionRing A K
L : Type u_4
inst✝⁹ : Field L
C : Type u_5
inst✝⁸ : CommRing C
inst✝⁷ : Algebra K L
inst✝⁶ : Algebra A L
inst✝⁵ : IsScalarTower A K L
inst✝⁴ : Algebra C L
inst✝³ : IsIntegralClosure C A L
inst✝² : Algebra A C
inst✝¹ : IsScalarTower A C L
inst✝ : FiniteDimensional K L
this✝ : DecidableEq L := Classical.decEq L
this : IsNoetherian K L := IsNoetherian.iff_fg.mpr inferInstance
s' : Finset L := IsNoetherian.finsetBasisIndex K L
bs' : Basis { x // x ∈ IsNoetherian.finsetBasisIndex K L } K L := IsNoetherian.finsetBasis K L
y : A
hy : y ≠ 0
his' : ∀ x ∈ Finset.image (⇑bs') Finset.univ, IsIntegral A (y • x)
hy' : (algebraMap A L) y ≠ 0
⊢ ∀ (x : { x // x ∈ s' }),
    IsIntegral A
      ((Basis.map bs'
          (let src := (lmul K L) ((algebraMap A L) y);
          {
            toLinearMap :=
              {
                toAddHom :=
                  { toFun := fun x => (algebraMap A L) y * x,
                    map_add' :=
                      (_ :
                        ∀ (x y : L),
                          AddHom.toFun src.toAddHom (x + y) =
                            AddHom.toFun src.toAddHom x + AddHom.toFun src.toAddHom y) },
                map_smul' :=
                  (_ :
                    ∀ (r : K) (x : L),
                      AddHom.toFun src.toAddHom (r • x) = (RingHom.id K) r • AddHom.toFun src.toAddHom x) },
            invFun := fun x => ((algebraMap A L) y)⁻¹ * x,
            left_inv := (_ : ∀ (x : L), ((algebraMap A L) y)⁻¹ * ((algebraMap A L) y * x) = x),
            right_inv := (_ : ∀ (x : L), (algebraMap A L) y * (((algebraMap A L) y)⁻¹ * x) = x) }))
        x)

Next tactic:
rintro ⟨x', hx'⟩