Lemma switch_row_as_matrix {m n} (r1 r2 : ⟦ m ⟧%stn) (mat : Matrix R m n) : ((switch_row_matrix r1 r2) ** mat) = switch_row r1 r2 mat. Proof. apply funextfun; intros i; apply funextfun; intros j. rewrite matrix_mult_eq; unfold matrix_mult_unf. unfold switch_row_matrix, switch_row. destruct (stn_eq_or_neq i r1) as [i_eq_r1 | i_neq_r1]; destruct (stn_eq_or_neq i r2) as [i_eq_r2 | i_neq_r2]; simpl; use sum_stdb_vector_pointwise_prod. 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.