l3lab/ntp-mathlib huggingface dataset:
/-- Let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite
separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`.
Then for all, `z : L` that are integral over `R`, we have
`(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. -/
theorem discr_mul_isIntegral_mem_adjoin [IsSeparable K L] [IsIntegrallyClosed R]
    [IsFractionRing R K] {B : PowerBasis K L} (hint : IsIntegral R B.gen) {z : L}
    (hz : IsIntegral R z) : discr K B.basis • z ∈ adjoin R ({B.gen} : Set L) := by
  have hinv : IsUnit (traceMatrix K B.basis).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ B.basis
  have H :
    (traceMatrix K B.basis).det • (traceMatrix K B.basis).mulVec (B.basis.equivFun z) =
      (traceMatrix K B.basis).det • fun i => trace K L (z * B.basis i) :=
    by congr; 

Proof state:
case e_a
A : Type u
B✝ : Type v
C : Type z
ι : Type w
inst✝²² : DecidableEq ι
inst✝²¹ : CommRing A
inst✝²⁰ : CommRing B✝
inst✝¹⁹ : Algebra A B✝
inst✝¹⁸ : CommRing C
inst✝¹⁷ : Algebra A C
ι' : Type u_1
inst✝¹⁶ : Fintype ι'
inst✝¹⁵ : Fintype ι
inst✝¹⁴ : DecidableEq ι'
K : Type u
L : Type v
E : Type z
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra K L
inst✝⁹ : Algebra K E
inst✝⁸ : Module.Finite K L
inst✝⁷ : IsAlgClosed E
b : ι → L
pb : PowerBasis K L
R : Type z
inst✝⁶ : CommRing R
inst✝⁵ : Algebra R K
inst✝⁴ : Algebra R L
inst✝³ : IsScalarTower R K L
inst✝² : IsSeparable K L
inst✝¹ : IsIntegrallyClosed R
inst✝ : IsFractionRing R K
B : PowerBasis K L
hint : IsIntegral R B.gen
z : L
hz : IsIntegral R z
hinv : IsUnit (det (traceMatrix K ⇑B.basis))
⊢ mulVec (traceMatrix K ⇑B.basis) ((Basis.equivFun B.basis) z) = fun i => (trace K L) (z * B.basis i)

Next tactic:
exact traceMatrix_of_basis_mulVec _ _
/-- Let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite
separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`.
Then for all, `z : L` that are integral over `R`, we have
`(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. -/
theorem discr_mul_isIntegral_mem_adjoin [IsSeparable K L] [IsIntegrallyClosed R]
    [IsFractionRing R K] {B : PowerBasis K L} (hint : IsIntegral R B.gen) {z : L}
    (hz : IsIntegral R z) : discr K B.basis • z ∈ adjoin R ({B.gen} : Set L) := by
  have hinv : IsUnit (traceMatrix K B.basis).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ B.basis
  have H :
    (traceMatrix K B.basis).det • (traceMatrix K B.basis).mulVec (B.basis.equivFun z) =
      (traceMatrix K B.basis).det • fun i => trace K L (z * B.basis i) :=
    by congr; exact traceMatrix_of_basis_mulVec _ _
  

Proof state:
A : Type u
B✝ : Type v
C : Type z
ι : Type w
inst✝²² : DecidableEq ι
inst✝²¹ : CommRing A
inst✝²⁰ : CommRing B✝
inst✝¹⁹ : Algebra A B✝
inst✝¹⁸ : CommRing C
inst✝¹⁷ : Algebra A C
ι' : Type u_1
inst✝¹⁶ : Fintype ι'
inst✝¹⁵ : Fintype ι
inst✝¹⁴ : DecidableEq ι'
K : Type u
L : Type v
E : Type z
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra K L
inst✝⁹ : Algebra K E
inst✝⁸ : Module.Finite K L
inst✝⁷ : IsAlgClosed E
b : ι → L
pb : PowerBasis K L
R : Type z
inst✝⁶ : CommRing R
inst✝⁵ : Algebra R K
inst✝⁴ : Algebra R L
inst✝³ : IsScalarTower R K L
inst✝² : IsSeparable K L
inst✝¹ : IsIntegrallyClosed R
inst✝ : IsFractionRing R K
B : PowerBasis K L
hint : IsIntegral R B.gen
z : L
hz : IsIntegral R z
hinv : IsUnit (det (traceMatrix K ⇑B.basis))
H :
  det (traceMatrix K ⇑B.basis) • mulVec (traceMatrix K ⇑B.basis) ((Basis.equivFun B.basis) z) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
⊢ discr K ⇑B.basis • z ∈ adjoin R {B.gen}

Next tactic:
have cramer := mulVec_cramer (traceMatrix K B.basis) fun i => trace K L (z * B.basis i)
/-- Let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite
separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`.
Then for all, `z : L` that are integral over `R`, we have
`(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. -/
theorem discr_mul_isIntegral_mem_adjoin [IsSeparable K L] [IsIntegrallyClosed R]
    [IsFractionRing R K] {B : PowerBasis K L} (hint : IsIntegral R B.gen) {z : L}
    (hz : IsIntegral R z) : discr K B.basis • z ∈ adjoin R ({B.gen} : Set L) := by
  have hinv : IsUnit (traceMatrix K B.basis).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ B.basis
  have H :
    (traceMatrix K B.basis).det • (traceMatrix K B.basis).mulVec (B.basis.equivFun z) =
      (traceMatrix K B.basis).det • fun i => trace K L (z * B.basis i) :=
    by congr; exact traceMatrix_of_basis_mulVec _ _
  have cramer := mulVec_cramer (traceMatrix K B.basis) fun i => trace K L (z * B.basis i)
  

Proof state:
A : Type u
B✝ : Type v
C : Type z
ι : Type w
inst✝²² : DecidableEq ι
inst✝²¹ : CommRing A
inst✝²⁰ : CommRing B✝
inst✝¹⁹ : Algebra A B✝
inst✝¹⁸ : CommRing C
inst✝¹⁷ : Algebra A C
ι' : Type u_1
inst✝¹⁶ : Fintype ι'
inst✝¹⁵ : Fintype ι
inst✝¹⁴ : DecidableEq ι'
K : Type u
L : Type v
E : Type z
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra K L
inst✝⁹ : Algebra K E
inst✝⁸ : Module.Finite K L
inst✝⁷ : IsAlgClosed E
b : ι → L
pb : PowerBasis K L
R : Type z
inst✝⁶ : CommRing R
inst✝⁵ : Algebra R K
inst✝⁴ : Algebra R L
inst✝³ : IsScalarTower R K L
inst✝² : IsSeparable K L
inst✝¹ : IsIntegrallyClosed R
inst✝ : IsFractionRing R K
B : PowerBasis K L
hint : IsIntegral R B.gen
z : L
hz : IsIntegral R z
hinv : IsUnit (det (traceMatrix K ⇑B.basis))
H :
  det (traceMatrix K ⇑B.basis) • mulVec (traceMatrix K ⇑B.basis) ((Basis.equivFun B.basis) z) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
cramer :
  mulVec (traceMatrix K ⇑B.basis) ((Matrix.cramer (traceMatrix K ⇑B.basis)) fun i => (trace K L) (z * B.basis i)) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
⊢ discr K ⇑B.basis • z ∈ adjoin R {B.gen}

Next tactic:
suffices ∀ i, ((traceMatrix K B.basis).det • B.basis.equivFun z) i ∈ (⊥ : Subalgebra R K) by
    rw [← B.basis.sum_repr z, Finset.smul_sum]
    refine' Subalgebra.sum_mem _ fun i _ => _
    replace this := this i
    rw [← discr_def, Pi.smul_apply, mem_bot] at this
    obtain ⟨r, hr⟩ := this
    rw [Basis.equivFun_apply] at hr
    rw [← smul_assoc, ← hr, algebraMap_smul]
    refine' Subalgebra.smul_mem _ _ _
    rw [B.basis_eq_pow i]
    refine' Subalgebra.pow_mem _ (subset_adjoin (Set.mem_singleton _)) _
/-- Let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite
separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`.
Then for all, `z : L` that are integral over `R`, we have
`(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. -/
theorem discr_mul_isIntegral_mem_adjoin [IsSeparable K L] [IsIntegrallyClosed R]
    [IsFractionRing R K] {B : PowerBasis K L} (hint : IsIntegral R B.gen) {z : L}
    (hz : IsIntegral R z) : discr K B.basis • z ∈ adjoin R ({B.gen} : Set L) := by
  have hinv : IsUnit (traceMatrix K B.basis).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ B.basis
  have H :
    (traceMatrix K B.basis).det • (traceMatrix K B.basis).mulVec (B.basis.equivFun z) =
      (traceMatrix K B.basis).det • fun i => trace K L (z * B.basis i) :=
    by congr; exact traceMatrix_of_basis_mulVec _ _
  have cramer := mulVec_cramer (traceMatrix K B.basis) fun i => trace K L (z * B.basis i)
  suffices ∀ i, ((traceMatrix K B.basis).det • B.basis.equivFun z) i ∈ (⊥ : Subalgebra R K) by
    

Proof state:
A : Type u
B✝ : Type v
C : Type z
ι : Type w
inst✝²² : DecidableEq ι
inst✝²¹ : CommRing A
inst✝²⁰ : CommRing B✝
inst✝¹⁹ : Algebra A B✝
inst✝¹⁸ : CommRing C
inst✝¹⁷ : Algebra A C
ι' : Type u_1
inst✝¹⁶ : Fintype ι'
inst✝¹⁵ : Fintype ι
inst✝¹⁴ : DecidableEq ι'
K : Type u
L : Type v
E : Type z
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra K L
inst✝⁹ : Algebra K E
inst✝⁸ : Module.Finite K L
inst✝⁷ : IsAlgClosed E
b : ι → L
pb : PowerBasis K L
R : Type z
inst✝⁶ : CommRing R
inst✝⁵ : Algebra R K
inst✝⁴ : Algebra R L
inst✝³ : IsScalarTower R K L
inst✝² : IsSeparable K L
inst✝¹ : IsIntegrallyClosed R
inst✝ : IsFractionRing R K
B : PowerBasis K L
hint : IsIntegral R B.gen
z : L
hz : IsIntegral R z
hinv : IsUnit (det (traceMatrix K ⇑B.basis))
H :
  det (traceMatrix K ⇑B.basis) • mulVec (traceMatrix K ⇑B.basis) ((Basis.equivFun B.basis) z) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
cramer :
  mulVec (traceMatrix K ⇑B.basis) ((Matrix.cramer (traceMatrix K ⇑B.basis)) fun i => (trace K L) (z * B.basis i)) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
this : ∀ (i : Fin B.dim), (det (traceMatrix K ⇑B.basis) • (Basis.equivFun B.basis) z) i ∈ ⊥
⊢ discr K ⇑B.basis • z ∈ adjoin R {B.gen}

Next tactic:
rw [← B.basis.sum_repr z, Finset.smul_sum]
/-- Let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite
separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`.
Then for all, `z : L` that are integral over `R`, we have
`(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. -/
theorem discr_mul_isIntegral_mem_adjoin [IsSeparable K L] [IsIntegrallyClosed R]
    [IsFractionRing R K] {B : PowerBasis K L} (hint : IsIntegral R B.gen) {z : L}
    (hz : IsIntegral R z) : discr K B.basis • z ∈ adjoin R ({B.gen} : Set L) := by
  have hinv : IsUnit (traceMatrix K B.basis).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ B.basis
  have H :
    (traceMatrix K B.basis).det • (traceMatrix K B.basis).mulVec (B.basis.equivFun z) =
      (traceMatrix K B.basis).det • fun i => trace K L (z * B.basis i) :=
    by congr; exact traceMatrix_of_basis_mulVec _ _
  have cramer := mulVec_cramer (traceMatrix K B.basis) fun i => trace K L (z * B.basis i)
  suffices ∀ i, ((traceMatrix K B.basis).det • B.basis.equivFun z) i ∈ (⊥ : Subalgebra R K) by
    rw [← B.basis.sum_repr z, Finset.smul_sum]
    

Proof state:
A : Type u
B✝ : Type v
C : Type z
ι : Type w
inst✝²² : DecidableEq ι
inst✝²¹ : CommRing A
inst✝²⁰ : CommRing B✝
inst✝¹⁹ : Algebra A B✝
inst✝¹⁸ : CommRing C
inst✝¹⁷ : Algebra A C
ι' : Type u_1
inst✝¹⁶ : Fintype ι'
inst✝¹⁵ : Fintype ι
inst✝¹⁴ : DecidableEq ι'
K : Type u
L : Type v
E : Type z
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra K L
inst✝⁹ : Algebra K E
inst✝⁸ : Module.Finite K L
inst✝⁷ : IsAlgClosed E
b : ι → L
pb : PowerBasis K L
R : Type z
inst✝⁶ : CommRing R
inst✝⁵ : Algebra R K
inst✝⁴ : Algebra R L
inst✝³ : IsScalarTower R K L
inst✝² : IsSeparable K L
inst✝¹ : IsIntegrallyClosed R
inst✝ : IsFractionRing R K
B : PowerBasis K L
hint : IsIntegral R B.gen
z : L
hz : IsIntegral R z
hinv : IsUnit (det (traceMatrix K ⇑B.basis))
H :
  det (traceMatrix K ⇑B.basis) • mulVec (traceMatrix K ⇑B.basis) ((Basis.equivFun B.basis) z) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
cramer :
  mulVec (traceMatrix K ⇑B.basis) ((Matrix.cramer (traceMatrix K ⇑B.basis)) fun i => (trace K L) (z * B.basis i)) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
this : ∀ (i : Fin B.dim), (det (traceMatrix K ⇑B.basis) • (Basis.equivFun B.basis) z) i ∈ ⊥
⊢ ∑ x : Fin B.dim, discr K ⇑B.basis • (B.basis.repr z) x • B.basis x ∈ adjoin R {B.gen}

Next tactic:
refine' Subalgebra.sum_mem _ fun i _ => _
/-- Let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite
separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`.
Then for all, `z : L` that are integral over `R`, we have
`(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. -/
theorem discr_mul_isIntegral_mem_adjoin [IsSeparable K L] [IsIntegrallyClosed R]
    [IsFractionRing R K] {B : PowerBasis K L} (hint : IsIntegral R B.gen) {z : L}
    (hz : IsIntegral R z) : discr K B.basis • z ∈ adjoin R ({B.gen} : Set L) := by
  have hinv : IsUnit (traceMatrix K B.basis).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ B.basis
  have H :
    (traceMatrix K B.basis).det • (traceMatrix K B.basis).mulVec (B.basis.equivFun z) =
      (traceMatrix K B.basis).det • fun i => trace K L (z * B.basis i) :=
    by congr; exact traceMatrix_of_basis_mulVec _ _
  have cramer := mulVec_cramer (traceMatrix K B.basis) fun i => trace K L (z * B.basis i)
  suffices ∀ i, ((traceMatrix K B.basis).det • B.basis.equivFun z) i ∈ (⊥ : Subalgebra R K) by
    rw [← B.basis.sum_repr z, Finset.smul_sum]
    refine' Subalgebra.sum_mem _ fun i _ => _
    

Proof state:
A : Type u
B✝ : Type v
C : Type z
ι : Type w
inst✝²² : DecidableEq ι
inst✝²¹ : CommRing A
inst✝²⁰ : CommRing B✝
inst✝¹⁹ : Algebra A B✝
inst✝¹⁸ : CommRing C
inst✝¹⁷ : Algebra A C
ι' : Type u_1
inst✝¹⁶ : Fintype ι'
inst✝¹⁵ : Fintype ι
inst✝¹⁴ : DecidableEq ι'
K : Type u
L : Type v
E : Type z
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra K L
inst✝⁹ : Algebra K E
inst✝⁸ : Module.Finite K L
inst✝⁷ : IsAlgClosed E
b : ι → L
pb : PowerBasis K L
R : Type z
inst✝⁶ : CommRing R
inst✝⁵ : Algebra R K
inst✝⁴ : Algebra R L
inst✝³ : IsScalarTower R K L
inst✝² : IsSeparable K L
inst✝¹ : IsIntegrallyClosed R
inst✝ : IsFractionRing R K
B : PowerBasis K L
hint : IsIntegral R B.gen
z : L
hz : IsIntegral R z
hinv : IsUnit (det (traceMatrix K ⇑B.basis))
H :
  det (traceMatrix K ⇑B.basis) • mulVec (traceMatrix K ⇑B.basis) ((Basis.equivFun B.basis) z) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
cramer :
  mulVec (traceMatrix K ⇑B.basis) ((Matrix.cramer (traceMatrix K ⇑B.basis)) fun i => (trace K L) (z * B.basis i)) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
this : ∀ (i : Fin B.dim), (det (traceMatrix K ⇑B.basis) • (Basis.equivFun B.basis) z) i ∈ ⊥
i : Fin B.dim
x✝ : i ∈ univ
⊢ discr K ⇑B.basis • (B.basis.repr z) i • B.basis i ∈ adjoin R {B.gen}

Next tactic:
replace this := this i
/-- Let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite
separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`.
Then for all, `z : L` that are integral over `R`, we have
`(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. -/
theorem discr_mul_isIntegral_mem_adjoin [IsSeparable K L] [IsIntegrallyClosed R]
    [IsFractionRing R K] {B : PowerBasis K L} (hint : IsIntegral R B.gen) {z : L}
    (hz : IsIntegral R z) : discr K B.basis • z ∈ adjoin R ({B.gen} : Set L) := by
  have hinv : IsUnit (traceMatrix K B.basis).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ B.basis
  have H :
    (traceMatrix K B.basis).det • (traceMatrix K B.basis).mulVec (B.basis.equivFun z) =
      (traceMatrix K B.basis).det • fun i => trace K L (z * B.basis i) :=
    by congr; exact traceMatrix_of_basis_mulVec _ _
  have cramer := mulVec_cramer (traceMatrix K B.basis) fun i => trace K L (z * B.basis i)
  suffices ∀ i, ((traceMatrix K B.basis).det • B.basis.equivFun z) i ∈ (⊥ : Subalgebra R K) by
    rw [← B.basis.sum_repr z, Finset.smul_sum]
    refine' Subalgebra.sum_mem _ fun i _ => _
    replace this := this i
    

Proof state:
A : Type u
B✝ : Type v
C : Type z
ι : Type w
inst✝²² : DecidableEq ι
inst✝²¹ : CommRing A
inst✝²⁰ : CommRing B✝
inst✝¹⁹ : Algebra A B✝
inst✝¹⁸ : CommRing C
inst✝¹⁷ : Algebra A C
ι' : Type u_1
inst✝¹⁶ : Fintype ι'
inst✝¹⁵ : Fintype ι
inst✝¹⁴ : DecidableEq ι'
K : Type u
L : Type v
E : Type z
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra K L
inst✝⁹ : Algebra K E
inst✝⁸ : Module.Finite K L
inst✝⁷ : IsAlgClosed E
b : ι → L
pb : PowerBasis K L
R : Type z
inst✝⁶ : CommRing R
inst✝⁵ : Algebra R K
inst✝⁴ : Algebra R L
inst✝³ : IsScalarTower R K L
inst✝² : IsSeparable K L
inst✝¹ : IsIntegrallyClosed R
inst✝ : IsFractionRing R K
B : PowerBasis K L
hint : IsIntegral R B.gen
z : L
hz : IsIntegral R z
hinv : IsUnit (det (traceMatrix K ⇑B.basis))
H :
  det (traceMatrix K ⇑B.basis) • mulVec (traceMatrix K ⇑B.basis) ((Basis.equivFun B.basis) z) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
cramer :
  mulVec (traceMatrix K ⇑B.basis) ((Matrix.cramer (traceMatrix K ⇑B.basis)) fun i => (trace K L) (z * B.basis i)) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
i : Fin B.dim
x✝ : i ∈ univ
this : (det (traceMatrix K ⇑B.basis) • (Basis.equivFun B.basis) z) i ∈ ⊥
⊢ discr K ⇑B.basis • (B.basis.repr z) i • B.basis i ∈ adjoin R {B.gen}

Next tactic:
rw [← discr_def, Pi.smul_apply, mem_bot] at this
/-- Let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite
separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`.
Then for all, `z : L` that are integral over `R`, we have
`(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. -/
theorem discr_mul_isIntegral_mem_adjoin [IsSeparable K L] [IsIntegrallyClosed R]
    [IsFractionRing R K] {B : PowerBasis K L} (hint : IsIntegral R B.gen) {z : L}
    (hz : IsIntegral R z) : discr K B.basis • z ∈ adjoin R ({B.gen} : Set L) := by
  have hinv : IsUnit (traceMatrix K B.basis).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ B.basis
  have H :
    (traceMatrix K B.basis).det • (traceMatrix K B.basis).mulVec (B.basis.equivFun z) =
      (traceMatrix K B.basis).det • fun i => trace K L (z * B.basis i) :=
    by congr; exact traceMatrix_of_basis_mulVec _ _
  have cramer := mulVec_cramer (traceMatrix K B.basis) fun i => trace K L (z * B.basis i)
  suffices ∀ i, ((traceMatrix K B.basis).det • B.basis.equivFun z) i ∈ (⊥ : Subalgebra R K) by
    rw [← B.basis.sum_repr z, Finset.smul_sum]
    refine' Subalgebra.sum_mem _ fun i _ => _
    replace this := this i
    rw [← discr_def, Pi.smul_apply, mem_bot] at this
    

Proof state:
A : Type u
B✝ : Type v
C : Type z
ι : Type w
inst✝²² : DecidableEq ι
inst✝²¹ : CommRing A
inst✝²⁰ : CommRing B✝
inst✝¹⁹ : Algebra A B✝
inst✝¹⁸ : CommRing C
inst✝¹⁷ : Algebra A C
ι' : Type u_1
inst✝¹⁶ : Fintype ι'
inst✝¹⁵ : Fintype ι
inst✝¹⁴ : DecidableEq ι'
K : Type u
L : Type v
E : Type z
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra K L
inst✝⁹ : Algebra K E
inst✝⁸ : Module.Finite K L
inst✝⁷ : IsAlgClosed E
b : ι → L
pb : PowerBasis K L
R : Type z
inst✝⁶ : CommRing R
inst✝⁵ : Algebra R K
inst✝⁴ : Algebra R L
inst✝³ : IsScalarTower R K L
inst✝² : IsSeparable K L
inst✝¹ : IsIntegrallyClosed R
inst✝ : IsFractionRing R K
B : PowerBasis K L
hint : IsIntegral R B.gen
z : L
hz : IsIntegral R z
hinv : IsUnit (det (traceMatrix K ⇑B.basis))
H :
  det (traceMatrix K ⇑B.basis) • mulVec (traceMatrix K ⇑B.basis) ((Basis.equivFun B.basis) z) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
cramer :
  mulVec (traceMatrix K ⇑B.basis) ((Matrix.cramer (traceMatrix K ⇑B.basis)) fun i => (trace K L) (z * B.basis i)) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
i : Fin B.dim
x✝ : i ∈ univ
this : discr K ⇑B.basis • (Basis.equivFun B.basis) z i ∈ Set.range ⇑(algebraMap R K)
⊢ discr K ⇑B.basis • (B.basis.repr z) i • B.basis i ∈ adjoin R {B.gen}

Next tactic:
obtain ⟨r, hr⟩ := this
/-- Let `K` be the fraction field of an integrally closed domain `R` and let `L` be a finite
separable extension of `K`. Let `B : PowerBasis K L` be such that `IsIntegral R B.gen`.
Then for all, `z : L` that are integral over `R`, we have
`(discr K B.basis) • z ∈ adjoin R ({B.gen} : Set L)`. -/
theorem discr_mul_isIntegral_mem_adjoin [IsSeparable K L] [IsIntegrallyClosed R]
    [IsFractionRing R K] {B : PowerBasis K L} (hint : IsIntegral R B.gen) {z : L}
    (hz : IsIntegral R z) : discr K B.basis • z ∈ adjoin R ({B.gen} : Set L) := by
  have hinv : IsUnit (traceMatrix K B.basis).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ B.basis
  have H :
    (traceMatrix K B.basis).det • (traceMatrix K B.basis).mulVec (B.basis.equivFun z) =
      (traceMatrix K B.basis).det • fun i => trace K L (z * B.basis i) :=
    by congr; exact traceMatrix_of_basis_mulVec _ _
  have cramer := mulVec_cramer (traceMatrix K B.basis) fun i => trace K L (z * B.basis i)
  suffices ∀ i, ((traceMatrix K B.basis).det • B.basis.equivFun z) i ∈ (⊥ : Subalgebra R K) by
    rw [← B.basis.sum_repr z, Finset.smul_sum]
    refine' Subalgebra.sum_mem _ fun i _ => _
    replace this := this i
    rw [← discr_def, Pi.smul_apply, mem_bot] at this
    obtain ⟨r, hr⟩ := this
    

Proof state:
case intro
A : Type u
B✝ : Type v
C : Type z
ι : Type w
inst✝²² : DecidableEq ι
inst✝²¹ : CommRing A
inst✝²⁰ : CommRing B✝
inst✝¹⁹ : Algebra A B✝
inst✝¹⁸ : CommRing C
inst✝¹⁷ : Algebra A C
ι' : Type u_1
inst✝¹⁶ : Fintype ι'
inst✝¹⁵ : Fintype ι
inst✝¹⁴ : DecidableEq ι'
K : Type u
L : Type v
E : Type z
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Field E
inst✝¹⁰ : Algebra K L
inst✝⁹ : Algebra K E
inst✝⁸ : Module.Finite K L
inst✝⁷ : IsAlgClosed E
b : ι → L
pb : PowerBasis K L
R : Type z
inst✝⁶ : CommRing R
inst✝⁵ : Algebra R K
inst✝⁴ : Algebra R L
inst✝³ : IsScalarTower R K L
inst✝² : IsSeparable K L
inst✝¹ : IsIntegrallyClosed R
inst✝ : IsFractionRing R K
B : PowerBasis K L
hint : IsIntegral R B.gen
z : L
hz : IsIntegral R z
hinv : IsUnit (det (traceMatrix K ⇑B.basis))
H :
  det (traceMatrix K ⇑B.basis) • mulVec (traceMatrix K ⇑B.basis) ((Basis.equivFun B.basis) z) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
cramer :
  mulVec (traceMatrix K ⇑B.basis) ((Matrix.cramer (traceMatrix K ⇑B.basis)) fun i => (trace K L) (z * B.basis i)) =
    det (traceMatrix K ⇑B.basis) • fun i => (trace K L) (z * B.basis i)
i : Fin B.dim
x✝ : i ∈ univ
r : R
hr : (algebraMap R K) r = discr K ⇑B.basis • (Basis.equivFun B.basis) z i
⊢ discr K ⇑B.basis • (B.basis.repr z) i • B.basis i ∈ adjoin R {B.gen}

Next tactic:
rw [Basis.equivFun_apply] at hr