Parameterized computation core for the Bareiss elimination #
A computable model of a ring packages the representation the untrusted producer computes
with: a value type V, its arithmetic (RingOps V), and the encoding between entry
syntax and values. mkProducer assembles a Producer from a model's parts, and the
tactic selects a model through the bareiss_ext extension registry.
Main definitions #
RingOps: the arithmetic of a model's value type.bareissDecomp: fraction-free Gaussian elimination over a model's values.mkProducer: assemble a producer from a model's parts.bareiss_ext: the attribute registering aBareissExtcomputation model.
Implementation notes #
The elimination in bareissDecomp maintains the invariant L * A_σ = W, where
A_σ := A.submatrix σ id is the input with its rows in the arrangement σ accumulated
so far and W is the working matrix. When the pivot search swaps the rows at positions
r < p, the invariant must be restored against the new A_σ' = S * A_σ, where S is
the permutation matrix of the transposition τ = (r, p):
S * W = S * L * (S⁻¹ * S) * A_σ = (S * L * S⁻¹) * A_σ'
so L is conjugated by the matrix of τ, as in LU factorisation with partial pivoting.
References #
Arithmetic of a model's value type.
- zero : V
The zero value.
- one : V
The one value.
- mul : V → V → V
Multiplication.
- sub : V → V → V
Subtraction.
- divExact : V → V → V
Exact division: total on the quotients of the elimination
- isZero : V → Bool
The pivot zero test.
Instances For
Decomposition data with entries in V: the values of the elimination, or the
ring expressions constructed (V := Expr).
The lower-triangular transform.
The row swaps, in order. Stores the swaps instead of row re-indexing, since in common cases swaps are infrequent and therefore produce a smaller term to be checked by the kernel. The row permutation
σis later constructed by their product.The pivot columns. The
k-th entry is the column of the pivot in rowkof the final echelon form.
Instances For
Map over the entries of the transform.
Equations
- Mathlib.Tactic.Echelon.BareissData.mapM f d = do let __do_lift ← Array.mapM (fun (x : Array V) => Array.mapM f x) d.L pure { L := __do_lift, swaps := d.swaps, pivot := d.pivot }
Instances For
A producer: run the elimination on the entries of a matrix literal, returning the decomposition constructed.
Equations
Instances For
Core algorithm of fraction-free Gaussian elimination, with the arithmetic supplied by the model.
A single sweep accumulates the transform L alongside the working matrix W, maintaining
L * (A.submatrix σ id) = W for the row arrangement σ so far. The divisions are exact
by Sylvester's identity, although the data-only computation does not prove that.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Assemble a producer from a computation model's parts.
ops describes the ring operation structure;
prepare reifies the entries into the values the elimination runs on, plus a
function restoring the resulting decomposition to one of the original matrix;
mkEntry constructs the value back in the ring.
Equations
- One or more equations did not get rendered due to their size.
Instances For
An extension of the Bareiss ring computation model.
- producer? (R : Lean.Expr) : Lean.MetaM (Option Producer)
The computation model for the ring type
R, ornoneif the extension does not handleR.
Instances For
Read a bareiss_ext extension from a declaration of the right type.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Environment extension for the bareiss_ext computation models.
Uses a simple array to store the name-extension pairs for now.