Lemma matrix_mult_assoc {m n p q} (mat1 : Matrix R m n) (mat2 : Matrix R n p) (mat3 : Matrix R p q) : (mat1 ** mat2) ** mat3 = mat1 ** (mat2 ** mat3). Proof. intros; unfold matrix_mult. apply funextfun; intro i; apply funextfun; intro j. etrans. 2: { symmetry. apply maponpaths, funextfun. intros k. apply vecsum_ldistr. } etrans. { apply maponpaths. apply funextfun. intros k. apply vecsum_rdistr. } rewrite vecsum_interchange. apply maponpaths, funextfun; intros k. apply maponpaths, funextfun; intros l. apply rigassoc2. Defined.
Require Import UniMath.Foundations.All. Require Import UniMath.MoreFoundations.All. Require Import UniMath.Combinatorics.StandardFiniteSets. Require Import UniMath.Combinatorics.Vectors. Require Import UniMath.Algebra.RigsAndRings. Require Import UniMath.Algebra.IteratedBinaryOperations. Require Import UniMath.Algebra.Matrix. Require Import UniMath.Algebra.Domains_and_Fields. Require Import UniMath.Algebra.GaussianElimination.Auxiliary. Require Import UniMath.Algebra.GaussianElimination.Vectors.