openAI-math-dataset / lean /OAI /Geometry /PrescribedRicci /CalabiTensorAlgebra.lean
roseking's picture
Add lean source and binary files (part 71)
2fca478 verified
Raw History Blame Contribute Delete
3 kB
13
abbrev TensorIndex (n : Type*) := n × (n × n)
15
def tensor3 (L U V : Matrix n n ℂ) : Matrix (TensorIndex n) (TensorIndex n) ℂ :=
body · 1 line
  L ⊗ₖ (U ⊗ₖ V)
19
lemma tensor3_apply (L U V : Matrix n n ℂ) (i j : TensorIndex n) :
    tensor3 L U V i j = L i.1 j.1*(U i.2.1 j.2.1*V i.2.2 j.2.2) := rfl
23
lemma tensor3_mul (L U V L' U' V' : Matrix n n ℂ) :
    tensor3 L U V*tensor3 L' U' V' = tensor3 (L*L') (U*U') (V*V') := by
proof · 1 line
  simp only [tensor3,← Matrix.mul_kronecker_mul]
28
lemma tensor3_one : tensor3 (1 : Matrix n n ℂ) 1 1 = 1 := by
proof · 1 line
  simp only [tensor3,Matrix.one_kronecker_one]
31
lemma tensor3_mulVec_left (L : Matrix n n ℂ) (T : TensorIndex n → ℂ) (a k j : n) :
    (tensor3 L 1 1*ᵥ T) (a,k,j) = ∑ v, L a v*T (v,k,j) := by
proof · 3 lines
  classical
  simp [Matrix.mulVec,dotProduct,Fintype.sum_prod_type,tensor3_apply,
    Matrix.one_apply,mul_ite,ite_mul]
37
lemma tensor3_mulVec_middle (U : Matrix n n ℂ) (T : TensorIndex n → ℂ) (a k j : n) :
    (tensor3 1 U 1*ᵥ T) (a,k,j) = ∑ v, U k v*T (a,v,j) := by
proof · 3 lines
  classical
  simp [Matrix.mulVec,dotProduct,Fintype.sum_prod_type,tensor3_apply,
    Matrix.one_apply,mul_ite,ite_mul]
43
lemma tensor3_mulVec_right (V : Matrix n n ℂ) (T : TensorIndex n → ℂ) (a k j : n) :
    (tensor3 1 1 V*ᵥ T) (a,k,j) = ∑ v, V j v*T (a,k,v) := by
proof · 3 lines
  classical
  simp [Matrix.mulVec,dotProduct,Fintype.sum_prod_type,tensor3_apply,
    Matrix.one_apply,mul_ite,ite_mul]
49
def tensorMetric (H : Matrix n n ℂ) : Matrix (TensorIndex n) (TensorIndex n) ℂ :=
body · 1 line
  tensor3 H⁻¹.transpose H H⁻¹.transpose
52
def tensorConnection (G : Matrix n n ℂ) : Matrix (TensorIndex n) (TensorIndex n) ℂ :=
body · 1 line
  tensor3 (-G.transpose) 1 1+tensor3 1 G 1+tensor3 1 1 (-G.transpose)
55
lemma tensorMetric_posDef {H : Matrix n n ℂ} (hH : H.PosDef) : (tensorMetric H).PosDef :=
proof · 1 line
  hH.inv.transpose.kronecker (hH.kronecker hH.inv.transpose)
58
lemma tensorConnection_mulVec (G : Matrix n n ℂ) (T : TensorIndex n → ℂ) (a k j : n) :
    (tensorConnection G*ᵥ T) (a,k,j) = ∑ v, G k v*T (a,v,j)-
      (∑ v, G v a*T (v,k,j))-(∑ v, G v j*T (a,k,v)) := by
proof · 4 lines
  simp only [tensorConnection,Matrix.add_mulVec,Pi.add_apply,tensor3_mulVec_left,
    tensor3_mulVec_middle,tensor3_mulVec_right,Matrix.neg_apply,Matrix.transpose_apply,
    neg_mul,Finset.sum_neg_distrib]
  ring
66
lemma tensorMetric_mul_connection (H G : Matrix n n ℂ) :
    tensorMetric H*tensorConnection G =
      tensor3 (H⁻¹.transpose*(-G.transpose)) H H⁻¹.transpose+
      tensor3 H⁻¹.transpose (H*G) H⁻¹.transpose+
      tensor3 H⁻¹.transpose H (H⁻¹.transpose*(-G.transpose)) := by
proof · 1 line
  simp only [tensorMetric,tensorConnection,Matrix.mul_add,tensor3_mul,mul_one]