proposition: Lemma back_sub_internal_inv0 { n : nat } (mat : Matrix F n n) (x : Vector F n) (b : Vector F n) (ut : @is_upper_triangular F _ _ mat) (sep : ⟦ S n ⟧%stn) (row : ⟦ S n ⟧%stn) : ∏ (i : ⟦ n ⟧%stn), i >= row -> (col_vec (back_sub_internal mat x b sep row)) i = (col_vec x) i.
proof: Proof. destruct sep as [sep p]. induction sep as [| sep IH]. { intros i H; now destruct (natchoice0 (S n)) in H. } unfold back_sub_internal. intros i i_lt_row. rewrite nat_rect_step. destruct (natlthorgeh _ _) as [lt | geh]. 2: { reflexivity. } assert (p': sep < S n). { apply (istransnatlth _ _ _ (natgthsnn sep) p). } rewrite <- (IH p'); try assumption. unfold back_sub_internal. rewrite back_sub_step_inv1; try easy. { apply maponpaths_2, maponpaths, proofirrelevance, propproperty. } apply natgthtoneq. refine (natlthlehtrans _ _ _ lt i_lt_row). Defined.
imports: UniMath.MoreFoundations.PartA UniMath.MoreFoundations.Nat UniMath.MoreFoundations.Tactics UniMath.Algebra.Matrix UniMath.Algebra.Domains_and_Fields UniMath.Algebra.Matrix UniMath.Algebra.RigsAndRings UniMath.Algebra.IteratedBinaryOperations UniMath.Algebra.GaussianElimination.Auxiliary UniMath.Algebra.GaussianElimination.Vectors UniMath.Algebra.GaussianElimination.Matrices UniMath.Algebra.GaussianElimination.Elimination