Proofs: Structured Gaussian elimination
These are the human proofs of Structured Gaussian elimination, at full length.
Correctness of structured Gaussian elimination full
This proof shows: correctness, termination.
We prove that STRUCTURED-GE returns a solution of when one exists and reports "inconsistent" otherwise, and that it terminates. Notation is as on the main page: during the loop each column is in exactly one of (light), (heavy), (eliminated by a pivot) or (free, removed on line L3), and each row is active or set aside as a pivot row. We write rows together with their right-hand sides, so a row operation also acts on .
Termination. Each pass of the loop removes one column from , on line L3, L4, L5 or L6, and moves it to , , or . So the loop runs at most times, and every pass, the dense solve and the back-substitution are finite.
Invariant. At the start of each pass of the loop:
- (Equivalence) The system made of the active rows and the pivot rows set aside has the same solutions as .
- (Cleared columns) No active row has a nonzero entry in a column of .
- (Shape of pivot rows) Each pivot in has in the stored row , and every other column with in that stored row is in or , or is in through a pivot appended to after , or is still in .
Initialization. At the start, is , and is empty.
Maintenance. Consider one pass.
- Line L3: column has weight , so no active row meets it, and part 2 holds with . Part 3 still holds, since is allowed in pivot rows. Nothing else changes.
- Line L4: column has weight , with its only active entry in row . Setting row aside changes neither nor any active row, so part 1 holds. No active row meets any more, so part 2 holds. For part 3, the new pivot has ; the other entries of row are not in by part 2 (row was active), so they are in or in . Older pivots are unaffected, except that a column of appearing in an older pivot row has now moved to through a pivot appended after it, which is allowed.
- Line L5: row has exactly one entry in , in column , and by part 2 none in , so its nonzero entries are and entries in . Each active row with is replaced by row minus times row . This is an invertible operation on , since row stays in as a pivot row, so part 1 holds. The new row has a zero in column , and its other entries change only in columns of , so it still has no entry in : part 2 holds with . Part 3 holds for because its other entries are in , and for older pivots as in the case of line L4.
- Line L6: a column moves from to . Parts 1 and 2 are unchanged, and part 3 still holds because only grows.
After the loop. , so by part 2 every active row has its nonzero entries in only. By part 3, each stored pivot row has its other nonzero entries in , in , or in columns pivoted after .
Inconsistent systems. If line L7 finds the active rows, restricted to , inconsistent, then no assignment of the heavy unknowns satisfies them. Since these rows involve no other unknowns, no satisfies them, so has no solution, and by part 1 neither has . The report is correct.
Consistent case. Otherwise line L7 gives values for satisfying all active rows. Free unknowns keep the value and appear in no active row. Line L8 processes the pivots from the last to the first. When is processed, every unknown with in row is in or , whose values are fixed, or was pivoted after and has therefore already received its value; its value does not change later, because each unknown is the column of exactly one pivot. Since , setting makes row hold, and it stays true because none of its unknowns changes afterwards. Unknowns in and are never assigned on line L8, because the columns of pivots are in . So at the end every active row and every pivot row holds: solves , and by part 1 it solves .