Zulip Chat Archive
Stream: new members
Topic: Unfold dot product
Martin Dvořák (Dec 20 2021 at 12:11):
How can I prove this technical lemma, please?
variables {R : Type*} [comm_ring R]
lemma this_shoud_be_trivial (a b c d e f : R) :
matrix.dot_product ![a, b, c] ![d, e, f] = a*d + b*e + c*f
:= sorry
This question is related to (I am implementing the cross product):
https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/cross.20product
Martin Dvořák (Dec 20 2021 at 12:13):
This is the definition (from data.matrix.basic
) I am referring to:
/-- `dot_product v w` is the sum of the entrywise products `v i * w i` -/
def dot_product [has_mul α] [add_comm_monoid α] (v w : m → α) : α :=
∑ i, v i * w i
Damiano Testa (Dec 20 2021 at 12:17):
by simp [add_assoc]
seems to work.
Last updated: Dec 20 2023 at 11:08 UTC