Skip to content

Commit

Permalink
feat (Data/Matrix/Basic): Matrix versions of neg_mul_neg (#12901)
Browse files Browse the repository at this point in the history
  • Loading branch information
madvorak authored and callesonne committed Jun 4, 2024
1 parent 4b2b56d commit b762514
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Mathlib/Data/Matrix/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,9 @@ theorem neg_dotProduct : -v ⬝ᵥ w = -(v ⬝ᵥ w) := by simp [dotProduct]
theorem dotProduct_neg : v ⬝ᵥ -w = -(v ⬝ᵥ w) := by simp [dotProduct]
#align matrix.dot_product_neg Matrix.dotProduct_neg

lemma neg_dotProduct_neg : -v ⬝ᵥ -w = v ⬝ᵥ w := by
rw [neg_dotProduct, dotProduct_neg, neg_neg]

@[simp]
theorem sub_dotProduct : (u - v) ⬝ᵥ w = u ⬝ᵥ w - v ⬝ᵥ w := by simp [sub_eq_add_neg]
#align matrix.sub_dot_product Matrix.sub_dotProduct
Expand Down Expand Up @@ -1944,6 +1947,9 @@ theorem vecMul_neg [Fintype m] (v : m → α) (A : Matrix m n α) : v ᵥ* (-A)
apply dotProduct_neg
#align matrix.vec_mul_neg Matrix.vecMul_neg

lemma neg_vecMul_neg [Fintype m] (v : m → α) (A : Matrix m n α) : (-v) ᵥ* (-A) = v ᵥ* A := by
rw [vecMul_neg, neg_vecMul, neg_neg]

theorem neg_mulVec [Fintype n] (v : n → α) (A : Matrix m n α) : (-A) *ᵥ v = - (A *ᵥ v) := by
ext
apply neg_dotProduct
Expand All @@ -1954,6 +1960,9 @@ theorem mulVec_neg [Fintype n] (v : n → α) (A : Matrix m n α) : A *ᵥ (-v)
apply dotProduct_neg
#align matrix.mul_vec_neg Matrix.mulVec_neg

lemma neg_mulVec_neg [Fintype n] (v : n → α) (A : Matrix m n α) : (-A) *ᵥ (-v) = A *ᵥ v := by
rw [mulVec_neg, neg_mulVec, neg_neg]

theorem mulVec_sub [Fintype n] (A : Matrix m n α) (x y : n → α) :
A *ᵥ (x - y) = A *ᵥ x - A *ᵥ y := by
ext
Expand Down

0 comments on commit b762514

Please sign in to comment.