Algebraic laws and separator conditioning for weighted CSP partition functions #
This module extends Cslib.Logic.PL.CSP.partitionFunction over finite domains and arbitrary
semirings with the algebraic identities needed by variable-elimination and separator-based
algorithms:
Cslib.Logic.PL.CSP.partitionFunctionOn: partition function over a declared variable universedeclared : Finset V, scaling by|D| ^ (declared \ F.vars.toFinset).cardfor isolated variables (partitionFunctionOn_eq_card_pow_mul_partitionFunction) and recoveringmodelCountOnat0/1weights (partitionFunctionOn_boole).- Variable relabeling (
partitionFunctionOn_relabel_equiv,partitionFunction_relabel_equiv,partitionFunctionOn_denseRelabel). - Constraint conditioning (
PinnedRel,Constraint.restrictOn,restrictOn): pinning a subsetSof variables to an assignment yields a restricted CSP over free variables outsideS, and summing conditioned partition functions recovers the global partition function (partitionFunctionOn_eq_sum_restrictOn). - Disjoint-union product factorization (
partitionFunctionOn_append_of_disjoint,partitionFunction_append_of_disjoint) and separator conditioning over commutative semirings: if every shared variable ofF₁andF₂lies inS, conditioning on an assignment toSfactorizes the conditioned partition function ofF₁ ++ F₂as a product, and summing over assignments toSrecovers the partition function ofF₁ ++ F₂(partitionFunctionOn_separator,partitionFunction_separator).
Main definitions #
Cslib.Logic.PL.CSP.partitionFunctionOn: declared-variable weighted partition function.Cslib.Logic.PL.CSP.PinnedRel,Cslib.Logic.PL.CSP.Constraint.restrictOn,Cslib.Logic.PL.CSP.restrictOn: syntactic conditioning of constraints under partial assignments.Cslib.Logic.PL.CSP.pinnedWeight: weight evaluator for conditioned constraints.
Main results #
Cslib.Logic.PL.CSP.partitionFunctionOn_eq_card_pow_mul_partitionFunction: isolated variables contribute a multiplicative power of|D|.Cslib.Logic.PL.CSP.partitionFunctionOn_relabel_equiv: renaming bijection invariance.Cslib.Logic.PL.CSP.partitionFunctionOn_eq_sum_restrictOn: conditioning identity.Cslib.Logic.PL.CSP.partitionFunctionOn_append_of_disjoint: disjoint union multiplicativity.Cslib.Logic.PL.CSP.partitionFunctionOn_separator,Cslib.Logic.PL.CSP.partitionFunction_separator: separator conditioning factorization and sum recovery.
Weight of a single prepended constraint.
Weighted partition function of F over a declared variable set declared (extending
assignments outside declared by default).
The occurring-variable partition function agrees with partitionFunctionOn on
F.vars.toFinset.
Over ℕ with 0/1 weights, partitionFunctionOn recovers modelCountOn.
Semiring homomorphisms commute with partitionFunctionOn.
Prepending a constraint with empty scope scales partitionFunctionOn by its constant
weight.
Split assignments on T into assignments on S ⊆ T and T \ S, derived from
Equiv.piFinsetUnion along S ∪ (T \ S) = T.
Enlarging declared multiplies partitionFunctionOn by |D| ^ (T \ S).card whenever all
occurring variables already lie in S.
Over a declared set containing all occurring variables, isolated variables contribute a factor
of |D| ^ (declared \ F.vars.toFinset).card.
Variable renaming via an equivalence preserves partitionFunctionOn.
Variable renaming via an equivalence preserves partitionFunction.
Dense variable relabeling preserves partitionFunctionOn on Finset.range F.numVars and hence
equals F.partitionFunction wt.
A relation symbol paired with a partial-assignment template specifying which positions of the
original constraint scope were pinned (some d) or kept as free variables (none).
- rel : Rel
Underlying relation symbol.
Pattern of pinned domain values and remaining free slots.
Instances For
Condition one constraint by pinning all variables in S to α.
Condition every constraint in F by pinning variables in S to α.
Restricting over append maps cleanly across F₁ ++ F₂.
Variables remaining in a restricted CSP are exactly the variables outside S.
Occurring variables of F.restrictOn S α equal F.vars.toFinset \ S.
Weight of a restricted CSP agrees with weight of the combined assignment.
Conditioning on a subset S ⊆ declared partitions the sum over declared → D into an outer
sum over S → D and inner conditioned partition functions on declared \ S.
Product factorization of disjoint components over a commutative semiring.
Disjoint occurring variable sets yield multiplicative partition functions.
Conditioning on a separator S makes the conditioned partition functions of the two
components variable-disjoint, so the conditioned partition function factorizes as a product.
General separator conditioning over declared variables: if S ⊆ declared contains all
shared variables of F₁ and F₂, and d₁ ∪ d₂ = declared \ S splits the remaining declared
variables around F₁ and F₂, then partitionFunctionOn wt (F₁ ++ F₂) declared is the sum over
assignments α : S → D of the product of conditioned component partition functions.
Separator conditioning on occurring variables: whenever S ⊆ (F₁ ++ F₂).vars.toFinset
separates F₁ and F₂ (F₁.vars.toFinset ∩ F₂.vars.toFinset ⊆ S), summing the products of the
conditioned component partition functions over S → D recovers
partitionFunction wt (F₁ ++ F₂).