Declared-variable CNF instances, unary decoding, and malformed-word rejection #
This module packages declared-universe CNF instances as DeclaredCNF (number of declared Boolean
variables numVars together with a CNF ℕ formula), declares its canonical encoding
encDeclaredCNF using encUnary for numVars and encCNF for formula, and constructs the
total decoder, well-formedness check, and malformed-word rejection predicate.
Main definitions #
Cslib.Complexity.DeclaredCNF: structure pairingnumVarsandformula : CNF ℕ.Cslib.Complexity.encDeclaredCNF: bit encoding viaencUnaryandencCNF.Cslib.Complexity.DeclaredSAT: well-formed satisfiable declared-variable CNF instances.Cslib.Complexity.declaredCNFDecoder: total polynomial-time decoder invertingencDeclaredCNF.Cslib.Complexity.declaredCNFCode: polynomial-time recognizer rejecting malformed words and out-of-range variables.Cslib.Complexity.DeclaredCNF.ofStdSat: conversion fromStd.Sat.CNF (Fin n)preserving well-formedness and model counts.
Main results #
Cslib.Complexity.declaredCNFDecoder_decode_enc: round-trip inversion ofencDeclaredCNF.Cslib.Complexity.declaredCNFCode_eq_true_iff,Cslib.Complexity.computableInPolyTime_declaredCNFCode: characterization and polynomial-time decidability of valid encodedDeclaredCNFwords.Cslib.Complexity.DeclaredCNF.modelCount_ofStdSat: declared model-count agreement withStd.Sat.CNF (Fin n).
A CNF formula paired with an explicit upper bound numVars on its variable indices.
- numVars : ℕ
Number of declared variables (
0, …, numVars - 1). - formula : Logic.PL.CNF ℕ
The CNF formula over natural-number variable labels.
Instances For
The tuple of the fields of encDeclaredCNF.
Canonical bit encoding of DeclaredCNF: unary variable bound encUnary followed by the
binary-variable CNF encoding encCNF.
Boolean check for WellFormed.
x.wellFormed = true iff every occurring variable is strictly less than x.numVars.
validDeclaredInput k x.numVars x.formula implies x.WellFormed.
Checking WellFormed on DeclaredCNF is computable in polynomial time.
Embed a finite-variable Std.Sat.CNF (Fin n) formula into DeclaredCNF.
Every DeclaredCNF.ofStdSat f is well-formed.
Declared-universe model count over Finset.range x.numVars.
Declared model counting on DeclaredCNF.ofStdSat f recovers the exact number of satisfying
assignments Fin n → Bool of f.
Well-formed declared-universe satisfiable CNF instances.
A Std.Sat.CNF (Fin n) maps into DeclaredSAT iff it is not Unsat.
Total polynomial-time decoder for encDeclaredCNF.
Round-trip law for declaredCNFDecoder.
Exact membership predicate for well-formed binary words encoding a DeclaredCNF instance;
rejects both malformed framed bit words and out-of-range variable labels.
On any encoded DeclaredCNF, declaredCNFCode reduces directly to x.wellFormed.
A word satisfies declaredCNFCode iff it is the exact encoding of a well-formed
DeclaredCNF.
Rejecting malformed DeclaredCNF words is computable in polynomial time.