Counting satisfying assignments #
CNF.modelCount φ is the number of satisfying assignments of a formula φ in conjunctive normal
form: the assignments of the variables occurring in φ (CNF.vars) that satisfy it. Variables
not occurring in φ are not counted, so the count does not depend on the type of variables, and
injective relabelling preserves it (CNF.modelCount_relabel). As a function of the formula this
is the counting problem #SAT Valiant.
Counts are usually computed through a map f from assignments to some finite type: if two
satisfying assignments have the same image exactly when they agree on the variables of φ, then
φ has as many satisfying assignments as there are images of satisfying assignments
(CNF.modelCount_eq_card_filter). A formula has a satisfying assignment exactly when its count
is positive (CNF.modelCount_pos_iff), and exactly one when every satisfying assignment agrees
with a given one on the variables of the formula (CNF.modelCount_eq_one_iff).
Main definitions #
Cslib.Logic.PL.CNF.numVars: the number of distinct variables of a formula.Cslib.Logic.PL.CNF.extendAssignment: an assignment of the variables of a formula, extended byfalseto all variables.Cslib.Logic.PL.CNF.modelCount: the number of satisfying assignments.
Main results #
Cslib.Logic.PL.CNF.modelCount_eq_card_filter: counting satisfying assignments through a map.Cslib.Logic.PL.CNF.modelCount_relabel: injective relabelling preserves the count.Cslib.Logic.PL.CNF.modelCount_pos_iff,Cslib.Logic.PL.CNF.modelCount_eq_one_iff.
References #
The number of distinct variables of a formula.
Instances For
A formula has at most as many distinct variables as occurrences of variables.
A formula with m clauses of at most k literals has at most k m variables.
The assignment of all variables extending an assignment τ of the variables of φ by
false.
Instances For
The number of satisfying assignments of φ: the assignments of the variables occurring
in φ that satisfy it.
Instances For
An assignment of all variables satisfies φ exactly when its restriction to the variables of
φ, extended by false, does.
Counting satisfying assignments through a map. Let f send assignments to a finite type
so that two satisfying assignments have the same image exactly when they agree on the variables
of φ. Then the satisfying assignments of φ are as many as the images of satisfying
assignments, described by P.
Relabelling along an injective map preserves the number of satisfying assignments.
A formula has a satisfying assignment exactly when its count is positive.
A formula has exactly one satisfying assignment when some assignment satisfies it and every satisfying assignment agrees with it on the variables of the formula.