Documentation

CslibFrontier.Algorithms.WordRAM.VariableElimination.Instance

Public ElimInstance Bundle and Serialization #

Defines the word-list factor serializer encodeFactor and the public ElimInstance bundle (including initState, result, maxEntry, encode, wordBound, stepBound, ofCSP, and result_ofCSP) for bucket elimination on the exact-basis Word-RAM. Kept free of Realization and Tactic.Realize dependencies so pure clients stay lightweight.

Main definitions #

Main results #

Word-array serialization of a factor table: [f.scope.length, f.entries.size] ++ f.scope ++ f.entries.toList.

Word-RAM input bundle for bucket (variable) elimination over explicit ℕ-valued radix-indexed factor tables at finite domain size domain.

  • domain : ℕ

    Domain size d (variables range over 0, ..., domain - 1).

  • declared : List ℕ

    Declared variables to contract over (ElimState.remaining initially).

  • order : List ℕ

    Supplied variable elimination order.

  • Initial explicit radix-indexed factor tables.

Pure contracted scalar result (eliminateOrder inst.domain inst.order inst.initState).result.

Maximum entry across all initial factor tables (0 if all tables are empty).

Word-array serialization of inst: [inst.domain, inst.declared.length, inst.order.length, inst.factors.length] ++ inst.declared ++ inst.order ++ inst.factors.flatMap encodeFactor.

Word-value upper bound covering literal constants, peak memory frontier across the entire elimination run, radix powers (max 1 domain) ^ max S W, and intermediate/final weighted sums (max 1 domain) ^ order.length * (max 1 maxEntry) ^ factors.length.

Upper bound on the oracle memory cost (memoryCost) of bucket elimination along inst.order, exponential only in W = maxJointScopeLen ((max 1 domain) ^ W) with amortized M + T bucket factor evaluations.

def Cslib.Algorithms.WordRAM.VariableElimination.ElimInstance.ofCSP {Rel : Type u_1} {D : Type u_2} [Inhabited D] (d : ℕ) (e : D ≃ Fin d) (wt : Rel → List D → ℕ) (F : Logic.PL.CSP Rel ℕ) (declared order : List ℕ) :

Compile a ℕ-weighted CSP Rel ℕ over finite domain D ≃ Fin d with declared variable list declared and elimination order order into an ElimInstance.

theorem Cslib.Algorithms.WordRAM.VariableElimination.ElimInstance.result_ofCSP {Rel : Type u_1} {D : Type u_2} [Fintype D] [Inhabited D] (d : ℕ) (e : D ≃ Fin d) (wt : Rel → List D → ℕ) {F : Logic.PL.CSP Rel ℕ} {declared order : List ℕ} (hvars : F.vars.toFinset ⊆ declared.toFinset) (hcover : declared.toFinset ⊆ order.toFinset) :
(ofCSP d e wt F declared order).result = Logic.PL.CSP.partitionFunctionOn wt F declared.toFinset

ElimInstance.ofCSP evaluates to F.partitionFunctionOn wt declared.toFinset whenever declared contains all occurring variables of F and order covers declared.