Professional Documents
Culture Documents
Propositional Logic
Shin Hong
2 Sep, 2019
Textbook coverage 2
Propositional
Logic
Discrete Math.
2019-09-12
Logic 3
2019-09-12
Propositional Logic 4
• Formal grammar
P := A | C Propositional
Logic
A := p | q | r | ...
Discrete Math.
C := ¬P | (P) | P ∨ P | P ∧ P | ...
2019-09-12
Evaluation 6
2019-09-12
Implication (Conditional Statement) 7
Propositional
Logic
Discrete Math.
2019-09-12
Example 9
• De Morgan's law:
¬ 𝑝 ∧ 𝑞 ↔ ¬𝑝 ∨ ¬𝑞
¬ 𝑝 ∨ 𝑞 ↔ ¬𝑝 ∧ ¬𝑞
Propositional
Logic
Discrete Math.
2019-09-12
Propositional Satisfiability 10
2019-09-12
Logic Puzzle: Knight or Knaves 11
2019-09-12
Logic Puzzle: Treasure 12
2019-09-12
System Specification 13
2019-09-12
Application: N-Queen Problem 14
• Problem
- Place N Queens on a NxN grid, while not placing two
Queens on the same vertical, horizontal or diagonal line
• Modeling
- Proposition 𝑝𝑖,𝑗 indicates whether a Queen is placed at
the 𝑖-row and at the 𝑗-th column
𝑄1 = ሥ ሧ 𝑝𝑖,𝑗
𝑄4 = ሥ ሥ ሥ ¬(𝑝𝑖,𝑗 ∧ 𝑝𝑖−𝑘,𝑗+𝑘 )
𝑖=1..𝑛 𝑗=1..𝑛
𝑖=2..𝑛 𝑗=1..𝑛−1 𝑘=1..min(𝑖−1,𝑛−𝑗)