l3lab/ntp-mathlib huggingface dataset:
/-- The function `(A ⊗[R] Matrix n n R) →ₐ[R] Matrix n n A`, as an algebra homomorphism.
-/
def toFunAlgHom : A ⊗[R] Matrix n n R →ₐ[R] Matrix n n A :=
  algHomOfLinearMapTensorProduct (toFunLinear R A n)
    (by
      intros
      simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply, Matrix.map_mul]
      ext
      dsimp
      

Proof state:
case a.h
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
a₁✝ a₂✝ : A
b₁✝ b₂✝ : Matrix n n R
i✝ x✝ : n
⊢ a₁✝ * a₂✝ * (Matrix.map b₁✝ ⇑(algebraMap R A) * Matrix.map b₂✝ ⇑(algebraMap R A)) i✝ x✝ =
    (a₁✝ • Matrix.map b₁✝ ⇑(algebraMap R A) * a₂✝ • Matrix.map b₂✝ ⇑(algebraMap R A)) i✝ x✝

Next tactic:
simp_rw [Matrix.mul_apply, Matrix.smul_apply, Matrix.map_apply, smul_eq_mul, Finset.mul_sum,
        _root_.mul_assoc, Algebra.left_comm]
/-- The function `(A ⊗[R] Matrix n n R) →ₐ[R] Matrix n n A`, as an algebra homomorphism.
-/
def toFunAlgHom : A ⊗[R] Matrix n n R →ₐ[R] Matrix n n A :=
  algHomOfLinearMapTensorProduct (toFunLinear R A n)
    (by
      intros
      simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply, Matrix.map_mul]
      ext
      dsimp
      simp_rw [Matrix.mul_apply, Matrix.smul_apply, Matrix.map_apply, smul_eq_mul, Finset.mul_sum,
        _root_.mul_assoc, Algebra.left_comm])
    (by
      

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
⊢ (toFunLinear R A n) (1 ⊗ₜ[R] 1) = 1

Next tactic:
simp_rw [toFunLinear, lift.tmul, toFunBilinear_apply,
        Matrix.map_one (algebraMap R A) (map_zero _) (map_one _), one_smul]
@[simp]
theorem invFun_zero : invFun R A n 0 = 0 := by 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
⊢ invFun R A n 0 = 0

Next tactic:
simp [invFun]
@[simp]
theorem invFun_add (M N : Matrix n n A) : invFun R A n (M + N) = invFun R A n M + invFun R A n N :=
  by 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M N : Matrix n n A
⊢ invFun R A n (M + N) = invFun R A n M + invFun R A n N

Next tactic:
simp [invFun, add_tmul, Finset.sum_add_distrib]
@[simp]
theorem invFun_smul (a : A) (M : Matrix n n A) : invFun R A n (a • M) = a ⊗ₜ 1 * invFun R A n M :=
  by 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
a : A
M : Matrix n n A
⊢ invFun R A n (a • M) = a ⊗ₜ[R] 1 * invFun R A n M

Next tactic:
simp [invFun, Finset.mul_sum]
@[simp]
theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ⊗ₜ M := by
  

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n R
⊢ invFun R A n (Matrix.map M ⇑(algebraMap R A)) = 1 ⊗ₜ[R] M

Next tactic:
dsimp [invFun]
@[simp]
theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ⊗ₜ M := by
  dsimp [invFun]
  

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n R
⊢ ∑ p : n × n, (algebraMap R A) (M p.1 p.2) ⊗ₜ[R] stdBasisMatrix p.1 p.2 1 = 1 ⊗ₜ[R] M

Next tactic:
simp only [Algebra.algebraMap_eq_smul_one, smul_tmul, ← tmul_sum, mul_boole]
@[simp]
theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ⊗ₜ M := by
  dsimp [invFun]
  simp only [Algebra.algebraMap_eq_smul_one, smul_tmul, ← tmul_sum, mul_boole]
  

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n R
⊢ 1 ⊗ₜ[R] ∑ a : n × n, M a.1 a.2 • stdBasisMatrix a.1 a.2 1 = 1 ⊗ₜ[R] M

Next tactic:
congr
@[simp]
theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ⊗ₜ M := by
  dsimp [invFun]
  simp only [Algebra.algebraMap_eq_smul_one, smul_tmul, ← tmul_sum, mul_boole]
  congr
  

Proof state:
case e_n
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n R
⊢ ∑ a : n × n, M a.1 a.2 • stdBasisMatrix a.1 a.2 1 = M

Next tactic:
conv_rhs => rw [matrix_eq_sum_std_basis M]
@[simp]
theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ⊗ₜ M := by
  dsimp [invFun]
  simp only [Algebra.algebraMap_eq_smul_one, smul_tmul, ← tmul_sum, mul_boole]
  congr
  conv_rhs => 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n R
| M

Next tactic:
rw [matrix_eq_sum_std_basis M]
@[simp]
theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ⊗ₜ M := by
  dsimp [invFun]
  simp only [Algebra.algebraMap_eq_smul_one, smul_tmul, ← tmul_sum, mul_boole]
  congr
  conv_rhs => rw [matrix_eq_sum_std_basis M]
  

Proof state:
case e_n
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n R
⊢ ∑ a : n × n, M a.1 a.2 • stdBasisMatrix a.1 a.2 1 = ∑ i : n, ∑ j : n, stdBasisMatrix i j (M i j)

Next tactic:
convert Finset.sum_product (β := Matrix n n R)
@[simp]
theorem invFun_algebraMap (M : Matrix n n R) : invFun R A n (M.map (algebraMap R A)) = 1 ⊗ₜ M := by
  dsimp [invFun]
  simp only [Algebra.algebraMap_eq_smul_one, smul_tmul, ← tmul_sum, mul_boole]
  congr
  conv_rhs => rw [matrix_eq_sum_std_basis M]
  convert Finset.sum_product (β := Matrix n n R); 

Proof state:
case h.e'_3.a.a
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n R
x✝¹ : n
a✝¹ : x✝¹ ∈ Finset.univ
x✝ : n
a✝ : x✝ ∈ Finset.univ
⊢ stdBasisMatrix x✝¹ x✝ (M x✝¹ x✝) = M (x✝¹, x✝).1 (x✝¹, x✝).2 • stdBasisMatrix (x✝¹, x✝).1 (x✝¹, x✝).2 1

Next tactic:
simp
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
  

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n A
⊢ (toFunAlgHom R A n) (invFun R A n M) = M

Next tactic:
simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul,
    mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
    Pi.smul_def]
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
  simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul,
    mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
    Pi.smul_def]
  

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n A
⊢ ∑ x : n × n, M x.1 x.2 • Matrix.map (stdBasisMatrix x.1 x.2 1) ⇑(algebraMap R A) = M

Next tactic:
convert Finset.sum_product (β := Matrix n n A)
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
  simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul,
    mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
    Pi.smul_def]
  convert Finset.sum_product (β := Matrix n n A)
  

Proof state:
case h.e'_3
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n A
⊢ M = ∑ x : n, ∑ y : n, M (x, y).1 (x, y).2 • Matrix.map (stdBasisMatrix (x, y).1 (x, y).2 1) ⇑(algebraMap R A)

Next tactic:
conv_lhs => rw [matrix_eq_sum_std_basis M]
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
  simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul,
    mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
    Pi.smul_def]
  convert Finset.sum_product (β := Matrix n n A)
  conv_lhs => 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n A
| M

Next tactic:
rw [matrix_eq_sum_std_basis M]
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
  simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul,
    mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
    Pi.smul_def]
  convert Finset.sum_product (β := Matrix n n A)
  conv_lhs => rw [matrix_eq_sum_std_basis M]
  

Proof state:
case h.e'_3
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n A
⊢ ∑ i : n, ∑ j : n, stdBasisMatrix i j (M i j) =
    ∑ x : n, ∑ y : n, M (x, y).1 (x, y).2 • Matrix.map (stdBasisMatrix (x, y).1 (x, y).2 1) ⇑(algebraMap R A)

Next tactic:
refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Matrix.ext fun a b => ?_
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
  simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul,
    mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
    Pi.smul_def]
  convert Finset.sum_product (β := Matrix n n A)
  conv_lhs => rw [matrix_eq_sum_std_basis M]
  refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Matrix.ext fun a b => ?_
  

Proof state:
case h.e'_3
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n A
i : n
x✝¹ : i ∈ Finset.univ
j : n
x✝ : j ∈ Finset.univ
a b : n
⊢ stdBasisMatrix i j (M i j) a b =
    (M (i, j).1 (i, j).2 • Matrix.map (stdBasisMatrix (i, j).1 (i, j).2 1) ⇑(algebraMap R A)) a b

Next tactic:
simp only [stdBasisMatrix, smul_apply, Matrix.map_apply]
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
  simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul,
    mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
    Pi.smul_def]
  convert Finset.sum_product (β := Matrix n n A)
  conv_lhs => rw [matrix_eq_sum_std_basis M]
  refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Matrix.ext fun a b => ?_
  simp only [stdBasisMatrix, smul_apply, Matrix.map_apply]
  

Proof state:
case h.e'_3
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n A
i : n
x✝¹ : i ∈ Finset.univ
j : n
x✝ : j ∈ Finset.univ
a b : n
⊢ (if i = a ∧ j = b then M i j else 0) = M i j • (algebraMap R A) (if i = a ∧ j = b then 1 else 0)

Next tactic:
split_ifs
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
  simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul,
    mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
    Pi.smul_def]
  convert Finset.sum_product (β := Matrix n n A)
  conv_lhs => rw [matrix_eq_sum_std_basis M]
  refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Matrix.ext fun a b => ?_
  simp only [stdBasisMatrix, smul_apply, Matrix.map_apply]
  split_ifs <;> 

Proof state:
case pos
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n A
i : n
x✝¹ : i ∈ Finset.univ
j : n
x✝ : j ∈ Finset.univ
a b : n
h✝ : i = a ∧ j = b
⊢ M i j = M i j • (algebraMap R A) 1

Next tactic:
aesop
theorem right_inv (M : Matrix n n A) : (toFunAlgHom R A n) (invFun R A n M) = M := by
  simp only [invFun, AlgHom.map_sum, stdBasisMatrix, apply_ite ↑(algebraMap R A), smul_eq_mul,
    mul_boole, toFunAlgHom_apply, RingHom.map_zero, RingHom.map_one, Matrix.map_apply,
    Pi.smul_def]
  convert Finset.sum_product (β := Matrix n n A)
  conv_lhs => rw [matrix_eq_sum_std_basis M]
  refine Finset.sum_congr rfl fun i _ => Finset.sum_congr rfl fun j _ => Matrix.ext fun a b => ?_
  simp only [stdBasisMatrix, smul_apply, Matrix.map_apply]
  split_ifs <;> 

Proof state:
case neg
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : Matrix n n A
i : n
x✝¹ : i ∈ Finset.univ
j : n
x✝ : j ∈ Finset.univ
a b : n
h✝ : ¬(i = a ∧ j = b)
⊢ 0 = M i j • (algebraMap R A) 0

Next tactic:
aesop
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
  

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
M : A ⊗[R] Matrix n n R
⊢ invFun R A n ((toFunAlgHom R A n) M) = M

Next tactic:
induction M using TensorProduct.induction_on with
  | zero => simp
  | tmul a m => simp
  | add x y hx hy =>
    rw [map_add]
    conv_rhs => rw [← hx, ← hy, ← invFun_add]
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
  induction M using TensorProduct.induction_on with
  

Proof state:
case zero
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
⊢ invFun R A n ((toFunAlgHom R A n) 0) = 0

Next tactic:
| zero => simp
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
  induction M using TensorProduct.induction_on with
  | zero => 

Proof state:
case zero
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
⊢ invFun R A n ((toFunAlgHom R A n) 0) = 0

Next tactic:
simp
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
  induction M using TensorProduct.induction_on with
  | zero => simp
  

Proof state:
case tmul
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
a : A
m : Matrix n n R
⊢ invFun R A n ((toFunAlgHom R A n) (a ⊗ₜ[R] m)) = a ⊗ₜ[R] m

Next tactic:
| tmul a m => simp
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
  induction M using TensorProduct.induction_on with
  | zero => simp
  | tmul a m => 

Proof state:
case tmul
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
a : A
m : Matrix n n R
⊢ invFun R A n ((toFunAlgHom R A n) (a ⊗ₜ[R] m)) = a ⊗ₜ[R] m

Next tactic:
simp
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
  induction M using TensorProduct.induction_on with
  | zero => simp
  | tmul a m => simp
  

Proof state:
case add
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
x y : A ⊗[R] Matrix n n R
hx : invFun R A n ((toFunAlgHom R A n) x) = x
hy : invFun R A n ((toFunAlgHom R A n) y) = y
⊢ invFun R A n ((toFunAlgHom R A n) (x + y)) = x + y

Next tactic:
| add x y hx hy =>
    rw [map_add]
    conv_rhs => rw [← hx, ← hy, ← invFun_add]
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
  induction M using TensorProduct.induction_on with
  | zero => simp
  | tmul a m => simp
  | add x y hx hy =>
    

Proof state:
case add
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
x y : A ⊗[R] Matrix n n R
hx : invFun R A n ((toFunAlgHom R A n) x) = x
hy : invFun R A n ((toFunAlgHom R A n) y) = y
⊢ invFun R A n ((toFunAlgHom R A n) (x + y)) = x + y

Next tactic:
rw [map_add]
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
  induction M using TensorProduct.induction_on with
  | zero => simp
  | tmul a m => simp
  | add x y hx hy =>
    rw [map_add]
    

Proof state:
case add
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
x y : A ⊗[R] Matrix n n R
hx : invFun R A n ((toFunAlgHom R A n) x) = x
hy : invFun R A n ((toFunAlgHom R A n) y) = y
⊢ invFun R A n ((toFunAlgHom R A n) x + (toFunAlgHom R A n) y) = x + y

Next tactic:
conv_rhs => rw [← hx, ← hy, ← invFun_add]
theorem left_inv (M : A ⊗[R] Matrix n n R) : invFun R A n (toFunAlgHom R A n M) = M := by
  induction M using TensorProduct.induction_on with
  | zero => simp
  | tmul a m => simp
  | add x y hx hy =>
    rw [map_add]
    conv_rhs => 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : DecidableEq n
inst✝ : Fintype n
x y : A ⊗[R] Matrix n n R
hx : invFun R A n ((toFunAlgHom R A n) x) = x
hy : invFun R A n ((toFunAlgHom R A n) y) = y
| x + y

Next tactic:
rw [← hx, ← hy, ← invFun_add]
@[simp (high)]
theorem matrixEquivTensor_apply_std_basis (i j : n) (x : A) :
    matrixEquivTensor R A n (stdBasisMatrix i j x) = x ⊗ₜ stdBasisMatrix i j 1 := by
  

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : Fintype n
inst✝ : DecidableEq n
i j : n
x : A
⊢ (matrixEquivTensor R A n) (stdBasisMatrix i j x) = x ⊗ₜ[R] stdBasisMatrix i j 1

Next tactic:
have t : ∀ p : n × n, i = p.1 ∧ j = p.2 ↔ p = (i, j) := by aesop
@[simp (high)]
theorem matrixEquivTensor_apply_std_basis (i j : n) (x : A) :
    matrixEquivTensor R A n (stdBasisMatrix i j x) = x ⊗ₜ stdBasisMatrix i j 1 := by
  have t : ∀ p : n × n, i = p.1 ∧ j = p.2 ↔ p = (i, j) := by 

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : Fintype n
inst✝ : DecidableEq n
i j : n
x : A
⊢ ∀ (p : n × n), i = p.1 ∧ j = p.2 ↔ p = (i, j)

Next tactic:
aesop
@[simp (high)]
theorem matrixEquivTensor_apply_std_basis (i j : n) (x : A) :
    matrixEquivTensor R A n (stdBasisMatrix i j x) = x ⊗ₜ stdBasisMatrix i j 1 := by
  have t : ∀ p : n × n, i = p.1 ∧ j = p.2 ↔ p = (i, j) := by aesop
  

Proof state:
R : Type u
inst✝⁴ : CommSemiring R
A : Type v
inst✝³ : Semiring A
inst✝² : Algebra R A
n : Type w
inst✝¹ : Fintype n
inst✝ : DecidableEq n
i j : n
x : A
t : ∀ (p : n × n), i = p.1 ∧ j = p.2 ↔ p = (i, j)
⊢ (matrixEquivTensor R A n) (stdBasisMatrix i j x) = x ⊗ₜ[R] stdBasisMatrix i j 1

Next tactic:
simp [ite_tmul, t, stdBasisMatrix]
private theorem q {hs : MeasurableSet s} {hμs : μ s ≠ ∞} {x : G} :
    Memℒp (condexpIndSMul hm hs hμs x) 1 μ := by
  

Proof state:
α : Type u_1
β : Type u_2
F : Type u_3
F' : Type u_4
G : Type u_5
G' : Type u_6
𝕜 : Type u_7
p : ℝ≥0∞
inst✝¹² : IsROrC 𝕜
inst✝¹¹ : NormedAddCommGroup F
inst✝¹⁰ : NormedSpace 𝕜 F
inst✝⁹ : NormedAddCommGroup F'
inst✝⁸ : NormedSpace 𝕜 F'
inst✝⁷ : NormedSpace ℝ F'
inst✝⁶ : CompleteSpace F'
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : NormedAddCommGroup G'
inst✝³ : NormedSpace ℝ G'
inst✝² : CompleteSpace G'
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
inst✝¹ : NormedSpace ℝ G
hm : m ≤ m0
inst✝ : SigmaFinite (Measure.trim μ hm)
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
x : G
⊢ Memℒp (↑↑(condexpIndSMul hm hs hμs x)) 1

Next tactic:
rw [memℒp_one_iff_integrable]
private theorem q {hs : MeasurableSet s} {hμs : μ s ≠ ∞} {x : G} :
    Memℒp (condexpIndSMul hm hs hμs x) 1 μ := by
  rw [memℒp_one_iff_integrable]; 

Proof state:
α : Type u_1
β : Type u_2
F : Type u_3
F' : Type u_4
G : Type u_5
G' : Type u_6
𝕜 : Type u_7
p : ℝ≥0∞
inst✝¹² : IsROrC 𝕜
inst✝¹¹ : NormedAddCommGroup F
inst✝¹⁰ : NormedSpace 𝕜 F
inst✝⁹ : NormedAddCommGroup F'
inst✝⁸ : NormedSpace 𝕜 F'
inst✝⁷ : NormedSpace ℝ F'
inst✝⁶ : CompleteSpace F'
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : NormedAddCommGroup G'
inst✝³ : NormedSpace ℝ G'
inst✝² : CompleteSpace G'
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
inst✝¹ : NormedSpace ℝ G
hm : m ≤ m0
inst✝ : SigmaFinite (Measure.trim μ hm)
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
x : G
⊢ Integrable ↑↑(condexpIndSMul hm hs hμs x)

Next tactic:
apply integrable_condexpIndSMul
theorem condexpIndL1Fin_add (hs : MeasurableSet s) (hμs : μ s ≠ ∞) (x y : G) :
    condexpIndL1Fin hm hs hμs (x + y) =
    condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y := by
  

Proof state:
α : Type u_1
β : Type u_2
F : Type u_3
F' : Type u_4
G : Type u_5
G' : Type u_6
𝕜 : Type u_7
p : ℝ≥0∞
inst✝¹² : IsROrC 𝕜
inst✝¹¹ : NormedAddCommGroup F
inst✝¹⁰ : NormedSpace 𝕜 F
inst✝⁹ : NormedAddCommGroup F'
inst✝⁸ : NormedSpace 𝕜 F'
inst✝⁷ : NormedSpace ℝ F'
inst✝⁶ : CompleteSpace F'
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : NormedAddCommGroup G'
inst✝³ : NormedSpace ℝ G'
inst✝² : CompleteSpace G'
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
inst✝¹ : NormedSpace ℝ G
hm : m ≤ m0
inst✝ : SigmaFinite (Measure.trim μ hm)
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
x y : G
⊢ condexpIndL1Fin hm hs hμs (x + y) = condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y

Next tactic:
ext1
theorem condexpIndL1Fin_add (hs : MeasurableSet s) (hμs : μ s ≠ ∞) (x y : G) :
    condexpIndL1Fin hm hs hμs (x + y) =
    condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y := by
  ext1
  

Proof state:
case h
α : Type u_1
β : Type u_2
F : Type u_3
F' : Type u_4
G : Type u_5
G' : Type u_6
𝕜 : Type u_7
p : ℝ≥0∞
inst✝¹² : IsROrC 𝕜
inst✝¹¹ : NormedAddCommGroup F
inst✝¹⁰ : NormedSpace 𝕜 F
inst✝⁹ : NormedAddCommGroup F'
inst✝⁸ : NormedSpace 𝕜 F'
inst✝⁷ : NormedSpace ℝ F'
inst✝⁶ : CompleteSpace F'
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : NormedAddCommGroup G'
inst✝³ : NormedSpace ℝ G'
inst✝² : CompleteSpace G'
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
inst✝¹ : NormedSpace ℝ G
hm : m ≤ m0
inst✝ : SigmaFinite (Measure.trim μ hm)
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
x y : G
⊢ ↑↑(condexpIndL1Fin hm hs hμs (x + y)) =ᵐ[μ] ↑↑(condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y)

Next tactic:
refine' (Memℒp.coeFn_toLp q).trans _
theorem condexpIndL1Fin_add (hs : MeasurableSet s) (hμs : μ s ≠ ∞) (x y : G) :
    condexpIndL1Fin hm hs hμs (x + y) =
    condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y := by
  ext1
  refine' (Memℒp.coeFn_toLp q).trans _
  

Proof state:
case h
α : Type u_1
β : Type u_2
F : Type u_3
F' : Type u_4
G : Type u_5
G' : Type u_6
𝕜 : Type u_7
p : ℝ≥0∞
inst✝¹² : IsROrC 𝕜
inst✝¹¹ : NormedAddCommGroup F
inst✝¹⁰ : NormedSpace 𝕜 F
inst✝⁹ : NormedAddCommGroup F'
inst✝⁸ : NormedSpace 𝕜 F'
inst✝⁷ : NormedSpace ℝ F'
inst✝⁶ : CompleteSpace F'
inst✝⁵ : NormedAddCommGroup G
inst✝⁴ : NormedAddCommGroup G'
inst✝³ : NormedSpace ℝ G'
inst✝² : CompleteSpace G'
m m0 : MeasurableSpace α
μ : Measure α
s t : Set α
inst✝¹ : NormedSpace ℝ G
hm : m ≤ m0
inst✝ : SigmaFinite (Measure.trim μ hm)
hs : MeasurableSet s
hμs : ↑↑μ s ≠ ⊤
x y : G
⊢ ↑↑(condexpIndSMul hm hs hμs (x + y)) =ᵐ[μ] ↑↑(condexpIndL1Fin hm hs hμs x + condexpIndL1Fin hm hs hμs y)

Next tactic:
refine' EventuallyEq.trans _ (Lp.coeFn_add _ _).symm