Forbidden-pattern compilation from Boolean CSPs to CNF #
Every Boolean constraint (R, vs) : Constraint Rel V of scope length r = vs.length ≤ k has at
most 2 ^ r ≤ 2 ^ k forbidden local assignments w ∈ BitString.enumList r with sem R w = false.
Emitting one width-r clause Constraint.forbidClause vs w per forbidden assignment translates a
Boolean CSP instance F : CSP Rel V into an equivalent k-CNF formula F.toCNF sem on a subset
of the same variables, with no auxiliary variables and therefore multiplicative factor 1 on
satisfying assignments:
(F.toCNF sem).eval σ = F.eval sem σfor every assignmentσ : V → Bool;(F.toCNF sem).modelCountOn S = F.modelCountOn sem Sfor every declared variable setS;(F.toCNF sem).length ≤ 2 ^ k * F.lengthand every generated clause has width≤ k.
Main definitions #
Cslib.Logic.PL.Constraint.forbidClause: the clause forbidding a local bit pattern on a scope.Cslib.Logic.PL.Constraint.toCNF,Cslib.Logic.PL.Constraint.toCNFBounded: compile a Boolean constraint to CNF by forbidding falsifying patterns.Cslib.Logic.PL.CSP.toCNF,Cslib.Logic.PL.CSP.toCNFBounded: compile a Boolean CSP instance to CNF.
Main results #
Cslib.Logic.PL.Constraint.eval_forbidClause,Cslib.Logic.PL.Constraint.eval_toCNF,Cslib.Logic.PL.CSP.eval_toCNF: exact evaluation equivalence of the compiled CNF formula.Cslib.Logic.PL.CSP.satisfiable_toCNF,Cslib.Logic.PL.CSP.modelCountOn_toCNF: satisfiability and declared-variable model counts are preserved with multiplicity1.Cslib.Logic.PL.CSP.length_clause_mem_toCNFBounded,Cslib.Logic.PL.CSP.validDeclaredInput_toCNFBounded: clause-width and declared-variable bounds.
References #
- OpenAI, The Exponential Time Hypothesis is False, Appendix C (p. 52).
Consing a variable and a bit prepends the negated literal to forbidClause.
The length of forbidClause vs w is min vs.length w.length.
forbidClause vs w has at most vs.length literals.
Every variable in forbidClause vs w belongs to vs.
Relabeling forbidClause vs w maps f over the scope vs.
forbidClause vs w evaluates to false under σ if and only if vs.map σ = w (even when
vs contains repeated variables).
Compile a Boolean constraint c = (R, vs) to a CNF formula by emitting forbidClause vs w for
every forbidden local assignment w ∈ BitString.enumList vs.length with sem R w = false.
Instances For
When c.2.length ≤ k, toCNFBounded k sem c agrees with toCNF sem c.
Every clause in c.toCNFBounded k sem has length at most k.
c.toCNF sem contains at most 2 ^ c.2.length clauses.
Every variable occurring in c.toCNFBounded k sem belongs to the constraint scope c.2.
Relabeling commutes with Constraint.toCNF.
Relabeling commutes with Constraint.toCNFBounded.
The forbidden-assignment CNF compilation of a constraint has the exact same truth value under
every assignment σ : V → Bool as the constraint itself.
Every clause in F.toCNFBounded k sem has length at most k.
When all constraint scopes in F have length ≤ k, every clause in F.toCNF sem has length
at most k.
Every variable occurring in F.toCNFBounded k sem occurs in F.vars.
Relabeling commutes with CSP.toCNFBounded.
Forbidden-assignment CNF compilation preserves declared-variable model counts on every finite
variable set declared with multiplicity 1 (no auxiliary variables).
If F passes validDeclaredCSP k N, then F.toCNFBounded k sem passes
CNF.validDeclaredInput k N.