Lemma add_row_mult_matrix_zero { n } ( r1 r2 : ⟦ n ⟧%stn ) (ne : r1 ≠ r2) : add_row_mult_matrix r1 r2 (@rigunel1 R) = @identity_matrix R _. Proof. apply funextfun; intros i. unfold add_row_mult_matrix. destruct (stn_eq_or_neq i r2) as [i_eq_r2 | i_neq_r2]. 2: { apply idpath. } destruct i_eq_r2. simpl. apply funextfun; intros j. unfold scalar_lmult_vec, pointwise, vector_fmap. rewrite (@rigmult0x 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.