Expansion of products of list matrices #
proveMul rewrites ListMatrix.mul l m n A B for list literals A and B to a literal
whose entries are the sums of products of the entries, with the proof constructed manually
instead of asking the kernel to perform reduction.
The entries are obtained by unfolding equations of ListMatrix.dotProduct one term at a time,
instead of leaving the unfolding to the kernel, which can trigger evaluation of arithmetic
prematurely.
Construct a proof term that [a₀, …] = [b₀, …] in List α from proofs of aᵢ = bᵢ.
MVarId.congrN also works, but is much slower to elaborate.
Equations
Instances For
A dot product of two lists of entries, ListMatrix.dotProduct n l₁ l₂ = expr, with its
proof.
- n : Q(Nat)
The number of terms.
- l₁ : Q(List «$α»)
The first list.
- l₂ : Q(List «$α»)
The second list.
- expr : Q(«$α»)
The right-hand side.
- proof : Q(ListMatrix.dotProduct unknown_1 unknown_2 unknown_3 = unknown_4)
The proof.
Instances For
The dot product of the first m entries of the list literals l₁ and l₂,
ListMatrix.dotProduct m l₁ l₂ = fold, with m a numeral and fold the sum of the products
a₀ * b₀ + (a₁ * b₁ + (… + 0)), unfolded by the equations of ListMatrix.dotProduct.
The function takes the pre-built Expr for list literals instead of taking the list of entry
literals and build it here, to avoid reconstructing the expressions multiple times.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The expansion of the product ListMatrix.mul l m n A B of two list literals with the
associated proof term. The input matrices are put as fields of the structure to avoid
over-long dependent type signatures downstream.
The list literal of the first factor.
The list literal of the second factor.
The rows of the product, each entry the sum of the products of the entries.
The list literal of
rows.- proof : Q(ListMatrix.mul «$l» «$m» «$n» unknown_1 unknown_2 = unknown_3)
The proof.
Instances For
Rewrite ListMatrix.mul l m n A B to the literal whose entries are the sums of products of
the entries.
listA/listB are the rows of the l × m and m × n matrix respectively.
The rows are not checked against l, m and n.
Equations
- One or more equations did not get rendered due to their size.