-- Mathlib/RingTheory/DedekindDomain/IntegralClosure.lean
theorem FiniteDimensional.exists_is_basis_integral :
    ∃ (s : Finset L) (b : Basis s K L), ∀ x, IsIntegral A (b x)

Proof state:
case intro.intro.refine_3
A : Type u_1
K : Type u_2
inst✝⁹ : CommRing A
inst✝⁸ : Field K
inst✝⁷ : Algebra A K
inst✝⁶ : IsFractionRing A K
L : Type u_3
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
inst✝³ : Algebra A L
inst✝² : IsScalarTower A K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsDomain A
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
      ((bs'.map
          (let __src := (lmul K L) ((algebraMap A L) y);
          { toFun := fun x => (algebraMap A L) y * x, map_add' := ⋯, map_smul' := ⋯,
            invFun := fun x => ((algebraMap A L) y)⁻¹ * x, left_inv := ⋯, right_inv := ⋯ }))
        x)

Tactic:
rintro ⟨x', hx'⟩

Result:
case intro.intro.refine_3.mk
A : Type u_1
K : Type u_2
inst✝⁹ : CommRing A
inst✝⁸ : Field K
inst✝⁷ : Algebra A K
inst✝⁶ : IsFractionRing A K
L : Type u_3
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
inst✝³ : Algebra A L
inst✝² : IsScalarTower A K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsDomain A
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' : L
hx' : x' ∈ s'
⊢ IsIntegral A
    ((bs'.map
        (let __src := (lmul K L) ((algebraMap A L) y);
        { toFun := fun x => (algebraMap A L) y * x, map_add' := ⋯, map_smul' := ⋯,
          invFun := fun x => ((algebraMap A L) y)⁻¹ * x, left_inv := ⋯, right_inv := ⋯ }))
      ⟨x', hx'⟩)

Proof state:
case intro.intro.refine_3.mk
A : Type u_1
K : Type u_2
inst✝⁹ : CommRing A
inst✝⁸ : Field K
inst✝⁷ : Algebra A K
inst✝⁶ : IsFractionRing A K
L : Type u_3
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
inst✝³ : Algebra A L
inst✝² : IsScalarTower A K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsDomain A
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' : L
hx' : x' ∈ s'
⊢ IsIntegral A
    ((bs'.map
        (let __src := (lmul K L) ((algebraMap A L) y);
        { toFun := fun x => (algebraMap A L) y * x, map_add' := ⋯, map_smul' := ⋯,
          invFun := fun x => ((algebraMap A L) y)⁻¹ * x, left_inv := ⋯, right_inv := ⋯ }))
      ⟨x', hx'⟩)

Tactic:
simp only [Algebra.smul_def, Finset.mem_image, exists_prop, Finset.mem_univ,
  true_and] at his'

Result:
case intro.intro.refine_3.mk
A : Type u_1
K : Type u_2
inst✝⁹ : CommRing A
inst✝⁸ : Field K
inst✝⁷ : Algebra A K
inst✝⁶ : IsFractionRing A K
L : Type u_3
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
inst✝³ : Algebra A L
inst✝² : IsScalarTower A K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsDomain A
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
hy' : (algebraMap A L) y ≠ 0
x' : L
hx' : x' ∈ s'
his' : ∀ (x : L), (∃ a, bs' a = x) → IsIntegral A ((algebraMap A L) y * x)
⊢ IsIntegral A
    ((bs'.map
        (let __src := (lmul K L) ((algebraMap A L) y);
        { toFun := fun x => (algebraMap A L) y * x, map_add' := ⋯, map_smul' := ⋯,
          invFun := fun x => ((algebraMap A L) y)⁻¹ * x, left_inv := ⋯, right_inv := ⋯ }))
      ⟨x', hx'⟩)

Proof state:
case intro.intro
A : Type u_1
K : Type u_2
inst✝⁹ : CommRing A
inst✝⁸ : Field K
inst✝⁷ : Algebra A K
inst✝⁶ : IsFractionRing A K
L : Type u_3
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
inst✝³ : Algebra A L
inst✝² : IsScalarTower A K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsDomain A
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)

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 := ?_}, ?_⟩

Result:
case intro.intro.refine_1
A : Type u_1
K : Type u_2
inst✝⁹ : CommRing A
inst✝⁸ : Field K
inst✝⁷ : Algebra A K
inst✝⁶ : IsFractionRing A K
L : Type u_3
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
inst✝³ : Algebra A L
inst✝² : IsScalarTower A K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsDomain A
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
⊢ Function.LeftInverse (fun x => ((algebraMap A L) y)⁻¹ * x)
    { toFun := fun x => (algebraMap A L) y * x, map_add' := ⋯, map_smul' := ⋯ }.toFun

case intro.intro.refine_2
A : Type u_1
K : Type u_2
inst✝⁹ : CommRing A
inst✝⁸ : Field K
inst✝⁷ : Algebra A K
inst✝⁶ : IsFractionRing A K
L : Type u_3
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
inst✝³ : Algebra A L
inst✝² : IsScalarTower A K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsDomain A
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
⊢ Function.RightInverse (fun x => ((algebraMap A L) y)⁻¹ * x)
    { toFun := fun x => (algebraMap A L) y * x, map_add' := ⋯, map_smul' := ⋯ }.toFun

case intro.intro.refine_3
A : Type u_1
K : Type u_2
inst✝⁹ : CommRing A
inst✝⁸ : Field K
inst✝⁷ : Algebra A K
inst✝⁶ : IsFractionRing A K
L : Type u_3
inst✝⁵ : Field L
inst✝⁴ : Algebra K L
inst✝³ : Algebra A L
inst✝² : IsScalarTower A K L
inst✝¹ : FiniteDimensional K L
inst✝ : IsDomain A
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
      ((bs'.map
          (let __src := (lmul K L) ((algebraMap A L) y);
          { toFun := fun x => (algebraMap A L) y * x, map_add' := ⋯, map_smul' := ⋯,
            invFun := fun x => ((algebraMap A L) y)⁻¹ * x, left_inv := ⋯, right_inv := ⋯ }))
        x)