data.matrix.reflection
⟷
Mathlib.Data.Matrix.Reflection
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2022 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-/
-import Mathbin.Data.Matrix.Notation
-import Mathbin.Data.Matrix.Basic
-import Mathbin.Data.Fin.Tuple.Reflection
+import Data.Matrix.Notation
+import Data.Matrix.Basic
+import Data.Fin.Tuple.Reflection
#align_import data.matrix.reflection from "leanprover-community/mathlib"@"86d1873c01a723aba6788f0b9051ae3d23b4c1c3"
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -178,7 +178,7 @@ example [add_comm_monoid α] [has_mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁
theorem mulᵣ_eq [Mul α] [AddCommMonoid α] (A : Matrix (Fin l) (Fin m) α)
(B : Matrix (Fin m) (Fin n) α) : mulᵣ A B = A.mul B :=
by
- simp [mulᵣ, Function.comp, Matrix.mul, Matrix.transpose]
+ simp [mulᵣ, Function.comp, HMul.hMul, Matrix.transpose]
rfl
#align matrix.mulᵣ_eq Matrix.mulᵣ_eq
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2022 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-
-! This file was ported from Lean 3 source module data.matrix.reflection
-! leanprover-community/mathlib commit 86d1873c01a723aba6788f0b9051ae3d23b4c1c3
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Matrix.Notation
import Mathbin.Data.Matrix.Basic
import Mathbin.Data.Fin.Tuple.Reflection
+#align_import data.matrix.reflection from "leanprover-community/mathlib"@"86d1873c01a723aba6788f0b9051ae3d23b4c1c3"
+
/-!
# Lemmas for concrete matrices `matrix (fin m) (fin n) α`
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -139,6 +139,7 @@ def dotProductᵣ [Mul α] [Add α] [Zero α] {m} (a b : Fin m → α) : α :=
#align matrix.dot_productᵣ Matrix.dotProductᵣ
-/
+#print Matrix.dotProductᵣ_eq /-
/-- This can be used to prove
```lean
example (a b c d : α) [has_mul α] [add_comm_monoid α] :
@@ -151,6 +152,7 @@ theorem dotProductᵣ_eq [Mul α] [AddCommMonoid α] {m} (a b : Fin m → α) :
dotProductᵣ a b = dotProduct a b := by
simp_rw [dot_productᵣ, dot_product, FinVec.sum_eq, FinVec.seq_eq, FinVec.map_eq]
#align matrix.dot_productᵣ_eq Matrix.dotProductᵣ_eq
+-/
example (a b c d : α) [Mul α] [AddCommMonoid α] : dotProduct ![a, b] ![c, d] = a * c + b * d :=
(dotProductᵣ_eq _ _).symm
@@ -163,6 +165,7 @@ def mulᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (B : Matr
#align matrix.mulᵣ Matrix.mulᵣ
-/
+#print Matrix.mulᵣ_eq /-
/-- This can be used to prove
```lean
example [add_comm_monoid α] [has_mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
@@ -181,6 +184,7 @@ theorem mulᵣ_eq [Mul α] [AddCommMonoid α] (A : Matrix (Fin l) (Fin m) α)
simp [mulᵣ, Function.comp, Matrix.mul, Matrix.transpose]
rfl
#align matrix.mulᵣ_eq Matrix.mulᵣ_eq
+-/
example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
!![a₁₁, a₁₂; a₂₁, a₂₂].mul !![b₁₁, b₁₂; b₂₁, b₂₂] =
@@ -195,6 +199,7 @@ def mulVecᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (v : F
#align matrix.mul_vecᵣ Matrix.mulVecᵣ
-/
+#print Matrix.mulVecᵣ_eq /-
/-- This can be used to prove
```lean
example [non_unital_non_assoc_semiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
@@ -209,6 +214,7 @@ theorem mulVecᵣ_eq [NonUnitalNonAssocSemiring α] (A : Matrix (Fin l) (Fin m)
simp [mul_vecᵣ, Function.comp]
rfl
#align matrix.mul_vecᵣ_eq Matrix.mulVecᵣ_eq
+-/
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
!![a₁₁, a₁₂; a₂₁, a₂₂].mulVec ![b₁, b₂] = ![a₁₁ * b₁ + a₁₂ * b₂, a₂₁ * b₁ + a₂₂ * b₂] :=
@@ -221,6 +227,7 @@ def vecMulᵣ [Mul α] [Add α] [Zero α] (v : Fin l → α) (A : Matrix (Fin l)
#align matrix.vec_mulᵣ Matrix.vecMulᵣ
-/
+#print Matrix.vecMulᵣ_eq /-
/-- This can be used to prove
```lean
example [non_unital_non_assoc_semiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
@@ -235,6 +242,7 @@ theorem vecMulᵣ_eq [NonUnitalNonAssocSemiring α] (v : Fin l → α) (A : Matr
simp [vec_mulᵣ, Function.comp]
rfl
#align matrix.vec_mulᵣ_eq Matrix.vecMulᵣ_eq
+-/
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
vecMul ![b₁, b₂] !![a₁₁, a₁₂; a₂₁, a₂₂] = ![b₁ * a₁₁ + b₂ * a₂₁, b₁ * a₁₂ + b₂ * a₂₂] :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -40,7 +40,7 @@ corresponding `*_eq` lemmas to be used in a place where they are definitionally
-/
-open Matrix
+open scoped Matrix
namespace Matrix
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -139,12 +139,6 @@ def dotProductᵣ [Mul α] [Add α] [Zero α] {m} (a b : Fin m → α) : α :=
#align matrix.dot_productᵣ Matrix.dotProductᵣ
-/
-/- warning: matrix.dot_productᵣ_eq -> Matrix.dotProductᵣ_eq is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Mul.{u1} α] [_inst_2 : AddCommMonoid.{u1} α] {m : Nat} (a : (Fin m) -> α) (b : (Fin m) -> α), Eq.{succ u1} α (Matrix.dotProductᵣ.{u1} α _inst_1 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) m a b) (Matrix.dotProduct.{u1, 0} (Fin m) α (Fin.fintype m) _inst_1 _inst_2 a b)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Mul.{u1} α] [_inst_2 : AddCommMonoid.{u1} α] {m : Nat} (a : (Fin m) -> α) (b : (Fin m) -> α), Eq.{succ u1} α (Matrix.dotProductᵣ.{u1} α _inst_1 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) (AddMonoid.toZero.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2)) m a b) (Matrix.dotProduct.{u1, 0} (Fin m) α (Fin.fintype m) _inst_1 _inst_2 a b)
-Case conversion may be inaccurate. Consider using '#align matrix.dot_productᵣ_eq Matrix.dotProductᵣ_eqₓ'. -/
/-- This can be used to prove
```lean
example (a b c d : α) [has_mul α] [add_comm_monoid α] :
@@ -169,12 +163,6 @@ def mulᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (B : Matr
#align matrix.mulᵣ Matrix.mulᵣ
-/
-/- warning: matrix.mulᵣ_eq -> Matrix.mulᵣ_eq is a dubious translation:
-lean 3 declaration is
- forall {l : Nat} {m : Nat} {n : Nat} {α : Type.{u1}} [_inst_1 : Mul.{u1} α] [_inst_2 : AddCommMonoid.{u1} α] (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α) (B : Matrix.{0, 0, u1} (Fin m) (Fin n) α), Eq.{succ u1} (Matrix.{0, 0, u1} (Fin l) (Fin n) α) (Matrix.mulᵣ.{u1} l m n α _inst_1 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) A B) (Matrix.mul.{u1, 0, 0, 0} (Fin l) (Fin m) (Fin n) α (Fin.fintype m) _inst_1 _inst_2 A B)
-but is expected to have type
- forall {l : Nat} {m : Nat} {n : Nat} {α : Type.{u1}} [_inst_1 : Mul.{u1} α] [_inst_2 : AddCommMonoid.{u1} α] (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α) (B : Matrix.{0, 0, u1} (Fin m) (Fin n) α), Eq.{succ u1} (Matrix.{0, 0, u1} (Fin l) (Fin n) α) (Matrix.mulᵣ.{u1} l m n α _inst_1 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) (AddMonoid.toZero.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2)) A B) (Matrix.mul.{u1, 0, 0, 0} (Fin l) (Fin m) (Fin n) α (Fin.fintype m) _inst_1 _inst_2 A B)
-Case conversion may be inaccurate. Consider using '#align matrix.mulᵣ_eq Matrix.mulᵣ_eqₓ'. -/
/-- This can be used to prove
```lean
example [add_comm_monoid α] [has_mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
@@ -207,12 +195,6 @@ def mulVecᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (v : F
#align matrix.mul_vecᵣ Matrix.mulVecᵣ
-/
-/- warning: matrix.mul_vecᵣ_eq -> Matrix.mulVecᵣ_eq is a dubious translation:
-lean 3 declaration is
- forall {l : Nat} {m : Nat} {α : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} α] (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α) (v : (Fin m) -> α), Eq.{succ u1} ((Fin l) -> α) (Matrix.mulVecᵣ.{u1} l m α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α _inst_1)) A v) (Matrix.mulVec.{u1, 0, 0} (Fin l) (Fin m) α _inst_1 (Fin.fintype m) A v)
-but is expected to have type
- forall {l : Nat} {m : Nat} {α : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} α] (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α) (v : (Fin m) -> α), Eq.{succ u1} ((Fin l) -> α) (Matrix.mulVecᵣ.{u1} l m α (NonUnitalNonAssocSemiring.toMul.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (MulZeroClass.toZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α _inst_1)) A v) (Matrix.mulVec.{u1, 0, 0} (Fin l) (Fin m) α _inst_1 (Fin.fintype m) A v)
-Case conversion may be inaccurate. Consider using '#align matrix.mul_vecᵣ_eq Matrix.mulVecᵣ_eqₓ'. -/
/-- This can be used to prove
```lean
example [non_unital_non_assoc_semiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
@@ -239,12 +221,6 @@ def vecMulᵣ [Mul α] [Add α] [Zero α] (v : Fin l → α) (A : Matrix (Fin l)
#align matrix.vec_mulᵣ Matrix.vecMulᵣ
-/
-/- warning: matrix.vec_mulᵣ_eq -> Matrix.vecMulᵣ_eq is a dubious translation:
-lean 3 declaration is
- forall {l : Nat} {m : Nat} {α : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} α] (v : (Fin l) -> α) (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α), Eq.{succ u1} ((Fin m) -> α) (Matrix.vecMulᵣ.{u1} l m α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α _inst_1)) v A) (Matrix.vecMul.{u1, 0, 0} (Fin l) (Fin m) α _inst_1 (Fin.fintype l) v A)
-but is expected to have type
- forall {l : Nat} {m : Nat} {α : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} α] (v : (Fin l) -> α) (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α), Eq.{succ u1} ((Fin m) -> α) (Matrix.vecMulᵣ.{u1} l m α (NonUnitalNonAssocSemiring.toMul.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (MulZeroClass.toZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α _inst_1)) v A) (Matrix.vecMul.{u1, 0, 0} (Fin l) (Fin m) α _inst_1 (Fin.fintype l) v A)
-Case conversion may be inaccurate. Consider using '#align matrix.vec_mulᵣ_eq Matrix.vecMulᵣ_eqₓ'. -/
/-- This can be used to prove
```lean
example [non_unital_non_assoc_semiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -124,10 +124,8 @@ theorem transposeᵣ_eq : ∀ {m n} (A : Matrix (Fin m) (Fin n) α), transpose
Matrix.ext fun i j => by
simp_rw [transposeᵣ, transposeᵣ_eq]
refine' i.cases _ fun i => _
- · dsimp
- rw [FinVec.map_eq]
- · simp only [of_apply, Matrix.cons_val_succ]
- rfl
+ · dsimp; rw [FinVec.map_eq]
+ · simp only [of_apply, Matrix.cons_val_succ]; rfl
#align matrix.transposeᵣ_eq Matrix.transposeᵣ_eq
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/52932b3a083d4142e78a15dc928084a22fea9ba0
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
! This file was ported from Lean 3 source module data.matrix.reflection
-! leanprover-community/mathlib commit 820b22968a2bc4a47ce5cf1d2f36a9ebe52510aa
+! leanprover-community/mathlib commit 86d1873c01a723aba6788f0b9051ae3d23b4c1c3
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -15,6 +15,9 @@ import Mathbin.Data.Fin.Tuple.Reflection
/-!
# Lemmas for concrete matrices `matrix (fin m) (fin n) α`
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
This file contains alternative definitions of common operators on matrices that expand
definitionally to the expected expression when evaluated on `!![]` notation.
mathlib commit https://github.com/leanprover-community/mathlib/commit/730c6d4cab72b9d84fcfb9e95e8796e9cd8f40ba
@@ -43,12 +43,15 @@ namespace Matrix
variable {l m n : ℕ} {α β : Type _}
+#print Matrix.Forall /-
/-- `∀` with better defeq for `∀ x : matrix (fin m) (fin n) α, P x`. -/
def Forall : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Prop
| 0, n, P => P (of ![])
| m + 1, n, P => FinVec.Forall fun r => forall fun A => P (of (Matrix.vecCons r A))
#align matrix.forall Matrix.Forall
+-/
+#print Matrix.forall_iff /-
/-- This can be use to prove
```lean
example (P : matrix (fin 2) (fin 3) α → Prop) :
@@ -62,17 +65,21 @@ theorem forall_iff : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Forall
simp only [forall, FinVec.forall_iff, forall_iff]
exact Iff.symm Fin.forall_fin_succ_pi
#align matrix.forall_iff Matrix.forall_iff
+-/
example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
(∀ x, P x) ↔ ∀ a b c d e f, P !![a, b, c; d, e, f] :=
(forall_iff _).symm
+#print Matrix.Exists /-
/-- `∃` with better defeq for `∃ x : matrix (fin m) (fin n) α, P x`. -/
def Exists : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Prop
| 0, n, P => P (of ![])
| m + 1, n, P => FinVec.Exists fun r => exists fun A => P (of (Matrix.vecCons r A))
#align matrix.exists Matrix.Exists
+-/
+#print Matrix.exists_iff /-
/-- This can be use to prove
```lean
example (P : matrix (fin 2) (fin 3) α → Prop) :
@@ -86,18 +93,22 @@ theorem exists_iff : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Exists
simp only [exists, FinVec.exists_iff, exists_iff]
exact Iff.symm Fin.exists_fin_succ_pi
#align matrix.exists_iff Matrix.exists_iff
+-/
example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
(∃ x, P x) ↔ ∃ a b c d e f, P !![a, b, c; d, e, f] :=
(exists_iff _).symm
+#print Matrix.transposeᵣ /-
/-- `matrix.tranpose` with better defeq for `fin` -/
def transposeᵣ : ∀ {m n}, Matrix (Fin m) (Fin n) α → Matrix (Fin n) (Fin m) α
| _, 0, A => of ![]
| m, n + 1, A =>
of <| vecCons (FinVec.map (fun v : Fin _ → α => v 0) A) (transposeᵣ (A.submatrix id Fin.succ))
#align matrix.transposeᵣ Matrix.transposeᵣ
+-/
+#print Matrix.transposeᵣ_eq /-
/-- This can be used to prove
```lean
example (a b c d : α) : transpose !![a, b; c, d] = !![a, c; b, d] := (transposeᵣ_eq _).symm
@@ -115,15 +126,24 @@ theorem transposeᵣ_eq : ∀ {m n} (A : Matrix (Fin m) (Fin n) α), transpose
· simp only [of_apply, Matrix.cons_val_succ]
rfl
#align matrix.transposeᵣ_eq Matrix.transposeᵣ_eq
+-/
example (a b c d : α) : transpose !![a, b; c, d] = !![a, c; b, d] :=
(transposeᵣ_eq _).symm
+#print Matrix.dotProductᵣ /-
/-- `matrix.dot_product` with better defeq for `fin` -/
def dotProductᵣ [Mul α] [Add α] [Zero α] {m} (a b : Fin m → α) : α :=
FinVec.sum <| FinVec.seq (FinVec.map (· * ·) a) b
#align matrix.dot_productᵣ Matrix.dotProductᵣ
+-/
+/- warning: matrix.dot_productᵣ_eq -> Matrix.dotProductᵣ_eq is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Mul.{u1} α] [_inst_2 : AddCommMonoid.{u1} α] {m : Nat} (a : (Fin m) -> α) (b : (Fin m) -> α), Eq.{succ u1} α (Matrix.dotProductᵣ.{u1} α _inst_1 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) m a b) (Matrix.dotProduct.{u1, 0} (Fin m) α (Fin.fintype m) _inst_1 _inst_2 a b)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Mul.{u1} α] [_inst_2 : AddCommMonoid.{u1} α] {m : Nat} (a : (Fin m) -> α) (b : (Fin m) -> α), Eq.{succ u1} α (Matrix.dotProductᵣ.{u1} α _inst_1 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) (AddMonoid.toZero.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2)) m a b) (Matrix.dotProduct.{u1, 0} (Fin m) α (Fin.fintype m) _inst_1 _inst_2 a b)
+Case conversion may be inaccurate. Consider using '#align matrix.dot_productᵣ_eq Matrix.dotProductᵣ_eqₓ'. -/
/-- This can be used to prove
```lean
example (a b c d : α) [has_mul α] [add_comm_monoid α] :
@@ -140,12 +160,20 @@ theorem dotProductᵣ_eq [Mul α] [AddCommMonoid α] {m} (a b : Fin m → α) :
example (a b c d : α) [Mul α] [AddCommMonoid α] : dotProduct ![a, b] ![c, d] = a * c + b * d :=
(dotProductᵣ_eq _ _).symm
+#print Matrix.mulᵣ /-
/-- `matrix.mul` with better defeq for `fin` -/
def mulᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (B : Matrix (Fin m) (Fin n) α) :
Matrix (Fin l) (Fin n) α :=
of <| FinVec.map (fun v₁ => FinVec.map (fun v₂ => dotProductᵣ v₁ v₂) Bᵀ) A
#align matrix.mulᵣ Matrix.mulᵣ
+-/
+/- warning: matrix.mulᵣ_eq -> Matrix.mulᵣ_eq is a dubious translation:
+lean 3 declaration is
+ forall {l : Nat} {m : Nat} {n : Nat} {α : Type.{u1}} [_inst_1 : Mul.{u1} α] [_inst_2 : AddCommMonoid.{u1} α] (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α) (B : Matrix.{0, 0, u1} (Fin m) (Fin n) α), Eq.{succ u1} (Matrix.{0, 0, u1} (Fin l) (Fin n) α) (Matrix.mulᵣ.{u1} l m n α _inst_1 (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) A B) (Matrix.mul.{u1, 0, 0, 0} (Fin l) (Fin m) (Fin n) α (Fin.fintype m) _inst_1 _inst_2 A B)
+but is expected to have type
+ forall {l : Nat} {m : Nat} {n : Nat} {α : Type.{u1}} [_inst_1 : Mul.{u1} α] [_inst_2 : AddCommMonoid.{u1} α] (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α) (B : Matrix.{0, 0, u1} (Fin m) (Fin n) α), Eq.{succ u1} (Matrix.{0, 0, u1} (Fin l) (Fin n) α) (Matrix.mulᵣ.{u1} l m n α _inst_1 (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2))) (AddMonoid.toZero.{u1} α (AddCommMonoid.toAddMonoid.{u1} α _inst_2)) A B) (Matrix.mul.{u1, 0, 0, 0} (Fin l) (Fin m) (Fin n) α (Fin.fintype m) _inst_1 _inst_2 A B)
+Case conversion may be inaccurate. Consider using '#align matrix.mulᵣ_eq Matrix.mulᵣ_eqₓ'. -/
/-- This can be used to prove
```lean
example [add_comm_monoid α] [has_mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
@@ -171,11 +199,19 @@ example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b
a₂₁ * b₁₁ + a₂₂ * b₂₁, a₂₁ * b₁₂ + a₂₂ * b₂₂] :=
(mulᵣ_eq _ _).symm
+#print Matrix.mulVecᵣ /-
/-- `matrix.mul_vec` with better defeq for `fin` -/
def mulVecᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (v : Fin m → α) : Fin l → α :=
FinVec.map (fun a => dotProductᵣ a v) A
#align matrix.mul_vecᵣ Matrix.mulVecᵣ
+-/
+/- warning: matrix.mul_vecᵣ_eq -> Matrix.mulVecᵣ_eq is a dubious translation:
+lean 3 declaration is
+ forall {l : Nat} {m : Nat} {α : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} α] (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α) (v : (Fin m) -> α), Eq.{succ u1} ((Fin l) -> α) (Matrix.mulVecᵣ.{u1} l m α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α _inst_1)) A v) (Matrix.mulVec.{u1, 0, 0} (Fin l) (Fin m) α _inst_1 (Fin.fintype m) A v)
+but is expected to have type
+ forall {l : Nat} {m : Nat} {α : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} α] (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α) (v : (Fin m) -> α), Eq.{succ u1} ((Fin l) -> α) (Matrix.mulVecᵣ.{u1} l m α (NonUnitalNonAssocSemiring.toMul.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (MulZeroClass.toZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α _inst_1)) A v) (Matrix.mulVec.{u1, 0, 0} (Fin l) (Fin m) α _inst_1 (Fin.fintype m) A v)
+Case conversion may be inaccurate. Consider using '#align matrix.mul_vecᵣ_eq Matrix.mulVecᵣ_eqₓ'. -/
/-- This can be used to prove
```lean
example [non_unital_non_assoc_semiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
@@ -195,11 +231,19 @@ example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b
!![a₁₁, a₁₂; a₂₁, a₂₂].mulVec ![b₁, b₂] = ![a₁₁ * b₁ + a₁₂ * b₂, a₂₁ * b₁ + a₂₂ * b₂] :=
(mulVecᵣ_eq _ _).symm
+#print Matrix.vecMulᵣ /-
/-- `matrix.vec_mul` with better defeq for `fin` -/
def vecMulᵣ [Mul α] [Add α] [Zero α] (v : Fin l → α) (A : Matrix (Fin l) (Fin m) α) : Fin m → α :=
FinVec.map (fun a => dotProductᵣ v a) Aᵀ
#align matrix.vec_mulᵣ Matrix.vecMulᵣ
+-/
+/- warning: matrix.vec_mulᵣ_eq -> Matrix.vecMulᵣ_eq is a dubious translation:
+lean 3 declaration is
+ forall {l : Nat} {m : Nat} {α : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} α] (v : (Fin l) -> α) (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α), Eq.{succ u1} ((Fin m) -> α) (Matrix.vecMulᵣ.{u1} l m α (Distrib.toHasMul.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (Distrib.toHasAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (MulZeroClass.toHasZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α _inst_1)) v A) (Matrix.vecMul.{u1, 0, 0} (Fin l) (Fin m) α _inst_1 (Fin.fintype l) v A)
+but is expected to have type
+ forall {l : Nat} {m : Nat} {α : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} α] (v : (Fin l) -> α) (A : Matrix.{0, 0, u1} (Fin l) (Fin m) α), Eq.{succ u1} ((Fin m) -> α) (Matrix.vecMulᵣ.{u1} l m α (NonUnitalNonAssocSemiring.toMul.{u1} α _inst_1) (Distrib.toAdd.{u1} α (NonUnitalNonAssocSemiring.toDistrib.{u1} α _inst_1)) (MulZeroClass.toZero.{u1} α (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} α _inst_1)) v A) (Matrix.vecMul.{u1, 0, 0} (Fin l) (Fin m) α _inst_1 (Fin.fintype l) v A)
+Case conversion may be inaccurate. Consider using '#align matrix.vec_mulᵣ_eq Matrix.vecMulᵣ_eqₓ'. -/
/-- This can be used to prove
```lean
example [non_unital_non_assoc_semiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
@@ -219,11 +263,14 @@ example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b
vecMul ![b₁, b₂] !![a₁₁, a₁₂; a₂₁, a₂₂] = ![b₁ * a₁₁ + b₂ * a₂₁, b₁ * a₁₂ + b₂ * a₂₂] :=
(vecMulᵣ_eq _ _).symm
+#print Matrix.etaExpand /-
/-- Expand `A` to `!![A 0 0, ...; ..., A m n]` -/
def etaExpand {m n} (A : Matrix (Fin m) (Fin n) α) : Matrix (Fin m) (Fin n) α :=
Matrix.of (FinVec.etaExpand fun i => FinVec.etaExpand fun j => A i j)
#align matrix.eta_expand Matrix.etaExpand
+-/
+#print Matrix.etaExpand_eq /-
/-- This can be used to prove
```lean
example (A : matrix (fin 2) (fin 2) α) :
@@ -235,6 +282,7 @@ example (A : matrix (fin 2) (fin 2) α) :
theorem etaExpand_eq {m n} (A : Matrix (Fin m) (Fin n) α) : etaExpand A = A := by
simp_rw [eta_expand, FinVec.etaExpand_eq, Matrix.of, Equiv.refl_apply]
#align matrix.eta_expand_eq Matrix.etaExpand_eq
+-/
example (A : Matrix (Fin 2) (Fin 2) α) : A = !![A 0 0, A 0 1; A 1 0, A 1 1] :=
(etaExpand_eq _).symm
mathlib commit https://github.com/leanprover-community/mathlib/commit/17ad94b4953419f3e3ce3e77da3239c62d1d09f0
@@ -63,7 +63,6 @@ theorem forall_iff : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Forall
exact Iff.symm Fin.forall_fin_succ_pi
#align matrix.forall_iff Matrix.forall_iff
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
(∀ x, P x) ↔ ∀ a b c d e f, P !![a, b, c; d, e, f] :=
(forall_iff _).symm
@@ -88,7 +87,6 @@ theorem exists_iff : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Exists
exact Iff.symm Fin.exists_fin_succ_pi
#align matrix.exists_iff Matrix.exists_iff
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
(∃ x, P x) ↔ ∃ a b c d e f, P !![a, b, c; d, e, f] :=
(exists_iff _).symm
@@ -118,8 +116,6 @@ theorem transposeᵣ_eq : ∀ {m n} (A : Matrix (Fin m) (Fin n) α), transpose
rfl
#align matrix.transposeᵣ_eq Matrix.transposeᵣ_eq
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example (a b c d : α) : transpose !![a, b; c, d] = !![a, c; b, d] :=
(transposeᵣ_eq _).symm
@@ -169,9 +165,6 @@ theorem mulᵣ_eq [Mul α] [AddCommMonoid α] (A : Matrix (Fin l) (Fin m) α)
rfl
#align matrix.mulᵣ_eq Matrix.mulᵣ_eq
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
!![a₁₁, a₁₂; a₂₁, a₂₂].mul !![b₁₁, b₁₂; b₂₁, b₂₂] =
!![a₁₁ * b₁₁ + a₁₂ * b₂₁, a₁₁ * b₁₂ + a₁₂ * b₂₂;
@@ -198,7 +191,6 @@ theorem mulVecᵣ_eq [NonUnitalNonAssocSemiring α] (A : Matrix (Fin l) (Fin m)
rfl
#align matrix.mul_vecᵣ_eq Matrix.mulVecᵣ_eq
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
!![a₁₁, a₁₂; a₂₁, a₂₂].mulVec ![b₁, b₂] = ![a₁₁ * b₁ + a₁₂ * b₂, a₂₁ * b₁ + a₂₂ * b₂] :=
(mulVecᵣ_eq _ _).symm
@@ -223,7 +215,6 @@ theorem vecMulᵣ_eq [NonUnitalNonAssocSemiring α] (v : Fin l → α) (A : Matr
rfl
#align matrix.vec_mulᵣ_eq Matrix.vecMulᵣ_eq
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
vecMul ![b₁, b₂] !![a₁₁, a₁₂; a₂₁, a₂₂] = ![b₁ * a₁₁ + b₂ * a₂₁, b₁ * a₁₂ + b₂ * a₂₂] :=
(vecMulᵣ_eq _ _).symm
@@ -245,7 +236,6 @@ theorem etaExpand_eq {m n} (A : Matrix (Fin m) (Fin n) α) : etaExpand A = A :=
simp_rw [eta_expand, FinVec.etaExpand_eq, Matrix.of, Equiv.refl_apply]
#align matrix.eta_expand_eq Matrix.etaExpand_eq
-/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example (A : Matrix (Fin 2) (Fin 2) α) : A = !![A 0 0, A 0 1; A 1 0, A 1 1] :=
(etaExpand_eq _).symm
mathlib commit https://github.com/leanprover-community/mathlib/commit/17ad94b4953419f3e3ce3e77da3239c62d1d09f0
@@ -174,8 +174,8 @@ theorem mulᵣ_eq [Mul α] [AddCommMonoid α] (A : Matrix (Fin l) (Fin m) α)
/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
!![a₁₁, a₁₂; a₂₁, a₂₂].mul !![b₁₁, b₁₂; b₂₁, b₂₂] =
- !![a₁₁ * b₁₁ + a₁₂ * b₂₁, a₁₁ * b₁₂ + a₁₂ * b₂₂; a₂₁ * b₁₁ + a₂₂ * b₂₁,
- a₂₁ * b₁₂ + a₂₂ * b₂₂] :=
+ !![a₁₁ * b₁₁ + a₁₂ * b₂₁, a₁₁ * b₁₂ + a₁₂ * b₂₂;
+ a₂₁ * b₁₁ + a₂₂ * b₂₁, a₂₁ * b₁₂ + a₂₂ * b₂₂] :=
(mulᵣ_eq _ _).symm
/-- `matrix.mul_vec` with better defeq for `fin` -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/17ad94b4953419f3e3ce3e77da3239c62d1d09f0
@@ -63,14 +63,9 @@ theorem forall_iff : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Forall
exact Iff.symm Fin.forall_fin_succ_pi
#align matrix.forall_iff Matrix.forall_iff
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
- (∀ x, P x) ↔
- ∀ a b c d e f,
- P
- («expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation") :=
+ (∀ x, P x) ↔ ∀ a b c d e f, P !![a, b, c; d, e, f] :=
(forall_iff _).symm
/-- `∃` with better defeq for `∃ x : matrix (fin m) (fin n) α, P x`. -/
@@ -93,14 +88,9 @@ theorem exists_iff : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Exists
exact Iff.symm Fin.exists_fin_succ_pi
#align matrix.exists_iff Matrix.exists_iff
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
- (∃ x, P x) ↔
- ∃ a b c d e f,
- P
- («expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation") :=
+ (∃ x, P x) ↔ ∃ a b c d e f, P !![a, b, c; d, e, f] :=
(exists_iff _).symm
/-- `matrix.tranpose` with better defeq for `fin` -/
@@ -128,16 +118,9 @@ theorem transposeᵣ_eq : ∀ {m n} (A : Matrix (Fin m) (Fin n) α), transpose
rfl
#align matrix.transposeᵣ_eq Matrix.transposeᵣ_eq
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
-example (a b c d : α) :
- transpose
- («expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation") =
- «expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation" :=
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
+example (a b c d : α) : transpose !![a, b; c, d] = !![a, c; b, d] :=
(transposeᵣ_eq _).symm
/-- `matrix.dot_product` with better defeq for `fin` -/
@@ -186,19 +169,13 @@ theorem mulᵣ_eq [Mul α] [AddCommMonoid α] (A : Matrix (Fin l) (Fin m) α)
rfl
#align matrix.mulᵣ_eq Matrix.mulᵣ_eq
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
- («expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation").mul
- («expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation") =
- «expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation" :=
+ !![a₁₁, a₁₂; a₂₁, a₂₂].mul !![b₁₁, b₁₂; b₂₁, b₂₂] =
+ !![a₁₁ * b₁₁ + a₁₂ * b₂₁, a₁₁ * b₁₂ + a₁₂ * b₂₂; a₂₁ * b₁₁ + a₂₂ * b₂₁,
+ a₂₁ * b₁₂ + a₂₂ * b₂₂] :=
(mulᵣ_eq _ _).symm
/-- `matrix.mul_vec` with better defeq for `fin` -/
@@ -221,13 +198,9 @@ theorem mulVecᵣ_eq [NonUnitalNonAssocSemiring α] (A : Matrix (Fin l) (Fin m)
rfl
#align matrix.mul_vecᵣ_eq Matrix.mulVecᵣ_eq
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
- («expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation").mulVec
- ![b₁, b₂] =
- ![a₁₁ * b₁ + a₁₂ * b₂, a₂₁ * b₁ + a₂₂ * b₂] :=
+ !![a₁₁, a₁₂; a₂₁, a₂₂].mulVec ![b₁, b₂] = ![a₁₁ * b₁ + a₁₂ * b₂, a₂₁ * b₁ + a₂₂ * b₂] :=
(mulVecᵣ_eq _ _).symm
/-- `matrix.vec_mul` with better defeq for `fin` -/
@@ -250,13 +223,9 @@ theorem vecMulᵣ_eq [NonUnitalNonAssocSemiring α] (v : Fin l → α) (A : Matr
rfl
#align matrix.vec_mulᵣ_eq Matrix.vecMulᵣ_eq
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
- vecMul ![b₁, b₂]
- («expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation") =
- ![b₁ * a₁₁ + b₂ * a₂₁, b₁ * a₁₂ + b₂ * a₂₂] :=
+ vecMul ![b₁, b₂] !![a₁₁, a₁₂; a₂₁, a₂₂] = ![b₁ * a₁₁ + b₂ * a₂₁, b₁ * a₁₂ + b₂ * a₂₂] :=
(vecMulᵣ_eq _ _).symm
/-- Expand `A` to `!![A 0 0, ...; ..., A m n]` -/
@@ -276,12 +245,8 @@ theorem etaExpand_eq {m n} (A : Matrix (Fin m) (Fin n) α) : etaExpand A = A :=
simp_rw [eta_expand, FinVec.etaExpand_eq, Matrix.of, Equiv.refl_apply]
#align matrix.eta_expand_eq Matrix.etaExpand_eq
-/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
-/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
-example (A : Matrix (Fin 2) (Fin 2) α) :
- A =
- «expr!![ »
- "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation" :=
+/- ./././Mathport/Syntax/Translate/Tactic/Basic.lean:31:4: unsupported: too many args: matrix.notation ... #[[]] -/
+example (A : Matrix (Fin 2) (Fin 2) α) : A = !![A 0 0, A 0 1; A 1 0, A 1 1] :=
(etaExpand_eq _).symm
end Matrix
mathlib commit https://github.com/leanprover-community/mathlib/commit/0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
! This file was ported from Lean 3 source module data.matrix.reflection
-! leanprover-community/mathlib commit d95bef0d215ea58c0fd7bbc4b151bf3fe952c095
+! leanprover-community/mathlib commit 820b22968a2bc4a47ce5cf1d2f36a9ebe52510aa
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -30,6 +30,8 @@ corresponding `*_eq` lemmas to be used in a place where they are definitionally
* `matrix.transposeᵣ`
* `matrix.dot_productᵣ`
* `matrix.mulᵣ`
+* `matrix.mul_vecᵣ`
+* `matrix.vec_mulᵣ`
* `matrix.eta_expand`
-/
@@ -162,18 +164,18 @@ example (a b c d : α) [Mul α] [AddCommMonoid α] : dotProduct ![a, b] ![c, d]
/-- `matrix.mul` with better defeq for `fin` -/
def mulᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (B : Matrix (Fin m) (Fin n) α) :
Matrix (Fin l) (Fin n) α :=
- of <| FinVec.map (fun v₁ => FinVec.map (fun v₂ => dotProductᵣ v₁ v₂) (transposeᵣ B)) A
+ of <| FinVec.map (fun v₁ => FinVec.map (fun v₂ => dotProductᵣ v₁ v₂) Bᵀ) A
#align matrix.mulᵣ Matrix.mulᵣ
/-- This can be used to prove
```lean
-example [add_comm_monoid α] [has_mul α]
- (a₁₁ a₁₂ a₁₃ a₂₁ a₂₂ a₂₃ a₃₁ a₃₂ a₃₃ b₁₁ b₁₂ b₁₃ b₂₁ b₂₂ b₂₃ b₃₁ b₃₂ b₃₃ : α) :
+example [add_comm_monoid α] [has_mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
!![a₁₁, a₁₂;
a₂₁, a₂₂] ⬝ !![b₁₁, b₁₂;
b₂₁, b₂₂] =
!![a₁₁*b₁₁ + a₁₂*b₂₁, a₁₁*b₁₂ + a₁₂*b₂₂;
a₂₁*b₁₁ + a₂₂*b₂₁, a₂₁*b₁₂ + a₂₂*b₂₂] :=
+(mulᵣ_eq _ _).symm
```
-/
@[simp]
@@ -190,8 +192,7 @@ theorem mulᵣ_eq [Mul α] [AddCommMonoid α] (A : Matrix (Fin l) (Fin m) α)
/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
-example [AddCommMonoid α] [Mul α]
- (a₁₁ a₁₂ a₁₃ a₂₁ a₂₂ a₂₃ a₃₁ a₃₂ a₃₃ b₁₁ b₁₂ b₁₃ b₂₁ b₂₂ b₂₃ b₃₁ b₃₂ b₃₃ : α) :
+example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
(«expr!![ »
"./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation").mul
(«expr!![ »
@@ -200,6 +201,64 @@ example [AddCommMonoid α] [Mul α]
"./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation" :=
(mulᵣ_eq _ _).symm
+/-- `matrix.mul_vec` with better defeq for `fin` -/
+def mulVecᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (v : Fin m → α) : Fin l → α :=
+ FinVec.map (fun a => dotProductᵣ a v) A
+#align matrix.mul_vecᵣ Matrix.mulVecᵣ
+
+/-- This can be used to prove
+```lean
+example [non_unital_non_assoc_semiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
+ !![a₁₁, a₁₂;
+ a₂₁, a₂₂].mul_vec ![b₁, b₂] = ![a₁₁*b₁ + a₁₂*b₂, a₂₁*b₁ + a₂₂*b₂] :=
+(mul_vecᵣ_eq _ _).symm
+```
+-/
+@[simp]
+theorem mulVecᵣ_eq [NonUnitalNonAssocSemiring α] (A : Matrix (Fin l) (Fin m) α) (v : Fin m → α) :
+ mulVecᵣ A v = A.mulVec v := by
+ simp [mul_vecᵣ, Function.comp]
+ rfl
+#align matrix.mul_vecᵣ_eq Matrix.mulVecᵣ_eq
+
+/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
+example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
+ («expr!![ »
+ "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation").mulVec
+ ![b₁, b₂] =
+ ![a₁₁ * b₁ + a₁₂ * b₂, a₂₁ * b₁ + a₂₂ * b₂] :=
+ (mulVecᵣ_eq _ _).symm
+
+/-- `matrix.vec_mul` with better defeq for `fin` -/
+def vecMulᵣ [Mul α] [Add α] [Zero α] (v : Fin l → α) (A : Matrix (Fin l) (Fin m) α) : Fin m → α :=
+ FinVec.map (fun a => dotProductᵣ v a) Aᵀ
+#align matrix.vec_mulᵣ Matrix.vecMulᵣ
+
+/-- This can be used to prove
+```lean
+example [non_unital_non_assoc_semiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
+ vec_mul ![b₁, b₂] !![a₁₁, a₁₂;
+ a₂₁, a₂₂] = ![b₁*a₁₁ + b₂*a₂₁, b₁*a₁₂ + b₂*a₂₂] :=
+(vec_mulᵣ_eq _ _).symm
+```
+-/
+@[simp]
+theorem vecMulᵣ_eq [NonUnitalNonAssocSemiring α] (v : Fin l → α) (A : Matrix (Fin l) (Fin m) α) :
+ vecMulᵣ v A = vecMul v A := by
+ simp [vec_mulᵣ, Function.comp]
+ rfl
+#align matrix.vec_mulᵣ_eq Matrix.vecMulᵣ_eq
+
+/- ./././Mathport/Syntax/Translate/Expr.lean:207:4: warning: unsupported notation `«expr!![ » -/
+/- ./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation -/
+example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
+ vecMul ![b₁, b₂]
+ («expr!![ »
+ "./././Mathport/Syntax/Translate/Expr.lean:387:14: unsupported user notation matrix.notation") =
+ ![b₁ * a₁₁ + b₂ * a₂₁, b₁ * a₁₂ + b₂ * a₂₂] :=
+ (vecMulᵣ_eq _ _).symm
+
/-- Expand `A` to `!![A 0 0, ...; ..., A m n]` -/
def etaExpand {m n} (A : Matrix (Fin m) (Fin n) α) : Matrix (Fin m) (Fin n) α :=
Matrix.of (FinVec.etaExpand fun i => FinVec.etaExpand fun j => A i j)
mathlib commit https://github.com/leanprover-community/mathlib/commit/d95bef0d215ea58c0fd7bbc4b151bf3fe952c095
Matrix.mulVec
and Matrix.vecMul
get infix notation (#10297)
Zulip discussion: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Notation.20for.20mul_vec.20and.20vec_mul
Co-authored-by: Martin Dvorak <mdvorak@ista.ac.at>
@@ -177,19 +177,19 @@ def mulVecᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (v : F
```lean
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
!![a₁₁, a₁₂;
- a₂₁, a₂₂].mulVec ![b₁, b₂] = ![a₁₁*b₁ + a₁₂*b₂, a₂₁*b₁ + a₂₂*b₂] :=
+ a₂₁, a₂₂] *ᵥ ![b₁, b₂] = ![a₁₁*b₁ + a₁₂*b₂, a₂₁*b₁ + a₂₂*b₂] :=
(mulVecᵣ_eq _ _).symm
```
-/
@[simp]
theorem mulVecᵣ_eq [NonUnitalNonAssocSemiring α] (A : Matrix (Fin l) (Fin m) α) (v : Fin m → α) :
- mulVecᵣ A v = A.mulVec v := by
+ mulVecᵣ A v = A *ᵥ v := by
simp [mulVecᵣ, Function.comp]
rfl
#align matrix.mul_vecᵣ_eq Matrix.mulVecᵣ_eq
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
- !![a₁₁, a₁₂; a₂₁, a₂₂].mulVec ![b₁, b₂] = ![a₁₁ * b₁ + a₁₂ * b₂, a₂₁ * b₁ + a₂₂ * b₂] :=
+ !![a₁₁, a₁₂; a₂₁, a₂₂] *ᵥ ![b₁, b₂] = ![a₁₁ * b₁ + a₁₂ * b₂, a₂₁ * b₁ + a₂₂ * b₂] :=
(mulVecᵣ_eq _ _).symm
/-- `Matrix.vecMul` with better defeq for `Fin` -/
@@ -200,20 +200,20 @@ def vecMulᵣ [Mul α] [Add α] [Zero α] (v : Fin l → α) (A : Matrix (Fin l)
/-- This can be used to prove
```lean
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
- vecMul ![b₁, b₂] !![a₁₁, a₁₂;
+ ![b₁, b₂] ᵥ* !![a₁₁, a₁₂;
a₂₁, a₂₂] = ![b₁*a₁₁ + b₂*a₂₁, b₁*a₁₂ + b₂*a₂₂] :=
(vecMulᵣ_eq _ _).symm
```
-/
@[simp]
theorem vecMulᵣ_eq [NonUnitalNonAssocSemiring α] (v : Fin l → α) (A : Matrix (Fin l) (Fin m) α) :
- vecMulᵣ v A = vecMul v A := by
+ vecMulᵣ v A = v ᵥ* A := by
simp [vecMulᵣ, Function.comp]
rfl
#align matrix.vec_mulᵣ_eq Matrix.vecMulᵣ_eq
example [NonUnitalNonAssocSemiring α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁ b₂ : α) :
- vecMul ![b₁, b₂] !![a₁₁, a₁₂; a₂₁, a₂₂] = ![b₁ * a₁₁ + b₂ * a₂₁, b₁ * a₁₂ + b₂ * a₂₂] :=
+ ![b₁, b₂] ᵥ* !![a₁₁, a₁₂; a₂₁, a₂₂] = ![b₁ * a₁₁ + b₂ * a₂₁, b₁ * a₁₂ + b₂ * a₂₂] :=
(vecMulᵣ_eq _ _).symm
/-- Expand `A` to `!![A 0 0, ...; ..., A m n]` -/
@@ -230,7 +230,9 @@ example (A : Matrix (Fin 2) (Fin 2) α) :
```
-/
theorem etaExpand_eq {m n} (A : Matrix (Fin m) (Fin n) α) : etaExpand A = A := by
- simp_rw [etaExpand, FinVec.etaExpand_eq, Matrix.of, Equiv.refl_apply]
+ simp_rw [etaExpand, FinVec.etaExpand_eq, Matrix.of]
+ -- This to be in the above `simp_rw` before leanprover/lean4#2644
+ erw [Equiv.refl_apply]
#align matrix.eta_expand_eq Matrix.etaExpand_eq
example (A : Matrix (Fin 2) (Fin 2) α) : A = !![A 0 0, A 0 1; A 1 0, A 1 1] :=
@@ -230,9 +230,7 @@ example (A : Matrix (Fin 2) (Fin 2) α) :
```
-/
theorem etaExpand_eq {m n} (A : Matrix (Fin m) (Fin n) α) : etaExpand A = A := by
- simp_rw [etaExpand, FinVec.etaExpand_eq, Matrix.of]
- -- This to be in the above `simp_rw` before leanprover/lean4#2644
- erw [Equiv.refl_apply]
+ simp_rw [etaExpand, FinVec.etaExpand_eq, Matrix.of, Equiv.refl_apply]
#align matrix.eta_expand_eq Matrix.etaExpand_eq
example (A : Matrix (Fin 2) (Fin 2) α) : A = !![A 0 0, A 0 1; A 1 0, A 1 1] :=
@@ -230,7 +230,9 @@ example (A : Matrix (Fin 2) (Fin 2) α) :
```
-/
theorem etaExpand_eq {m n} (A : Matrix (Fin m) (Fin n) α) : etaExpand A = A := by
- simp_rw [etaExpand, FinVec.etaExpand_eq, Matrix.of, Equiv.refl_apply]
+ simp_rw [etaExpand, FinVec.etaExpand_eq, Matrix.of]
+ -- This to be in the above `simp_rw` before leanprover/lean4#2644
+ erw [Equiv.refl_apply]
#align matrix.eta_expand_eq Matrix.etaExpand_eq
example (A : Matrix (Fin 2) (Fin 2) α) : A = !![A 0 0, A 0 1; A 1 0, A 1 1] :=
⬝
notation in favor of HMul
(#6487)
The main difficulty here is that *
has a slightly difference precedence to ⬝
. notably around smul
and neg
.
The other annoyance is that ↑U ⬝ A ⬝ ↑U⁻¹ : Matrix m m 𝔸
now has to be written U.val * A * (U⁻¹).val
in order to typecheck.
A downside of this change to consider: if you have a goal of A * (B * C) = (A * B) * C
, mul_assoc
now gives the illusion of matching, when in fact Matrix.mul_assoc
is needed. Previously the distinct symbol made it easy to avoid this mistake.
On the flipside, there is now no need to rewrite by Matrix.mul_eq_mul
all the time (indeed, the lemma is now removed).
@@ -148,7 +148,7 @@ def mulᵣ [Mul α] [Add α] [Zero α] (A : Matrix (Fin l) (Fin m) α) (B : Matr
```lean
example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
!![a₁₁, a₁₂;
- a₂₁, a₂₂] ⬝ !![b₁₁, b₁₂;
+ a₂₁, a₂₂] * !![b₁₁, b₁₂;
b₂₁, b₂₂] =
!![a₁₁*b₁₁ + a₁₂*b₂₁, a₁₁*b₁₂ + a₁₂*b₂₂;
a₂₁*b₁₁ + a₂₂*b₂₁, a₂₁*b₁₂ + a₂₂*b₂₂] :=
@@ -157,13 +157,13 @@ example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b
-/
@[simp]
theorem mulᵣ_eq [Mul α] [AddCommMonoid α] (A : Matrix (Fin l) (Fin m) α)
- (B : Matrix (Fin m) (Fin n) α) : mulᵣ A B = A.mul B := by
- simp [mulᵣ, Function.comp, Matrix.mul, Matrix.transpose]
+ (B : Matrix (Fin m) (Fin n) α) : mulᵣ A B = A * B := by
+ simp [mulᵣ, Function.comp, Matrix.transpose]
rfl
#align matrix.mulᵣ_eq Matrix.mulᵣ_eq
example [AddCommMonoid α] [Mul α] (a₁₁ a₁₂ a₂₁ a₂₂ b₁₁ b₁₂ b₂₁ b₂₂ : α) :
- !![a₁₁, a₁₂; a₂₁, a₂₂] ⬝ !![b₁₁, b₁₂; b₂₁, b₂₂] =
+ !![a₁₁, a₁₂; a₂₁, a₂₂] * !![b₁₁, b₁₂; b₂₁, b₂₂] =
!![a₁₁ * b₁₁ + a₁₂ * b₂₁, a₁₁ * b₁₂ + a₁₂ * b₂₂;
a₂₁ * b₁₁ + a₂₂ * b₂₁, a₂₁ * b₁₂ + a₂₂ * b₂₂] :=
(mulᵣ_eq _ _).symm
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -38,7 +38,7 @@ open Matrix
namespace Matrix
-variable {l m n : ℕ} {α β : Type _}
+variable {l m n : ℕ} {α β : Type*}
/-- `∀` with better defeq for `∀ x : Matrix (Fin m) (Fin n) α, P x`. -/
def Forall : ∀ {m n} (_ : Matrix (Fin m) (Fin n) α → Prop), Prop
@@ -2,16 +2,13 @@
Copyright (c) 2022 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-
-! This file was ported from Lean 3 source module data.matrix.reflection
-! leanprover-community/mathlib commit 820b22968a2bc4a47ce5cf1d2f36a9ebe52510aa
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Matrix.Notation
import Mathlib.Data.Matrix.Basic
import Mathlib.Data.Fin.Tuple.Reflection
+#align_import data.matrix.reflection from "leanprover-community/mathlib"@"820b22968a2bc4a47ce5cf1d2f36a9ebe52510aa"
+
/-!
# Lemmas for concrete matrices `Matrix (Fin m) (Fin n) α`
@@ -57,7 +57,7 @@ example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
```
-/
theorem forall_iff : ∀ {m n} (P : Matrix (Fin m) (Fin n) α → Prop), Forall P ↔ ∀ x, P x
- | 0, n, P => Iff.symm Fin.forall_fin_zero_pi
+ | 0, n, P => Iff.symm Fin.forall_fin_zero_pi
| m + 1, n, P => by
simp only [Forall, FinVec.forall_iff, forall_iff]
exact Iff.symm Fin.forall_fin_succ_pi
@@ -25,7 +25,7 @@ This allows "proof by reflection", where we prove `A = !![A 0 0, A 0 1; A 1 0,
The definitions in this file should normally not be used directly; the intent is for the
corresponding `*_eq` lemmas to be used in a place where they are definitionally unfolded.
-## Main definitionss
+## Main definitions
* `Matrix.transposeᵣ`
* `Matrix.dotProductᵣ`
@@ -91,7 +91,7 @@ example (P : Matrix (Fin 2) (Fin 3) α → Prop) :
(∃ x, P x) ↔ ∃ a b c d e f, P !![a, b, c; d, e, f] :=
(exists_iff _).symm
-/-- `matrix.tranpose` with better defeq for `Fin` -/
+/-- `Matrix.transpose` with better defeq for `Fin` -/
def transposeᵣ : ∀ {m n}, Matrix (Fin m) (Fin n) α → Matrix (Fin n) (Fin m) α
| _, 0, _ => of ![]
| _, _ + 1, A =>
The unported dependencies are