Dense Row-Operation Correctness #
Correctness lemmas for executable dense row operations.
theorem
CompPoly.DenseMatrix.index_lt_of_lt
{F : Type u_1}
[Zero F]
{M : DenseMatrix F}
(hM : M.WellFormed)
{row col : ℕ}
(hrow : row < M.rows)
(hcol : col < M.cols)
:
theorem
CompPoly.DenseMatrix.swapRows_cols
{F : Type u_1}
[Zero F]
(M : DenseMatrix F)
(rowA rowB : ℕ)
:
theorem
CompPoly.DenseMatrix.swapRows_rows
{F : Type u_1}
[Zero F]
(M : DenseMatrix F)
(rowA rowB : ℕ)
:
theorem
CompPoly.DenseMatrix.swapRows_wf
{F : Type u_1}
[Zero F]
{M : DenseMatrix F}
(hM : M.WellFormed)
(rowA rowB : ℕ)
:
(M.swapRows rowA rowB).WellFormed
theorem
CompPoly.DenseMatrix.swapRows_get_left
{F : Type u_1}
[Zero F]
{M : DenseMatrix F}
(hM : M.WellFormed)
{rowA rowB col : ℕ}
(hrowA : rowA < M.rows)
(hcol : col < M.cols)
:
theorem
CompPoly.DenseMatrix.swapRows_get_right
{F : Type u_1}
[Zero F]
{M : DenseMatrix F}
(hM : M.WellFormed)
{rowA rowB col : ℕ}
(hrowB : rowB < M.rows)
(hcol : col < M.cols)
:
theorem
CompPoly.DenseMatrix.list_forIn_addScaledRow_rows
{F : Type u_1}
[Field F]
(rows : List ℕ)
(pivotRow pivotCol : ℕ)
(out : DenseMatrix F)
:
(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.rows = out.rows
theorem
CompPoly.DenseMatrix.list_forIn_addScaledRow_cols
{F : Type u_1}
[Field F]
(rows : List ℕ)
(pivotRow pivotCol : ℕ)
(out : DenseMatrix F)
:
(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.cols = out.cols
theorem
CompPoly.DenseMatrix.normalizeAndEliminate_cols
{F : Type u_1}
[Field F]
[BEq F]
(M : DenseMatrix F)
(pivotRow pivotCol : ℕ)
:
theorem
CompPoly.DenseMatrix.normalizeAndEliminate_rows
{F : Type u_1}
[Field F]
[BEq F]
(M : DenseMatrix F)
(pivotRow pivotCol : ℕ)
:
theorem
CompPoly.DenseMatrix.scaleRow_wf
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
(hM : M.WellFormed)
(row : ℕ)
(factor : F)
:
(M.scaleRow row factor).WellFormed
theorem
CompPoly.DenseMatrix.addScaledRow_get_of_row_ne
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
{target source row col : ℕ}
(factor : F)
(hcol : col < M.cols)
(hneq : target ≠ row)
:
theorem
CompPoly.DenseMatrix.addScaledRow_wf
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
(hM : M.WellFormed)
(target source : ℕ)
(factor : F)
:
(M.addScaledRow target source factor).WellFormed
theorem
CompPoly.DenseMatrix.addScaledRow_get_same
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
(hM : M.WellFormed)
{target source col : ℕ}
(htarget : target < M.rows)
(hcol : col < M.cols)
(factor : F)
:
theorem
CompPoly.DenseMatrix.dotRow_scaleRow_same
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
(hM : M.WellFormed)
{row : ℕ}
(hrow : row < M.rows)
(factor : F)
(v : Array F)
:
theorem
CompPoly.DenseMatrix.dotRow_addScaledRow_same
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
(hM : M.WellFormed)
{target source : ℕ}
(htarget : target < M.rows)
(factor : F)
(v : Array F)
:
theorem
CompPoly.DenseMatrix.dotRow_swapRows_left
{F : Type u_1}
[Semiring F]
{M : DenseMatrix F}
(hM : M.WellFormed)
{rowA rowB : ℕ}
(hrowA : rowA < M.rows)
(v : Array F)
:
theorem
CompPoly.DenseMatrix.dotRow_swapRows_right
{F : Type u_1}
[Semiring F]
{M : DenseMatrix F}
(hM : M.WellFormed)
{rowA rowB : ℕ}
(hrowB : rowB < M.rows)
(v : Array F)
:
theorem
CompPoly.DenseMatrix.dotRow_addScaledRow_of_ne
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
{target source row : ℕ}
(factor : F)
(hneq : target ≠ row)
(v : Array F)
:
theorem
CompPoly.DenseMatrix.isHomogeneousSolution_swapRows_of_solution
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
{v : Array F}
{rowA rowB : ℕ}
(hM : M.WellFormed)
(hrowA : rowA < M.rows)
(hrowB : rowB < M.rows)
(hsol : M.IsHomogeneousSolution v)
:
(M.swapRows rowA rowB).IsHomogeneousSolution v
theorem
CompPoly.DenseMatrix.isHomogeneousSolution_scaleRow_of_solution
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
{v : Array F}
{target : ℕ}
(hM : M.WellFormed)
(htarget : target < M.rows)
(factor : F)
(hsol : M.IsHomogeneousSolution v)
:
(M.scaleRow target factor).IsHomogeneousSolution v
theorem
CompPoly.DenseMatrix.isHomogeneousSolution_addScaledRow_of_solution
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
{v : Array F}
{target source : ℕ}
(hM : M.WellFormed)
(htarget : target < M.rows)
(hsource : source < M.rows)
(factor : F)
(hsol : M.IsHomogeneousSolution v)
:
(M.addScaledRow target source factor).IsHomogeneousSolution v
theorem
CompPoly.DenseMatrix.isHomogeneousSolution_of_swapRows_solution
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
{v : Array F}
{rowA rowB : ℕ}
(hM : M.WellFormed)
(hrowA : rowA < M.rows)
(hrowB : rowB < M.rows)
(hsol : (M.swapRows rowA rowB).IsHomogeneousSolution v)
:
theorem
CompPoly.DenseMatrix.isHomogeneousSolution_of_scaleRow_solution
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
{v : Array F}
{target : ℕ}
(hM : M.WellFormed)
(htarget : target < M.rows)
{factor : F}
(hfactor : factor ≠ 0)
(hsol : (M.scaleRow target factor).IsHomogeneousSolution v)
:
theorem
CompPoly.DenseMatrix.isHomogeneousSolution_of_addScaledRow_solution
{F : Type u_1}
[Field F]
{M : DenseMatrix F}
{v : Array F}
{target source : ℕ}
(hM : M.WellFormed)
(htarget : target < M.rows)
(hsource : source < M.rows)
(hts : target ≠ source)
(factor : F)
(hsol : (M.addScaledRow target source factor).IsHomogeneousSolution v)
: