Documentation

CompPoly.LinearAlgebra.Dense.RrefShape

Dense RREF Shape Correctness #

Pivot-column and processed-column invariants for dense row reduction.

def CompPoly.DenseMatrix.PivotColumnsShaped {F : Type u_1} [Zero F] [One F] (M : DenseMatrix F) (pivots : Array ) :

Recorded pivot columns have the reduced-column shape expected of RREF.

Instances For
    theorem CompPoly.DenseMatrix.swapRows_preserves_column_shape_of_ne {F : Type u_1} [Zero F] [One F] {M : DenseMatrix F} (hM : M.WellFormed) {rowA rowB pivot oldCol : } (hrowA : rowA < M.rows) (hrowB : rowB < M.rows) (hcol : oldCol < M.cols) (hA : rowA pivot) (hB : rowB pivot) (hshape : ∀ (row : ), row < M.rowsM.get row oldCol = if row = pivot then 1 else 0) (row : ) :
    row < (M.swapRows rowA rowB).rows(M.swapRows rowA rowB).get row oldCol = if row = pivot then 1 else 0
    theorem CompPoly.DenseMatrix.list_forIn_addScaledRow_get_of_not_mem {F : Type u_1} [Field F] (rows : List ) {out : DenseMatrix F} {row col pivotRow pivotCol : } (hcol : col < out.cols) (hnot : ¬row rows) :
    (forIn rows out fun (r : ) (M : DenseMatrix F) => if r = pivotRow then pure (ForInStep.yield M) else pure (ForInStep.yield (M.addScaledRow r pivotRow (-M.get r pivotCol)))).run.get row col = out.get row col
    theorem CompPoly.DenseMatrix.list_forIn_addScaledRow_get_pivotRow {F : Type u_1} [Field F] (rows : List ) {out : DenseMatrix F} {pivotRow pivotCol : } (hcol : pivotCol < out.cols) (hpivot : out.get pivotRow pivotCol = 1) :
    (forIn rows out fun (row : ) (M : DenseMatrix F) => if row = pivotRow then pure (ForInStep.yield M) else pure (ForInStep.yield (M.addScaledRow row pivotRow (-M.get row pivotCol)))).run.get pivotRow pivotCol = 1
    theorem CompPoly.DenseMatrix.list_forIn_addScaledRow_get_row_mem {F : Type u_1} [Field F] (rows : List ) {out : DenseMatrix F} {row pivotRow pivotCol : } (hout : out.WellFormed) (hpivotRow : pivotRow < out.rows) (hcol : pivotCol < out.cols) (hpivot : out.get pivotRow pivotCol = 1) (hrows : ∀ (r : ), r rowsr < out.rows) (hnodup : rows.Nodup) (hmem : row rows) (hne : row pivotRow) :
    (forIn rows out fun (r : ) (M : DenseMatrix F) => if r = pivotRow then pure (ForInStep.yield M) else pure (ForInStep.yield (M.addScaledRow r pivotRow (-M.get r pivotCol)))).run.get row pivotCol = 0
    theorem CompPoly.DenseMatrix.list_forIn_addScaledRow_get_of_source_zero {F : Type u_1} [Field F] (rows : List ) {out : DenseMatrix F} {row pivotRow oldCol pivotCol : } (hout : out.WellFormed) (hcol : oldCol < out.cols) (hrows : ∀ (r : ), r rowsr < out.rows) (hsource : out.get pivotRow oldCol = 0) :
    (forIn rows out fun (r : ) (M : DenseMatrix F) => if r = pivotRow then pure (ForInStep.yield M) else pure (ForInStep.yield (M.addScaledRow r pivotRow (-M.get r pivotCol)))).run.get row oldCol = out.get row oldCol
    theorem CompPoly.DenseMatrix.normalizeAndEliminate_get_pivot {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] {M : DenseMatrix F} (hM : M.WellFormed) {pivotRow pivotCol : } (hpivotRow : pivotRow < M.rows) (hpivotCol : pivotCol < M.cols) (hpivot : M.get pivotRow pivotCol 0) :
    (M.normalizeAndEliminate pivotRow pivotCol).get pivotRow pivotCol = 1
    theorem CompPoly.DenseMatrix.normalizeAndEliminate_get_row_pivot {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] {M : DenseMatrix F} (hM : M.WellFormed) {pivotRow pivotCol row : } (hpivotRow : pivotRow < M.rows) (hpivotCol : pivotCol < M.cols) (hrow : row < M.rows) (hne : row pivotRow) (hpivot : M.get pivotRow pivotCol 0) :
    (M.normalizeAndEliminate pivotRow pivotCol).get row pivotCol = 0
    theorem CompPoly.DenseMatrix.normalizeAndEliminate_get_of_pivotRow_zero {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] {M : DenseMatrix F} (hM : M.WellFormed) {pivotRow pivotCol oldCol row : } (hpivotRow : pivotRow < M.rows) (holdCol : oldCol < M.cols) (hpivotZero : M.get pivotRow oldCol = 0) :
    (M.normalizeAndEliminate pivotRow pivotCol).get row oldCol = M.get row oldCol
    theorem CompPoly.DenseMatrix.rrefLoop_pivots_size_le_rows {F : Type u_1} [Field F] [BEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) :
    row M.rows(rrefLoop fuel col row M pivots).pivots.size pivots.size + (M.rows - row)

    All recorded pivot columns are strictly before the current scan column.

    Instances For

      Pivot columns are strictly increasing in pivot-row order.

      Instances For
        theorem CompPoly.DenseMatrix.pivotColumnsBefore_mono {pivots : Array } {col next : } (h : PivotColumnsBefore pivots col) (hcol : col < next) :
        PivotColumnsBefore pivots next
        theorem CompPoly.DenseMatrix.pivotColumnsBefore_push {pivots : Array } {col next : } (h : PivotColumnsBefore pivots col) (hcol : col < next) :
        PivotColumnsBefore (pivots.push col) next
        theorem CompPoly.DenseMatrix.pivotColumnsStrict_push {pivots : Array } {col : } (hstrict : PivotColumnsStrict pivots) (hbefore : PivotColumnsBefore pivots col) :
        theorem CompPoly.DenseMatrix.pivotColumnsStrict_getD_ne {pivots : Array } (hstrict : PivotColumnsStrict pivots) {i j : } (hi : i < pivots.size) (hj : j < pivots.size) (hne : i j) :
        pivots.getD i 0 pivots.getD j 0
        theorem CompPoly.DenseMatrix.rrefLoop_pivots_getD_lt_cols {F : Type u_1} [Field F] [BEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) :
        (∀ (i : ), i < pivots.sizepivots.getD i 0 < M.cols)∀ (i : ), i < (rrefLoop fuel col row M pivots).pivots.size(rrefLoop fuel col row M pivots).pivots.getD i 0 < M.cols
        theorem CompPoly.DenseMatrix.rrefLoop_pivotColumnsStrict {F : Type u_1} [Field F] [BEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) :
        PivotColumnsBefore pivots colPivotColumnsStrict pivotsPivotColumnsStrict (rrefLoop fuel col row M pivots).pivots
        theorem CompPoly.DenseMatrix.rrefLoop_pivotColumnsShaped {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) :
        M.WellFormedrow = pivots.sizePivotColumnsBefore pivots colM.PivotColumnsShaped pivots(rrefLoop fuel col row M pivots).matrix.PivotColumnsShaped (rrefLoop fuel col row M pivots).pivots
        def CompPoly.DenseMatrix.ProcessedColumnsZeroBelow {F : Type u_1} [Zero F] (M : DenseMatrix F) (activeRow col : ) :

        All rows at or below the active pivot row are zero in already-scanned columns.

        Instances For
          theorem CompPoly.DenseMatrix.processedColumnsZeroBelow_pivot_step {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] {M : DenseMatrix F} (hM : M.WellFormed) {row col pivotRow : } (hrow : row < M.rows) (hcol : col < M.cols) (hpivotLt : pivotRow < M.rows) (hpivotGe : row pivotRow) (hpivotSwap : (M.swapRows pivotRow row).get row col 0) (hproc : M.ProcessedColumnsZeroBelow row col) :
          ((M.swapRows pivotRow row).normalizeAndEliminate row col).ProcessedColumnsZeroBelow (row + 1) (col + 1)
          theorem CompPoly.DenseMatrix.rrefLoop_processedColumnsZeroBelow {F : Type u_1} [Field F] [BEq F] [LawfulBEq F] (fuel col row : ) (M : DenseMatrix F) (pivots : Array ) :
          M.WellFormedrow = pivots.sizerow M.rowsM.cols col + fuelM.ProcessedColumnsZeroBelow row col(rrefLoop fuel col row M pivots).matrix.ProcessedColumnsZeroBelow (rrefLoop fuel col row M pivots).pivots.size M.cols