Lemma add_row_mult_source_row_zero {m n} (r1 r2 : ⟦ m ⟧%stn) (s : R) (mat : Matrix R m n) : mat r1 = const_vec 0%ring -> add_row_mult r1 r2 s mat = mat. Proof. intros eq0. apply funextfun; intros i'; apply funextfun; intros j'. unfold add_row_mult. destruct (stn_eq_or_neq _ _ ) as [i'_eq_j' | i'_neq_j']; simpl; try reflexivity. rewrite <- i'_eq_j', eq0. unfold const_vec ; simpl. rewrite (@rigmultx0 R). apply (@rigrunax1 R). 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.Matrix. Require Import UniMath.Algebra.RigsAndRings. Require Import UniMath.Algebra.IteratedBinaryOperations. Require Import UniMath.Algebra.Domains_and_Fields. Require Import UniMath.Algebra.GaussianElimination.Auxiliary. Require Import UniMath.Algebra.GaussianElimination.Vectors. Require Import UniMath.Algebra.GaussianElimination.Matrices.