Weight-cost, bit-length bounds, and encoded factor tables for variable elimination #
This module analyses weight growth and binary representation cost of variable elimination
(Cslib.Algorithms.Lean.CSP.eliminateOrder) over integer (ℤ), rational (ℚ), and finite-field
(ZMod p) weights, together with concrete enc_structure-encoded factor table records:
- Integers (
ℤ): Using a subtree step-and-multiplicity budget invariant alongeliminateOrder, every intermediate table entryzand final contraction result satisfyz.natAbs ≤ d ^ order.length * W ^ init.live.length, avoiding doubly-exponential bit growth and keepingencIntBin zwithinorder.length * d.size + init.live.length * W.size + 3bits (natAbs_entry_eliminateOrder_le,length_encIntBin_entry_eliminateOrder_le). - Finite fields (
ZMod p,NeZero p): Every intermediate entry remains belowp, soCslib.TreeEval.Ary.Iter.encField puses at mostp.sizebits per entry and actual encoded bit storageliveFieldBits pat any prefix steporder.take kis bounded bypeakLiveEntries d order init * p.size(liveFieldBits_eliminateOrder_take_le_peak,liveFieldBits_eliminateOrder_le). - Rationals (
ℚ): Direct fraction reduction satisfiesden (a + b) ≤ a.den * b.den,|num (a + b)| ≤ |a.num| * b.den + |b.num| * a.den, and multiplicative step bounds onelimBucketTable(rat_elimBucketTable_bounds, bounded underTuring.MultiTapeTM.encRat). Clearing a positive common denominatorD_i ≤ Dper initial factor reduces rational elimination to integer elimination plus a single division by∏ D_i ≤ D ^ M₀(result_eliminateOrder_ratScaled), giving linear result bit-length underencRat(length_encRat_cleared_result_le). - Encoded records (
#4391):NatFactorRecord,IntFactorRecord,RatFactorRecord, andModFactorRecordpaired withenc_structuremulti-tape encodings and conversions toFactorTable.
Main definitions #
Cslib.Algorithms.Lean.CSP.mapFactorHom,Cslib.Algorithms.Lean.CSP.scaleFactor: ring-homomorphism transport and factor scaling.Cslib.Algorithms.Lean.CSP.liveFieldBits: totalencField pbit length of live finite-field tables.Cslib.Algorithms.Lean.CSP.NatFactorRecord,Cslib.Algorithms.Lean.CSP.IntFactorRecord,Cslib.Algorithms.Lean.CSP.RatFactorRecord,Cslib.Algorithms.Lean.CSP.ModFactorRecord: documented monomorphic factor records withenc_structureencodings.
Main results #
Cslib.Algorithms.Lean.CSP.natAbs_entry_eliminateOrder_le,Cslib.Algorithms.Lean.CSP.length_encIntBin_entry_eliminateOrder_le: integer weight and bit-length bounds acrosseliminateOrder.Cslib.Algorithms.Lean.CSP.liveFieldBits_eliminateOrder_take_le_peak,Cslib.Algorithms.Lean.CSP.liveFieldBits_eliminateOrder_le: finite-field bit-storage bounds at every elimination prefixorder.take k.Cslib.Algorithms.Lean.CSP.rat_elimBucketTable_bounds,Cslib.Algorithms.Lean.CSP.result_eliminateOrder_ratScaled,Cslib.Algorithms.Lean.CSP.length_encRat_cleared_result_le: rational elimination fraction andencRatbit-length bounds.
Integer (ℤ) weight growth and encIntBin bounds #
Final ℤ scalar contraction result has magnitude at most
d ^ order.length * W ^ factors.length.
Every live ℤ entry produced at any step along order has magnitude at most
d ^ order.length * W ^ factors.length.
Every live ℤ entry throughout order has binary code length at most
order.length * d.size + factors.length * W.size + 3 under encIntBin.
Total encoded bit length across all live ZMod p factor tables using
Cslib.TreeEval.Ary.Iter.encField p.
Any list of ZMod p factor tables has total encField bit length at most
liveEntries live * p.size.
Encoded bit storage across all live ZMod p factor tables at every prefix order.take k
is bounded by peakLiveEntries d order init * p.size.
Encoded bit storage across all live ZMod p factor tables at every prefix order.take k
is bounded by init.live.length times the intermediate-scope table bound times p.size.
Rational (ℚ) direct step bounds and denominator-cleared polynomial bounds #
Height and denominator bounds for a sum over Finset.range c of bounded rationals.
Single-step direct rational elimination bounds on elimBucketTable d x bucket.
Ring-homomorphism transport on factor tables (entries.map φ).
Uniform scaling of every entry of a factor table (c * ·).
Scaling a factor list entrywise multiplies contractionOn by the product of the scales.
Denominator-cleared rational variable elimination: scaling integer factor tables factorsℤ
by positive denominators denoms preserves the exact rational contraction modulo a single division
by denoms.prod.
Cleared-denominator rational contraction height and denominator bounds.
Under cleared denominators, the encRat bit length of the final contraction result is linear
in order.length and factorsℤ.length.
Documented encoded factor-table records (enc_structure) #
Multi-tape binary encoding of NatFactorRecord.
Multi-tape binary encoding of IntFactorRecord.
Multi-tape binary encoding of RatFactorRecord.
Multi-tape binary encoding of ModFactorRecord.
Convert a NatFactorRecord into a FactorTable ℕ ℕ.
Convert an IntFactorRecord into a FactorTable ℤ ℕ.
Convert a RatFactorRecord into a FactorTable ℚ ℕ.
Convert a ModFactorRecord into a FactorTable (ZMod rec.modulus) ℕ.
Encoded bit length of an IntFactorRecord bounded by variable and entry bit lengths.
Encoded bit length of a RatFactorRecord bounded by scope variable and encRat entry
lengths.
Encoded bit length of a ModFactorRecord bounded by modulus, scope variable, and residue bit
lengths.