l3lab/ntp-mathlib huggingface dataset:
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · 

Proof state:
case pos
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
h : ∃ s, Nonempty (Basis { x // x ∈ s } B C)
⊢ e ((trace A C) x) = (trace B C) x

Next tactic:
obtain ⟨s, ⟨b⟩⟩ := h
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    

Proof state:
case pos.intro.intro
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
s : Finset C
b : Basis { x // x ∈ s } B C
⊢ e ((trace A C) x) = (trace B C) x

Next tactic:
letI : Algebra A B := RingHom.toAlgebra e
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    

Proof state:
case pos.intro.intro
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
s : Finset C
b : Basis { x // x ∈ s } B C
this : Algebra A B := RingHom.toAlgebra ↑e
⊢ e ((trace A C) x) = (trace B C) x

Next tactic:
letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    

Proof state:
case pos.intro.intro
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
s : Finset C
b : Basis { x // x ∈ s } B C
this✝ : Algebra A B := RingHom.toAlgebra ↑e
this : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
⊢ e ((trace A C) x) = (trace B C) x

Next tactic:
rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by 

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
s : Finset C
b : Basis { x // x ∈ s } B C
this✝ : Algebra A B := RingHom.toAlgebra ↑e
this : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
⊢ ∀ (c : B) (x : C), (RingEquiv.symm e) c • x = c • x

Next tactic:
simp [Algebra.smul_def, ← he]
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
    

Proof state:
case pos.intro.intro
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
s : Finset C
b : Basis { x // x ∈ s } B C
this✝ : Algebra A B := RingHom.toAlgebra ↑e
this : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
⊢ e
      (Matrix.trace
        ((leftMulMatrix
            (Basis.mapCoeffs b (RingEquiv.symm e) (_ : ∀ (a : B) (a_1 : C), (RingEquiv.symm e) a • a_1 = a • a_1)))
          x)) =
    Matrix.trace ((leftMulMatrix b) x)

Next tactic:
show e.toAddMonoidHom _ = _
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
    show e.toAddMonoidHom _ = _
    

Proof state:
case pos.intro.intro
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
s : Finset C
b : Basis { x // x ∈ s } B C
this✝ : Algebra A B := RingHom.toAlgebra ↑e
this : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
⊢ (RingEquiv.toAddMonoidHom e)
      (Matrix.trace
        ((leftMulMatrix
            (Basis.mapCoeffs b (RingEquiv.symm e) (_ : ∀ (a : B) (a_1 : C), (RingEquiv.symm e) a • a_1 = a • a_1)))
          x)) =
    Matrix.trace ((leftMulMatrix b) x)

Next tactic:
rw [AddMonoidHom.map_trace]
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
    show e.toAddMonoidHom _ = _
    rw [AddMonoidHom.map_trace]
    

Proof state:
case pos.intro.intro
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
s : Finset C
b : Basis { x // x ∈ s } B C
this✝ : Algebra A B := RingHom.toAlgebra ↑e
this : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
⊢ Matrix.trace
      ((AddMonoidHom.mapMatrix (RingEquiv.toAddMonoidHom e))
        ((leftMulMatrix
            (Basis.mapCoeffs b (RingEquiv.symm e) (_ : ∀ (a : B) (a_1 : C), (RingEquiv.symm e) a • a_1 = a • a_1)))
          x)) =
    Matrix.trace ((leftMulMatrix b) x)

Next tactic:
congr
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
    show e.toAddMonoidHom _ = _
    rw [AddMonoidHom.map_trace]
    congr
    

Proof state:
case pos.intro.intro.e_A
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
s : Finset C
b : Basis { x // x ∈ s } B C
this✝ : Algebra A B := RingHom.toAlgebra ↑e
this : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
⊢ (AddMonoidHom.mapMatrix (RingEquiv.toAddMonoidHom e))
      ((leftMulMatrix
          (Basis.mapCoeffs b (RingEquiv.symm e) (_ : ∀ (a : B) (a_1 : C), (RingEquiv.symm e) a • a_1 = a • a_1)))
        x) =
    (leftMulMatrix b) x

Next tactic:
ext i j
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
    show e.toAddMonoidHom _ = _
    rw [AddMonoidHom.map_trace]
    congr
    ext i j
    

Proof state:
case pos.intro.intro.e_A.a.h
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
s : Finset C
b : Basis { x // x ∈ s } B C
this✝ : Algebra A B := RingHom.toAlgebra ↑e
this : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
i j : { x // x ∈ s }
⊢ (AddMonoidHom.mapMatrix (RingEquiv.toAddMonoidHom e))
      ((leftMulMatrix
          (Basis.mapCoeffs b (RingEquiv.symm e) (_ : ∀ (a : B) (a_1 : C), (RingEquiv.symm e) a • a_1 = a • a_1)))
        x)
      i j =
    (leftMulMatrix b) x i j

Next tactic:
simp [leftMulMatrix_apply, LinearMap.toMatrix_apply]
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
    show e.toAddMonoidHom _ = _
    rw [AddMonoidHom.map_trace]
    congr
    ext i j
    simp [leftMulMatrix_apply, LinearMap.toMatrix_apply]
  

Proof state:
case neg
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
h : ¬∃ s, Nonempty (Basis { x // x ∈ s } B C)
⊢ e ((trace A C) x) = (trace B C) x

Next tactic:
rw [trace_eq_zero_of_not_exists_basis _ h, trace_eq_zero_of_not_exists_basis,
    LinearMap.zero_apply, LinearMap.zero_apply, map_zero]
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
    show e.toAddMonoidHom _ = _
    rw [AddMonoidHom.map_trace]
    congr
    ext i j
    simp [leftMulMatrix_apply, LinearMap.toMatrix_apply]
  rw [trace_eq_zero_of_not_exists_basis _ h, trace_eq_zero_of_not_exists_basis,
    LinearMap.zero_apply, LinearMap.zero_apply, map_zero]
  

Proof state:
case neg.h
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
h : ¬∃ s, Nonempty (Basis { x // x ∈ s } B C)
⊢ ¬∃ s, Nonempty (Basis { x // x ∈ s } A C)

Next tactic:
intro ⟨s, ⟨b⟩⟩
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
    show e.toAddMonoidHom _ = _
    rw [AddMonoidHom.map_trace]
    congr
    ext i j
    simp [leftMulMatrix_apply, LinearMap.toMatrix_apply]
  rw [trace_eq_zero_of_not_exists_basis _ h, trace_eq_zero_of_not_exists_basis,
    LinearMap.zero_apply, LinearMap.zero_apply, map_zero]
  intro ⟨s, ⟨b⟩⟩
  

Proof state:
case neg.h
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
h : ¬∃ s, Nonempty (Basis { x // x ∈ s } B C)
s : Finset C
b : Basis { x // x ∈ s } A C
⊢ False

Next tactic:
exact h ⟨s, ⟨b.mapCoeffs e (by simp [Algebra.smul_def, ← he])⟩⟩
lemma Algebra.trace_eq_of_ringEquiv {A B C : Type*} [CommRing A] [CommRing B] [CommRing C]
    [Algebra A C] [Algebra B C] (e : A ≃+* B) (he : (algebraMap B C).comp e = algebraMap A C) (x) :
    e (Algebra.trace A C x) = Algebra.trace B C x := by
  classical
  by_cases h : ∃ s : Finset C, Nonempty (Basis s B C)
  · obtain ⟨s, ⟨b⟩⟩ := h
    letI : Algebra A B := RingHom.toAlgebra e
    letI : IsScalarTower A B C := IsScalarTower.of_algebraMap_eq' he.symm
    rw [Algebra.trace_eq_matrix_trace b,
      Algebra.trace_eq_matrix_trace (b.mapCoeffs e.symm (by simp [Algebra.smul_def, ← he]))]
    show e.toAddMonoidHom _ = _
    rw [AddMonoidHom.map_trace]
    congr
    ext i j
    simp [leftMulMatrix_apply, LinearMap.toMatrix_apply]
  rw [trace_eq_zero_of_not_exists_basis _ h, trace_eq_zero_of_not_exists_basis,
    LinearMap.zero_apply, LinearMap.zero_apply, map_zero]
  intro ⟨s, ⟨b⟩⟩
  exact h ⟨s, ⟨b.mapCoeffs e (by 

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁸ : CommRing R
inst✝¹⁷ : CommRing S
inst✝¹⁶ : CommRing T
inst✝¹⁵ : Algebra R S
inst✝¹⁴ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹³ : Field K
inst✝¹² : Field L
inst✝¹¹ : Algebra K L
ι κ : Type w
inst✝¹⁰ : Fintype ι
F : Type u_6
inst✝⁹ : Field F
inst✝⁸ : Algebra R L
inst✝⁷ : Algebra L F
inst✝⁶ : Algebra R F
inst✝⁵ : IsScalarTower R L F
A : Type u_7
B : Type u_8
C : Type u_9
inst✝⁴ : CommRing A
inst✝³ : CommRing B
inst✝² : CommRing C
inst✝¹ : Algebra A C
inst✝ : Algebra B C
e : A ≃+* B
he : RingHom.comp (algebraMap B C) ↑e = algebraMap A C
x : C
h : ¬∃ s, Nonempty (Basis { x // x ∈ s } B C)
s : Finset C
b : Basis { x // x ∈ s } A C
⊢ ∀ (c : A) (x : C), e c • x = c • x

Next tactic:
simp [Algebra.smul_def, ← he]
lemma Algebra.trace_eq_of_equiv_equiv {A₁ B₁ A₂ B₂ : Type*} [CommRing A₁] [CommRing B₁]
    [CommRing A₂] [CommRing B₂] [Algebra A₁ B₁] [Algebra A₂ B₂] (e₁ : A₁ ≃+* A₂) (e₂ : B₁ ≃+* B₂)
    (he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp ↑e₂ (algebraMap A₁ B₁)) (x) :
    Algebra.trace A₁ B₁ x = e₁.symm (Algebra.trace A₂ B₂ (e₂ x)) := by
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁹ : CommRing R
inst✝¹⁸ : CommRing S
inst✝¹⁷ : CommRing T
inst✝¹⁶ : Algebra R S
inst✝¹⁵ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁴ : Field K
inst✝¹³ : Field L
inst✝¹² : Algebra K L
ι κ : Type w
inst✝¹¹ : Fintype ι
F : Type u_6
inst✝¹⁰ : Field F
inst✝⁹ : Algebra R L
inst✝⁸ : Algebra L F
inst✝⁷ : Algebra R F
inst✝⁶ : IsScalarTower R L F
A₁ : Type u_7
B₁ : Type u_8
A₂ : Type u_9
B₂ : Type u_10
inst✝⁵ : CommRing A₁
inst✝⁴ : CommRing B₁
inst✝³ : CommRing A₂
inst✝² : CommRing B₂
inst✝¹ : Algebra A₁ B₁
inst✝ : Algebra A₂ B₂
e₁ : A₁ ≃+* A₂
e₂ : B₁ ≃+* B₂
he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp (↑e₂) (algebraMap A₁ B₁)
x : B₁
⊢ (trace A₁ B₁) x = (RingEquiv.symm e₁) ((trace A₂ B₂) (e₂ x))

Next tactic:
letI := (RingHom.comp (e₂ : B₁ →+* B₂) (algebraMap A₁ B₁)).toAlgebra
lemma Algebra.trace_eq_of_equiv_equiv {A₁ B₁ A₂ B₂ : Type*} [CommRing A₁] [CommRing B₁]
    [CommRing A₂] [CommRing B₂] [Algebra A₁ B₁] [Algebra A₂ B₂] (e₁ : A₁ ≃+* A₂) (e₂ : B₁ ≃+* B₂)
    (he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp ↑e₂ (algebraMap A₁ B₁)) (x) :
    Algebra.trace A₁ B₁ x = e₁.symm (Algebra.trace A₂ B₂ (e₂ x)) := by
  letI := (RingHom.comp (e₂ : B₁ →+* B₂) (algebraMap A₁ B₁)).toAlgebra
  

Proof state:
R : Type u_1
S : Type u_2
T : Type u_3
inst✝¹⁹ : CommRing R
inst✝¹⁸ : CommRing S
inst✝¹⁷ : CommRing T
inst✝¹⁶ : Algebra R S
inst✝¹⁵ : Algebra R T
K : Type u_4
L : Type u_5
inst✝¹⁴ : Field K
inst✝¹³ : Field L
inst✝¹² : Algebra K L
ι κ : Type w
inst✝¹¹ : Fintype ι
F : Type u_6
inst✝¹⁰ : Field F
inst✝⁹ : Algebra R L
inst✝⁸ : Algebra L F
inst✝⁷ : Algebra R F
inst✝⁶ : IsScalarTower R L F
A₁ : Type u_7
B₁ : Type u_8
A₂ : Type u_9
B₂ : Type u_10
inst✝⁵ : CommRing A₁
inst✝⁴ : CommRing B₁
inst✝³ : CommRing A₂
inst✝² : CommRing B₂
inst✝¹ : Algebra A₁ B₁
inst✝ : Algebra A₂ B₂
e₁ : A₁ ≃+* A₂
e₂ : B₁ ≃+* B₂
he : RingHom.comp (algebraMap A₂ B₂) ↑e₁ = RingHom.comp (↑e₂) (algebraMap A₁ B₁)
x : B₁
this : Algebra A₁ B₂ := RingHom.toAlgebra (RingHom.comp (↑e₂) (algebraMap A₁ B₁))
⊢ (trace A₁ B₁) x = (RingEquiv.symm e₁) ((trace A₂ B₂) (e₂ x))

Next tactic:
let e' : B₁ ≃ₐ[A₁] B₂ := { e₂ with commutes' := fun _ ↦ rfl }