Dense variable numbering for CNF formulas #
CNF.denseRelabel φ renames each variable of a CNF formula φ by its index in φ.distinctVars.
Unlike CNF.compact (which uses first positions in φ.vars and can leave gaps when variables
repeat), CNF.denseRelabel φ maps the occurring variables bijectively onto 0, …, φ.numVars - 1
in order of first occurrence (a library adaptation to the declared-variable model of
[OAI26c]).
The renaming preserves clause lengths, clause count, numVars, Satisfiable, modelCount, and
gives φ.denseRelabel.modelCountOn (Finset.range φ.numVars) = φ.modelCount. It is computable in
polynomial time for any variable encoding, both into unary variable indices and into binary
natural-number indices (encCNF).
Main definitions #
Cslib.Logic.PL.CNF.denseRelabel: rename variables by their positions indistinctVars.
Main results #
Cslib.Logic.PL.CNF.vars_denseRelabel_toFinset,Cslib.Logic.PL.CNF.numVars_denseRelabel,Cslib.Logic.PL.CNF.distinctVars_denseRelabel,Cslib.Logic.PL.CNF.count_vars_denseRelabel,Cslib.Logic.PL.CNF.count_vars_denseRelabel_le: the occurring variables ofφ.denseRelabelare0, …, φ.numVars - 1in order, with preserved literal-occurrence counts.Cslib.Logic.PL.CNF.satisfiable_denseRelabel,Cslib.Logic.PL.CNF.modelCount_denseRelabel,Cslib.Logic.PL.CNF.modelCountOn_denseRelabel: satisfiability and model counts are preserved.Cslib.Logic.PL.CNF.computableInPolyTime_denseRelabel_unary,Cslib.Logic.PL.CNF.computableInPolyTime_denseRelabel,Cslib.Complexity.SAT.computableInPolyTime_denseRelabel: dense relabeling is computable in polynomial time.
References #
Rename each variable of φ by its index in φ.distinctVars, producing dense variable indices
0, …, φ.numVars - 1.
Instances For
Dense relabeling preserves all clause lengths in order.
Dense relabeling preserves the number of clauses.
Dense relabeling preserves any uniform upper bound on clause lengths.
The occurring variables of φ.denseRelabel are Finset.range φ.numVars.
Every variable occurring in φ.denseRelabel is strictly below φ.numVars.
Dense relabeling preserves the number of distinct occurring variables.
The distinct variables of φ.denseRelabel in order of first occurrence are
0, …, φ.numVars - 1.
Dense variable relabeling preserves the exact literal-occurrence count of every occurring variable.
Any upper bound on original literal-occurrence counts is preserved by CNF.denseRelabel.
Reading original variable values at their distinctVars indices recovers the evaluation of
φ.
Dense relabeling preserves satisfiability.
Dense relabeling preserves the occurring-variable model count.
Dense relabeling preserves the declared-variable model count on Finset.range φ.numVars.
Dense relabeling is polynomial-time into unary variable indices for any variable encoding.
Dense relabeling is polynomial-time into binary natural-number variable indices (encCNF) for
any variable encoding.
Dense variable relabeling on CNF ℕ is computable in polynomial time.