l3lab/ntp-mathlib huggingface dataset:
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  

Proof state:
case h.h
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : x ∈ Iᵛ
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
⊢ IsIntegral A ((cramer (traceMatrix K ⇑b)) (fun i => (Algebra.trace K L) (x * a * b i)) i)

Next tactic:
rw [cramer_apply]
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  rw [cramer_apply]
  

Proof state:
case h.h
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : x ∈ Iᵛ
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
⊢ IsIntegral A (det (updateColumn (traceMatrix K ⇑b) i fun i => (Algebra.trace K L) (x * a * b i)))

Next tactic:
apply IsIntegral.det
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  rw [cramer_apply]
  apply IsIntegral.det
  

Proof state:
case h.h.h
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : x ∈ Iᵛ
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
⊢ ∀ (i_1 j : ι), IsIntegral A (updateColumn (traceMatrix K ⇑b) i (fun i => (Algebra.trace K L) (x * a * b i)) i_1 j)

Next tactic:
intros j k
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  rw [cramer_apply]
  apply IsIntegral.det
  intros j k
  

Proof state:
case h.h.h
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : x ∈ Iᵛ
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
j k : ι
⊢ IsIntegral A (updateColumn (traceMatrix K ⇑b) i (fun i => (Algebra.trace K L) (x * a * b i)) j k)

Next tactic:
rw [updateColumn_apply]
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  rw [cramer_apply]
  apply IsIntegral.det
  intros j k
  rw [updateColumn_apply]
  

Proof state:
case h.h.h
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : x ∈ Iᵛ
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
j k : ι
⊢ IsIntegral A (if k = i then (Algebra.trace K L) (x * a * b j) else traceMatrix K (⇑b) j k)

Next tactic:
split
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  rw [cramer_apply]
  apply IsIntegral.det
  intros j k
  rw [updateColumn_apply]
  split
  · 

Proof state:
case h.h.h.inl
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : x ∈ Iᵛ
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
j k : ι
h✝ : k = i
⊢ IsIntegral A ((Algebra.trace K L) (x * a * b j))

Next tactic:
rw [mul_assoc]
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  rw [cramer_apply]
  apply IsIntegral.det
  intros j k
  rw [updateColumn_apply]
  split
  · rw [mul_assoc]
    

Proof state:
case h.h.h.inl
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : x ∈ Iᵛ
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
j k : ι
h✝ : k = i
⊢ IsIntegral A ((Algebra.trace K L) (x * (a * b j)))

Next tactic:
rw [mem_traceDual_iff_isIntegral] at hx
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  rw [cramer_apply]
  apply IsIntegral.det
  intros j k
  rw [updateColumn_apply]
  split
  · rw [mul_assoc]
    rw [mem_traceDual_iff_isIntegral] at hx
    

Proof state:
case h.h.h.inl
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : ∀ a ∈ I, IsIntegral A (BilinForm.bilin (traceForm K L) x a)
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
j k : ι
h✝ : k = i
⊢ IsIntegral A ((Algebra.trace K L) (x * (a * b j)))

Next tactic:
apply hx
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  rw [cramer_apply]
  apply IsIntegral.det
  intros j k
  rw [updateColumn_apply]
  split
  · rw [mul_assoc]
    rw [mem_traceDual_iff_isIntegral] at hx
    apply hx
    

Proof state:
case h.h.h.inl.a
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : ∀ a ∈ I, IsIntegral A (BilinForm.bilin (traceForm K L) x a)
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
j k : ι
h✝ : k = i
⊢ a * b j ∈ I

Next tactic:
have ⟨y, hy⟩ := (IsIntegralClosure.isIntegral_iff (A := B)).mp (hb j)
/-- If `b` is an `A`-integral basis of `L` with discriminant `b`, then `d • a * x` is integral over
  `A` for all `a ∈ I` and `x ∈ Iᵛ`. -/
lemma isIntegral_discr_mul_of_mem_traceDual
    (I : Submodule B L) {ι} [DecidableEq ι] [Fintype ι]
    {b : Basis ι K L} (hb : ∀ i, IsIntegral A (b i))
    {a x : L} (ha : a ∈ I) (hx : x ∈ Iᵛ) :
    IsIntegral A ((discr K b) • a * x) := by
  have hinv : IsUnit (traceMatrix K b).det := by
    simpa [← discr_def] using discr_isUnit_of_basis _ b
  have H := mulVec_cramer (traceMatrix K b) fun i => trace K L (x * a * b i)
  have : Function.Injective (traceMatrix K b).mulVec
  · rwa [mulVec_injective_iff_isUnit, isUnit_iff_isUnit_det]
  rw [← traceMatrix_of_basis_mulVec, ← mulVec_smul, this.eq_iff,
    traceMatrix_of_basis_mulVec] at H
  rw [← b.equivFun.symm_apply_apply (_ * _), b.equivFun_symm_apply]
  apply IsIntegral.sum
  intro i _
  rw [smul_mul_assoc, b.equivFun.map_smul, discr_def, mul_comm, ← H, Algebra.smul_def]
  refine RingHom.IsIntegralElem.mul _ ?_ (hb _)
  apply IsIntegral.algebraMap
  rw [cramer_apply]
  apply IsIntegral.det
  intros j k
  rw [updateColumn_apply]
  split
  · rw [mul_assoc]
    rw [mem_traceDual_iff_isIntegral] at hx
    apply hx
    have ⟨y, hy⟩ := (IsIntegralClosure.isIntegral_iff (A := B)).mp (hb j)
    

Proof state:
case h.h.h.inl.a
A : Type u_1
K : Type u_2
L : Type u
B : Type u_3
inst✝²⁰ : CommRing A
inst✝¹⁹ : Field K
inst✝¹⁸ : CommRing B
inst✝¹⁷ : Field L
inst✝¹⁶ : Algebra A K
inst✝¹⁵ : Algebra B L
inst✝¹⁴ : Algebra A B
inst✝¹³ : Algebra K L
inst✝¹² : Algebra A L
inst✝¹¹ : IsScalarTower A K L
inst✝¹⁰ : IsScalarTower A B L
inst✝⁹ : IsDomain A
inst✝⁸ : IsDomain B
inst✝⁷ : IsFractionRing A K
inst✝⁶ : IsIntegralClosure B A L
inst✝⁵ : IsFractionRing B L
inst✝⁴ : FiniteDimensional K L
inst✝³ : IsSeparable K L
inst✝² : IsIntegrallyClosed A
I : Submodule B L
ι : Type u_4
inst✝¹ : DecidableEq ι
inst✝ : Fintype ι
b : Basis ι K L
hb : ∀ (i : ι), IsIntegral A (b i)
a x : L
ha : a ∈ I
hx : ∀ a ∈ I, IsIntegral A (BilinForm.bilin (traceForm K L) x a)
hinv : IsUnit (det (traceMatrix K ⇑b))
H :
  ((cramer (traceMatrix K ⇑b)) fun i => (Algebra.trace K L) (x * a * b i)) =
    det (traceMatrix K ⇑b) • (Basis.equivFun b) (x * a)
this : Function.Injective (mulVec (traceMatrix K ⇑b))
i : ι
a✝ : i ∈ Finset.univ
j k : ι
h✝ : k = i
y : B
hy : (algebraMap B L) y = b j
⊢ a * b j ∈ I

Next tactic:
rw [mul_comm, ← hy, ← Algebra.smul_def]