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

Commit 1162509

Browse files
committed
chore(data/fin/vec_notation): generalize smul_cons (#11285)
1 parent 56f021a commit 1162509

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/data/complex/module.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ basis.of_equiv_fun
125125
left_inv := λ z, by simp,
126126
right_inv := λ c, by { ext i, fin_cases i; simp },
127127
map_add' := λ z z', by simp,
128-
map_smul' := λ c z, by simp }
128+
-- why does `simp` not know how to apply `smul_cons`, which is a `@[simp]` lemma, here?
129+
map_smul' := λ c z, by simp [matrix.smul_cons c z.re, matrix.smul_cons c z.im] }
129130

130131
@[simp] lemma coe_basis_one_I_repr (z : ℂ) : ⇑(basis_one_I.repr z) = ![z.re, z.im] := rfl
131132

src/data/fin/vec_notation.lean

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,12 @@ end val
274274

275275
section smul
276276

277-
variables [semiring α]
278-
-- TODO: if I generalize these lemmas to `[has_scalar M α]`, then Lean fails to apply them
279-
-- in `data.complex.module`
277+
variables {M : Type*} [has_scalar M α]
280278

281-
@[simp] lemma smul_empty (x : α) (v : fin 0 → α) : x • v = ![] := empty_eq _
279+
@[simp] lemma smul_empty (x : M) (v : fin 0 → α) : x • v = ![] := empty_eq _
282280

283-
@[simp] lemma smul_cons (x y : α) (v : fin n → α) :
284-
x • vec_cons y v = vec_cons (x * y) (x • v) :=
281+
@[simp] lemma smul_cons (x : M) (y : α) (v : fin n → α) :
282+
x • vec_cons y v = vec_cons (x y) (x • v) :=
285283
by { ext i, refine fin.cases _ _ i; simp }
286284

287285
end smul

0 commit comments

Comments
 (0)