Lemma switch_row_equal_entries {m n : nat} (r1 r2 : ⟦ m ⟧%stn) (mat : Matrix R m n) : ∏ (j : ⟦ n ⟧%stn), (mat r1 j) = (mat r2 j) -> ∏ (r3 : ⟦ m ⟧%stn), (switch_row r1 r2 mat) r3 j = mat r3 j. Proof. intros j m_eq r3. unfold switch_row. destruct (stn_eq_or_neq _ _) as [eq | neq]. - destruct (stn_eq_or_neq _ _) as [eq' | neq']; cbn. + now apply maponpaths_2. + etrans. apply m_eq. now apply maponpaths_2. - destruct (stn_eq_or_neq _ _) as [eq | cec]; cbn. + etrans. apply(!m_eq). now apply maponpaths_2. + 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.