Implications and Equivalences Between Booleans
Translate logical implications and biconditionals between boolean variables into CP-SAT constraints using OnlyEnforceIf.
Step 1 of 157%
Tutorial
Implications
In constraint programming, we often need to express logical relationships between boolean variables. The most basic is the implication read as "if then ."
The truth table is
The implication is false only when and a false hypothesis makes the implication vacuously true.
To encode in OR-Tools' CP-SAT, we use
This activates the constraint exactly when is true. When the constraint is dormant, so may take either value -- matching the truth table.