Encoding Problems in Propositional Logic
Context: FIT2014_MOC · turning a real-world problem into a logical formula · the clause recipes live in CNF Encoding Patterns (At Least, At Most, Exactly) Problem it solves: given an English scenario, define propositions and write a CNF formula whose satisfying assignments are exactly the valid solutions.
Quick Revision
- 🎯 Trigger: “write a Boolean expression representing …” ➔ run the four-step pipeline: choose propositions → state constraints in English → formalise each → convert to CNF.
- ⚡ Key Constraint: you cannot assume physical common sense — with propositions all assignments are candidates, so every “obvious” impossibility (one person in two seats) must be explicitly forbidden by a clause.
🔧 The four-step pipeline
- Choose propositions ➔ strip extraneous detail; index by the things that matter. Seating example: = “friend is seated in seat ” for , ⟹ propositions, hence truth assignments.
- State constraints in English ➔ list rules that exactly characterise a valid solution:
- (1) Each friend gets a seat.
- (2) No friend occupies more than one seat.
- (3) No seat is occupied by more than one friend.
- Formalise each rule ➔ translate one rule at a time (below).
- Convert to CNF ➔ push negations inward with De Morgan (Boolean Algebra Laws).
📐 Worked encoding (seating)
Rule 1 — each friend gets a seat (already a clause, hence already CNF):
Rule 2 — no friend takes two seats (forbid every pair of seats): De Morgan on each conjunct gives CNF:
Rule 3 — no seat holds two friends (same shape, over friend pairs):
- Recognise the shapes ➔ Rule 1 is “at least one”; Rules 2–3 are “at most one” (pairwise negated clauses) — exactly the templates in CNF Encoding Patterns (At Least, At Most, Exactly).
- Why CNF ➔ a uniform encoding makes problems comparable and machine-checkable; this is the standard input shape used later in complexity theory and SAT.
🔀 Translating common English forms
| English | Formula | CNF form |
|---|---|---|
| at least one of | already CNF | |
| only if | ||
| none or both of | ||
| no more than one of | pairwise not-both |
✍️ Practice
Practice: A guest list must include at least one of ; may include Hagrid only if it includes Norberta; includes none or both of Fred and George; and no more than one of . Write the whole thing in CNF.
Reference solution
- Key move: rewrite and into clauses before claiming CNF; “no more than one” expands pairwise, never as one big negated clause.
⚠️ Common Mistakes
- 💡 Nothing is implied by physics ➔ (Alice in two seats) is a perfectly legal truth assignment unless a clause forbids it; enumerate the impossibilities.
- 💡 and are not CNF ➔ a formula containing them is not yet in CNF; rewrite as and .
- 💡 “No more than one” one negated clause ➔ merely forbids all three together; the correct encoding is pairwise.
- 💡 Encoding is not unique ➔ many equivalent encodings exist; aim for one that follows directly from the English rules, which is easier to check and less error-prone.
🧠 Active Recall
Why must an encoding explicitly forbid "Alice sits in seats 13 and 14", when that is physically impossible?
Answer
- Short answer: the formula’s meaning is fixed entirely by its truth assignments — all of them are candidates, and many assign True to both and . Logic imports no physical knowledge.
- Why: Constraints define validity ➔ only clauses distinguish valid seatings from nonsense, so every real-world impossibility must appear as an explicit “at most one” clause set.