Exactly-one constraints #
CNF.exactlyOne vs holds exactly when one variable of the list vs is true: one clause asks
for at least one of them, and one binary clause for each pair of distinct variables forbids two.
This is the standard one-hot encoding of a finite-valued quantity by Boolean variables.
CNF.atMostOne emits a clause for every ordered pair of distinct variables, so each pair appears
twice. The quadratic size is the same as for unordered pairs, and the semantics
(CNF.eval_atMostOne) then holds for lists with repetitions too, without a Nodup hypothesis.
Main definitions #
Main results #
Cslib.Logic.PL.CNF.eval_exactlyOne: the semantics.Cslib.Logic.PL.CNF.eq_true_iff_of_eval_exactlyOne: once one variable of the list is known to be true, every variable of the list is true exactly when it is that one.Cslib.Logic.PL.CNF.fst_mem_of_mem_exactlyOne: the variables of the constraints are those of the list.
References #
At least one variable of vs is true.
Instances For
No two distinct variables of vs are true.
Instances For
Exactly one variable of vs is true.
Instances For
The variables of CNF.atMostOne vs are among vs.
The variables of CNF.exactlyOne vs are among vs.
CNF.exactlyOne vs holds exactly when some variable of vs is true and no two distinct
variables of vs are.
If exactly one variable of vs is true and x ∈ vs is true, then each y ∈ vs is true
exactly when y = x.
An assignment that makes exactly the variable x ∈ vs true among vs satisfies
CNF.exactlyOne vs.
CNF.eq_true_iff_of_eval_exactlyOne for the one-hot encoding l.map f of a quantity ranging
over l, along an injective naming f of its values.
CNF.eval_exactlyOne_of_iff for the one-hot encoding l.map f.