Lemma switch_row_equal_rows {m n} (r1 r2 : ⟦ m ⟧%stn) (mat : Matrix R m n) : (mat r1) = (mat r2) -> (switch_row r1 r2 mat) = mat. Proof. intros m_eq. unfold switch_row. apply funextfun. intros i'. destruct (stn_eq_or_neq _ _) as [eq | neq]. - destruct (stn_eq_or_neq _ _) as [eq' | neq']. + now apply maponpaths. + etrans. apply m_eq. now apply maponpaths. - destruct (stn_eq_or_neq _ _) as [eq | cec]. + cbn. etrans. apply(!m_eq). apply maponpaths, (!eq). + apply idpath. Qed.
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.