Skip to content

Commit 2837dc2

Browse files
committed
feat(Matrix/Notation): add diagonal_fin_one etc (leanprover-community#34712)
These lemmas are useful, e.g., for dealing with equality in $$PGL(2, \mathbb R)$$.
1 parent d72a3c3 commit 2837dc2

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Mathlib/LinearAlgebra/Matrix/Notation.lean

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,31 @@ theorem cons_dotProduct_cons (x : α) (v : Fin n → α) (y : α) (w : Fin n →
202202

203203
end DotProduct
204204

205+
section Diagonal
206+
variable [Zero α]
207+
208+
theorem diagonal_fin_one (d : Fin 1 → α) : diagonal d = !![d 0] := by
209+
simp [← Matrix.ext_iff]
210+
211+
theorem diagonal_vec1 (a : α) : diagonal ![a] = !![a] :=
212+
diagonal_fin_one ![a]
213+
214+
theorem diagonal_fin_two (d : Fin 2 → α) : diagonal d = !![d 0, 0; 0, d 1] := by
215+
simp [← Matrix.ext_iff]
216+
217+
theorem diagonal_vec2 (a b : α) : diagonal ![a, b] = !![a, 0; 0, b] :=
218+
diagonal_fin_two ![a, b]
219+
220+
theorem diagonal_fin_three (d : Fin 3 → α) :
221+
diagonal d = !![d 0, 0, 0; 0, d 1, 0; 0, 0, d 2] := by
222+
simp [← Matrix.ext_iff, Fin.forall_fin_succ]
223+
224+
theorem diagonal_vec3 (a b c : α) :
225+
diagonal ![a, b, c] = !![a, 0, 0; 0, b, 0; 0, 0, c] :=
226+
diagonal_fin_three ![a, b, c]
227+
228+
end Diagonal
229+
205230
section ColRow
206231

207232
variable {ι : Type*}

0 commit comments

Comments
 (0)