Logical Modelling
Context: FIT1058_MOC · encoding real rule sets as a CNF expression · top-level conjunction of conditions · includes counting “how many are true”
Quick Revision
- 🎯 Objective: turn a set of rules into one Boolean expression ➔ rules hold together ⟹ top-level conjunction ⟹ CNF.
- 📦 Core Components: one Boolean variable per fact ➔ translate each rule ➔ AND them.
- ⚡ Key Constraint: counting constraints (at most/least/exactly ) expand to -many clauses.
📝 Core
1. The Model (Conjunction of Conditions)
- Encode ➔ rules → a single Boolean expression over chosen variables.
- Together ➔ all rules must hold ⟹ top level is ⟹ CNF.
- Translate, don’t solve ➔ modelling builds the constraint; finding an assignment is the separate satisfiability problem.
2. Rule Translation
- “at least one” ➔
- “only if” ➔ .
- “none or both” ➔ .
3. Counting Constraints (in CNF)
- At most ➔ every -subset has a False one ➔ AND of (OR of negations).
- At least ➔ every -subset has a True one ➔ AND of (OR of plain literals).
- Exactly ➔ (at least ) (at most ).
Key identities:
⚖️ Core Decision Matrix
| Rule | Logical form | CNF |
|---|---|---|
| at least one of | ||
| only if | ||
| none or both | ||
| at most one of | pairwise not-both |
When It Flips: the outermost operator is always — you cannot ignore inconvenient rules. Cardinality constraints use [[Binomial Coefficient|]]-many clauses, so encodings can grow quickly.
📊 Exam Execution Trace
Manual Execution Trace
Encoding three rules:
| Step / State | Rule | CNF clause(s) |
|---|---|---|
| 0 (Init) | — | — |
| 1 | at least one of | |
| 2 | only if | |
| 3 | at most one of |
⚠️ Common Mistakes
- 💡 “At most one” = forbid every pair ➔ a “not both” clause for each pair; AND-ing all parts gives the single CNF.
🧠 Active Recall
Why is a rule set modelled as a conjunction, and how are "Hagrid only if Norberta" / "none or both of Fred and George" encoded?
- Hint: All rules hold at once.
Answer
- Short answer: Top level is (can’t drop rules) ⟹ CNF; “only if” = ; “none or both” = .
- Why: Rewrites ➔ , .
How do you express "at most of true" and "exactly " as CNF?
- Hint: Subset clauses.
Answer
- Short answer: At most : for every -subset, OR of negations; at least : for every -subset, OR of plain literals; exactly = both.
- Why: clauses ➔ each subset forces the required True/False count.