Discrete StructureUnit 87 min read
Propositional & Predicate Logic: Truth Tables, Validity, Quantifiers & Proofs
Unit 8 of Discrete Structure covers propositional logic (connectives, tautologies, contradictions), predicate logic (quantifiers, domain, scope), logical equivalences, and proof techniques (natural deduction, Fitch-style), with real-world applications in programming, database queries, and AI decision-making.
TAKEAWAYS:
- Propositional logic uses truth tables to evaluate compound statements with AND, OR, NOT, IMPLIES, and IFF.
- Predicate logic extends propositional logic with quantifiers (∀, ∃) and predicates to express statements about sets of objects.
- Logical equivalences (De Morgan’s, distributive laws) simplify complex statements into equivalent forms.
- Proof techniques like natural deduction and Fitch-style proofs systematically derive conclusions from premises.
- Real-world systems (e.g., WhatsApp’s message delivery logic, Ncell’s network routing) rely on these principles for reliability.
- Mastering truth tables and quantifier rules is critical for exam questions on validity, satisfiability, and logical forms.
Propositional Logic: Building Blocks of Reasoning
Propositional logic deals with propositions (statements that are either true or false) and logical connectives that combine them. Unlike natural language, it enforces strict rules for truth evaluation.
Key Connectives and Their Truth Tables
The five primary connectives are:
- Negation (¬P): Inverts the truth value of P.
- Conjunction (P ∧ Q): True only if both P and Q are true.
- Disjunction (P ∨ Q): True if at least one of P or Q is true.
- Implication (P → Q): False only when P is true and Q is false (read as "if P then Q").
- Biconditional (P ↔ Q): True when P and Q have the same truth value.
Worked Example: Evaluating a Compound Statement
Evaluate the truth value of (P → Q) ∧ (¬Q ∨ R) when:
- P is true, Q is false, and R is true. Solution:
- Evaluate
P → Q: Since P is true and Q is false,P → Qis false. - Evaluate
¬Q ∨ R:¬Qis true (Q is false), so the whole expression is true. - Combine with
∧:false ∧ trueis false.
Logical Equivalences: Simplifying Statements
Logical equivalences allow us to rewrite statements without changing their truth value. Key equivalences include:
1. De Morgan’s Laws
graph LR
A["¬(P ∧ Q)"] -->|"De Morgan"| B["(¬P) ∨ (¬Q)"]
C["¬(P ∨ Q)"] -->|"De Morgan"| D["(¬P) ∧ (¬Q)"]Example: Simplify ¬(A ∨ B).
Solution: By De Morgan’s, this becomes (¬A) ∧ (¬B).
2. Distributive Laws
graph LR
E["P ∧ (Q ∨ R)"] -->|"Distribute ∧"| F["(P ∧ Q) ∨ (P ∧ R)"]
G["P ∨ (Q ∧ R)"] -->|"Distribute ∨"| H["(P ∨ Q) ∧ (P ∨ R)"]3. Implication Equivalences
P → Qis equivalent to¬P ∨ Q.P ↔ Qis equivalent to(P → Q) ∧ (Q → P).
Real-World Tie-In: WhatsApp Message Delivery WhatsApp’s "Read Receipts" feature can be modeled using implication:
- Let
P= "Message is sent" andQ= "Read receipt is shown." - The rule: "If the message is sent and the recipient is online, then show the read receipt."
Formalized:
(P ∧ Online) → Q. This uses implication to ensure receipts appear only under specific conditions.
Predicate Logic: Beyond Propositions
Predicate logic extends propositional logic by introducing predicates (properties of objects) and quantifiers (∀, ∃).
Components of Predicate Logic
- Predicates: Functions that return true/false, e.g.,
Prime(x)(is x prime?). - Quantifiers:
- Universal (∀): "For all x, P(x) holds."
- Existential (∃): "There exists an x such that P(x) holds."
- Domain: The set of objects the variables range over (e.g., natural numbers, students in a class).
Example: "All even numbers are divisible by 2."
Formalized: ∀x (Even(x) → DivisibleBy2(x)).
Negating Quantifiers
graph LR
A["¬(∀x P(x))"] -->|"Equivalent to"| B["∃x ¬P(x)"]
C["¬(∃x P(x))"] -->|"Equivalent to"| D["∀x ¬P(x)"]Worked Example: NEPSE Stock Market Logic NEPSE’s trading rule: "A stock can be bought only if its price is below ₹1000 or it is a blue-chip stock." Formalize:
- Let
P(x)= "Stock x is below ₹1000." - Let
Q(x)= "Stock x is blue-chip." - Rule:
∀x (Buyable(x) → (P(x) ∨ Q(x))).
Proof Techniques in Logic
1. Natural Deduction
A step-by-step method to derive conclusions from premises using inference rules.
Example: Prove (P → Q) ∧ (Q → R) ⊢ P → R.
Proof:
- Assume
P(assumption for implication). - From
(P → Q)andP, deriveQ(Modus Ponens). - From
(Q → R)andQ, deriveR(Modus Ponens). - Conclude
P → R(discharge assumption).
2. Fitch-Style Proofs
A structured proof system with nested assumptions.
Example: Prove ∀x (P(x) → Q(x)) ⊢ (∃x P(x)) → (∃x Q(x)).
graph TD
A["1. ∀x (P(x) → Q(x))"] --> B["2. Assume ∃x P(x)"]
B --> C["3. ∴ ∃y P(y) (rename)"]
C --> D["4. Assume P(a) (∃ elimination)"]
D --> E["5. From ∀x (P(x) → Q(x)), derive P(a) → Q(a)"]
E --> F["6. From P(a) and P(a) → Q(a), derive Q(a)"]
F --> G["7. ∴ ∃x Q(x) (∃ introduction)"]
G --> H["8. Discharge assumption: (∃x P(x)) → (∃x Q(x))"]Validity and Satisfiability
- Valid Argument: An argument where the conclusion must be true if the premises are true.
- Satisfiable: A statement that is true for at least one assignment of truth values.
Example: Check if (P → Q) ∧ (Q → R) ∧ ¬P ⊢ ¬R is valid.
Solution:
- Assume premises are true:
Pis false (from¬P).P → Qis true (false implies anything is true).Q → Rmust be true, butQcould be true or false.
- If
Qis true, thenRmust be true (fromQ → R), but¬Rwould be false. Contradiction. - If
Qis false,Rcan be anything, but¬Rmay or may not hold. Conclusion: The argument is not valid because¬Rdoes not necessarily follow.
In the Real World
Khalti’s Transaction Logic
- Idea Used: Implication (
P → Q). - How: "If the user verifies their identity (
P) and enters correct credentials (Q), then process payment (R)." Formalized:(P ∧ Q) → R. - Why It Matters: Ensures payments only occur under verified conditions, reducing fraud.
- Idea Used: Implication (
Pathao’s Ride Allocation
- Idea Used: Predicate logic with quantifiers.
- How: "For every ride request
x, if there exists a driverywithin 500m (∃y Near(y, x)), then allocate the ride (Allocate(x))." Formalized:∀x (Request(x) ∧ ∃y Near(y, x)) → Allocate(x). - Why It Matters: Efficiently matches riders to nearby drivers using existential quantifiers.
NTC’s Network Routing
- Idea Used: Logical equivalences and implications.
- How: "If a packet’s destination is unreachable (
Unreachable(D)), then drop the packet (Drop(P))." Formalized:Unreachable(D) → Drop(P). - Why It Matters: Prevents infinite retries and optimizes network performance.
Exam Tip
- Truth Tables: Always list all possible truth assignments (2ⁿ rows for n variables). Partial tables lose marks.
- Predicate Logic: Clearly define your domain and variables. For example:
- Bad: "∀x P(x)."
- Good: "For all students
xin BIT Level 2,P(x)holds."
- Proofs: Structure is key. Use Fitch-style proofs for quantifiers and natural deduction for propositional logic. Label each step.
- Equivalences: Memorize De Morgan’s and distributive laws. Exams often ask to simplify or negate statements.
- Real-World Applications: Connect logic to systems like eSewa (implication for bill payments) or Daraz (quantifiers for inventory checks). Examiners love seeing these ties.
- Common Pitfalls:
- Confusing
P → QwithP ↔ Q. - Misapplying quantifier negation (e.g.,
¬∀x P(x)is not∀x ¬P(x)). - Forgetting to discharge assumptions in proofs.
- Confusing
Visual Summary for Quick Revision:
mindmap
root((Propositional & Predicate Logic))
Connectives
AND(∧)
OR(∨)
NOT(¬)
IMPLIES(→)
IFF(↔)
Truth Tables
Equivalences
De Morgan
Distributive
Predicate Logic
Quantifiers(∀, ∃)
Domain
Scope
Proofs
Natural Deduction
Fitch-Style
Real-World
Khalti(P → Q)
Pathao(∃y Near(y, x))
NTC(Unreachable → Drop)Based on the TU BIT syllabus for Discrete Structure (BIT152), unit 8.
Discussion
Loading…