Documentation

CompPoly.LinearAlgebra.Dense.RrefSemantics

Dense RREF Semantic Correctness #

Semantic preservation and reflection lemmas for dense row reduction.

def CompPoly.DenseMatrix.findPivotRowStep {F : Type u_1} [Zero F] [BEq F] (M : DenseMatrix F) (col : ) (out : Option ) (row : ) :
Instances For
    theorem CompPoly.DenseMatrix.list_forIn_yield_eq_foldl {α : Type u_1} {β : Type u_2} (xs : List α) (init : β) (f : βαβ) :
    (forIn xs init fun (x : α) (acc : β) => pure (ForInStep.yield (f acc x))).run = List.foldl f init xs
    theorem CompPoly.DenseMatrix.findPivotRowStep_fold_some {F : Type u_1} [Zero F] [BEq F] (M : DenseMatrix F) (col : ) (xs : List ) (pivot : ) :
    List.foldl (M.findPivotRowStep col) (some pivot) xs = some pivot
    theorem CompPoly.DenseMatrix.list_forIn_findPivotRowStep_eq_foldl {F : Type u_1} [Zero F] [BEq F] (M : DenseMatrix F) (col : ) (xs : List ) (out : Option ) :
    (forIn xs out fun (row : ) (out : Option ) => if out = none (M.get row col == 0) = false then pure (ForInStep.yield (some row)) else pure (ForInStep.yield out)).run = List.foldl (M.findPivotRowStep col) out xs
    theorem CompPoly.DenseMatrix.findPivotRow_fold_mem {F : Type u_1} [Zero F] [BEq F] (M : DenseMatrix F) (col : ) {xs : List } {pivot : } (h : List.foldl (M.findPivotRowStep col) none xs = some pivot) :
    pivot xs
    theorem CompPoly.DenseMatrix.findPivotRow_fold_get_ne_zero {F : Type u_1} [Zero F] [BEq F] (M : DenseMatrix F) (col : ) {xs : List } {pivot : } (h : List.foldl (M.findPivotRowStep col) none xs = some pivot) :
    (M.get pivot col == 0) = false
    theorem CompPoly.DenseMatrix.findPivotRow_fold_none_get_eq_zero {F : Type u_1} [Zero F] [BEq F] [LawfulBEq F] (M : DenseMatrix F) (col : ) {xs : List } (h : List.foldl (M.findPivotRowStep col) none xs = none) {row : } (hrow : row xs) :
    M.get row col = 0
    theorem CompPoly.DenseMatrix.findPivotRow_eq_fold {F : Type u_1} [Zero F] [BEq F] (M : DenseMatrix F) (start col : ) :
    M.findPivotRow start col = List.foldl (M.findPivotRowStep col) none (List.range' start (M.rows - start))
    theorem CompPoly.DenseMatrix.findPivotRow_some_lt {F : Type u_1} [Zero F] [BEq F] {M : DenseMatrix F} {start col pivot : } (h : M.findPivotRow start col = some pivot) :
    pivot < M.rows
    theorem CompPoly.DenseMatrix.findPivotRow_some_ge {F : Type u_1} [Zero F] [BEq F] {M : DenseMatrix F} {start col pivot : } (h : M.findPivotRow start col = some pivot) :
    start pivot
    theorem CompPoly.DenseMatrix.findPivotRow_some_ne_zero {F : Type u_1} [Zero F] [BEq F] [LawfulBEq F] {M : DenseMatrix F} {start col pivot : } (h : M.findPivotRow start col = some pivot) :
    M.get pivot col 0
    theorem CompPoly.DenseMatrix.findPivotRow_none_get_eq_zero {F : Type u_1} [Zero F] [BEq F] [LawfulBEq F] {M : DenseMatrix F} {start col row : } (h : M.findPivotRow start col = none) (hstart : start row) (hrow : row < M.rows) :
    M.get row col = 0
    theorem CompPoly.DenseMatrix.list_forIn_addScaledRow_wf {F : Type u_1} [Field F] (rows : List ) {out : DenseMatrix F} (pivotRow pivotCol : ) (hout : out.WellFormed) :
    (forIn rows out fun (row : ) (r : DenseMatrix F) => if row = pivotRow then pure (ForInStep.yield r) else pure (ForInStep.yield (r.addScaledRow row pivotRow (-r.get row pivotCol)))).run.WellFormed
    theorem CompPoly.DenseMatrix.normalizeAndEliminate_wf {F : Type u_1} [Field F] [BEq F] {M : DenseMatrix F} (hM : M.WellFormed) (pivotRow pivotCol : ) :
    (M.normalizeAndEliminate pivotRow pivotCol).WellFormed
    theorem CompPoly.DenseMatrix.list_forIn_addScaledRow_solution_of_solution {F : Type u_1} [Field F] (rows : List ) {out : DenseMatrix F} {v : Array F} (pivotRow pivotCol : ) (hpivot : pivotRow < out.rows) (hout : out.WellFormed) (hsol : out.IsHomogeneousSolution v) :
    (forIn rows out fun (row : ) (r : DenseMatrix F) => if row = pivotRow then pure (ForInStep.yield r) else pure (ForInStep.yield (r.addScaledRow row pivotRow (-r.get row pivotCol)))).run.IsHomogeneousSolution v
    theorem CompPoly.DenseMatrix.list_forIn_addScaledRow_solution_reflect {F : Type u_1} [Field F] (rows : List ) {out : DenseMatrix F} {v : Array F} (pivotRow pivotCol : ) (hpivot : pivotRow < out.rows) (hout : out.WellFormed) (hsol : (forIn rows out fun (row : ) (r : DenseMatrix F) => if row = pivotRow then pure (ForInStep.yield r) else pure (ForInStep.yield (r.addScaledRow row pivotRow (-r.get row pivotCol)))).run.IsHomogeneousSolution v) :
    theorem CompPoly.DenseMatrix.isHomogeneousSolution_normalizeAndEliminate_of_solution {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] {M : DenseMatrix F} {v : Array F} (hM : M.WellFormed) {pivotRow pivotCol : } (hpivotRow : pivotRow < M.rows) (hsol : M.IsHomogeneousSolution v) :
    theorem CompPoly.DenseMatrix.isHomogeneousSolution_of_normalizeAndEliminate_solution {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] {M : DenseMatrix F} {v : Array F} (hM : M.WellFormed) {pivotRow pivotCol : } (hpivotRow : pivotRow < M.rows) (hpivot : M.get pivotRow pivotCol 0) (hsol : (M.normalizeAndEliminate pivotRow pivotCol).IsHomogeneousSolution v) :
    theorem CompPoly.DenseMatrix.rrefLoop_cols {F : Type u_1} [Field F] [BEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) :
    (rrefLoop fuel col row M pivots).matrix.cols = M.cols
    theorem CompPoly.DenseMatrix.rrefLoop_rows {F : Type u_1} [Field F] [BEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) :
    (rrefLoop fuel col row M pivots).matrix.rows = M.rows
    theorem CompPoly.DenseMatrix.rrefLoop_wf {F : Type u_1} [Field F] [BEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) :
    M.WellFormed(rrefLoop fuel col row M pivots).matrix.WellFormed
    theorem CompPoly.DenseMatrix.isHomogeneousSolution_rrefLoop_of_solution {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) {v : Array F} :
    M.WellFormedM.IsHomogeneousSolution v(rrefLoop fuel col row M pivots).matrix.IsHomogeneousSolution v
    theorem CompPoly.DenseMatrix.isHomogeneousSolution_of_rrefLoop_solution {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) {v : Array F} :
    M.WellFormed(rrefLoop fuel col row M pivots).matrix.IsHomogeneousSolution vM.IsHomogeneousSolution v