Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit bc5d5c9

Browse files
committed
feat(data/matrix/notation,data/fin): head and append simp (#5741)
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
1 parent 0104948 commit bc5d5c9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/data/fin.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,10 @@ def append {α : Type*} {o : ℕ} (ho : o = m + n) (u : fin m → α) (v : fin n
938938
then u ⟨i, h⟩
939939
else v ⟨(i : ℕ) - m, (nat.sub_lt_left_iff_lt_add (le_of_not_lt h)).2 (ho ▸ i.property)⟩
940940

941+
@[simp] lemma fin_append_apply_zero {α : Type*} {o : ℕ} (ho : (o + 1) = (m + 1) + n)
942+
(u : fin (m + 1) → α) (v : fin n → α) :
943+
fin.append ho u v 0 = u 0 := rfl
944+
941945
end tuple
942946

943947
section tuple_right

src/data/matrix/notation.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ by { ext i, fin_cases i }
7676

7777
section val
7878

79+
@[simp] lemma head_fin_const (a : α) : vec_head (λ (i : fin (n + 1)), a) = a := rfl
80+
7981
@[simp] lemma cons_val_zero (x : α) (u : fin m → α) : vec_cons x u 0 = x := rfl
8082

8183
lemma cons_val_zero' (h : 0 < m.succ) (x : α) (u : fin m → α) :
@@ -211,6 +213,12 @@ begin
211213
exact nat.add_succ_lt_add i.property i.property } }
212214
end
213215

216+
@[simp] lemma vec_head_vec_alt0 (hm : (m + 2) = (n + 1) + (n + 1)) (v : fin (m + 2) → α) :
217+
vec_head (vec_alt0 hm v) = v 0 := rfl
218+
219+
@[simp] lemma vec_head_vec_alt1 (hm : (m + 2) = (n + 1) + (n + 1)) (v : fin (m + 2) → α) :
220+
vec_head (vec_alt1 hm v) = v 1 := rfl
221+
214222
@[simp] lemma cons_vec_bit0_eq_alt0 (x : α) (u : fin n → α) (i : fin (n + 1)) :
215223
vec_cons x u (bit0 i) = vec_alt0 rfl (fin.append rfl (vec_cons x u) (vec_cons x u)) i :=
216224
by rw vec_alt0_append

0 commit comments

Comments
 (0)