Lecture 2: Deep Dive into Implication
Understanding Implication
Truth Table:
| \( p \) | \( q \) | \( p \to q \) |
|---|---|---|
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
When the hypothesis is false, the implication is vacuously true regardless of the conclusion. This is called a vacuous truth. Example: "If the moon is made of cheese, then I am the king of France" is considered true because the hypothesis is false.
Variants of Implication
Important: \( p \to q \not\equiv q \to p \) in general.
Example: "If it rains, the ground is wet" does not mean "If the ground is wet, it rained" (could be a sprinkler).
Critical Property: \( p \to q \equiv \neg q \to \neg p \) (always logically equivalent!)
Example: "If it rains, the ground is wet" is equivalent to "If the ground is not wet, it did not rain."
Important: \( p \to q \not\equiv \neg p \to \neg q \) in general.
Note: The inverse is the contrapositive of the converse.
- Original \( p \to q \) is equivalent to its contrapositive \( \neg q \to \neg p \)
- Converse \( q \to p \) is equivalent to inverse \( \neg p \to \neg q \)
- But original is NOT equivalent to converse or inverse
Important Equivalences for Implication
This is the most fundamental equivalence for implication. It shows that an implication can always be rewritten as a disjunction.
| \( p \) | \( q \) | \( \neg p \) | \( p \to q \) | \( \neg p \lor q \) |
|---|---|---|---|---|
| T | T | F | T | T |
| T | F | F | F | F |
| F | T | T | T | T |
| F | F | T | T | T |
To negate an implication, the hypothesis must be true AND the conclusion must be false.
This is WRONG! The correct negation is \( p \land \neg q \).
Predicate Logic Equivalences
Quantifier Equivalences
- \( \neg (\forall x \, P(x)) \equiv \exists x \, \neg P(x) \)
- \( \neg (\exists x \, P(x)) \equiv \forall x \, \neg P(x) \)
- \( \forall x \, (P(x) \land Q(x)) \equiv (\forall x \, P(x)) \land (\forall x \, Q(x)) \)
- \( \exists x \, (P(x) \land Q(x)) \implies (\exists x \, P(x)) \land (\exists x \, Q(x)) \) (but NOT equivalence!)
- \( \exists x \, (P(x) \lor Q(x)) \equiv (\exists x \, P(x)) \lor (\exists x \, Q(x)) \)
- \( \forall x \, (P(x) \lor Q(x)) \impliedby (\forall x \, P(x)) \lor (\forall x \, Q(x)) \) (but NOT equivalence!)
\( (\exists x \, P(x)) \land (\exists x \, Q(x)) \) is true (there exist males and females).
\( \exists x \, (P(x) \land Q(x)) \) is false (no person is both male and female).
This shows the implication in Theorem 5 doesn't reverse!
- \( \forall x \, \forall y \, P(x,y) \equiv \forall y \, \forall x \, P(x,y) \) (order doesn't matter for same quantifiers)
- \( \exists x \, \exists y \, P(x,y) \equiv \exists y \, \exists x \, P(x,y) \) (order doesn't matter for same quantifiers)
- \( \forall x \, \exists y \, P(x,y) \implies \exists y \, \forall x \, P(x,y) \) (but NOT equivalence!)
\( \forall x \, \exists y \, (y > x) \) means "For every number, there's a bigger one" — TRUE
\( \exists y \, \forall x \, (y > x) \) means "There's a number bigger than all numbers" — FALSE
The order of different quantifiers is crucial!
Normal Forms
Fundamental Concepts
Example: For variables \( p, q, r \): \( p \land \neg q \land r \) is a minterm.
Example: For variables \( p, q, r \): \( p \lor \neg q \lor r \) is a maxterm.
Form: \( (l_{11} \land l_{12} \land \cdots) \lor (l_{21} \land l_{22} \land \cdots) \lor \cdots \)
Example: \( (p \land q) \lor (\neg p \land r) \lor (q \land \neg r) \)
Form: \( (l_{11} \lor l_{12} \lor \cdots) \land (l_{21} \lor l_{22} \lor \cdots) \land \cdots \)
Example: \( (p \lor q) \land (\neg p \lor r) \land (q \lor \neg r) \)
- DNF: "Disjunction of conjunctions" = "OR of ANDs" = "Sum of products"
- CNF: "Conjunction of disjunctions" = "AND of ORs" = "Product of sums"
Converting to DNF
Step 1: Eliminate implication: \( (\neg p \lor q) \land r \)
Step 2: Apply distributive law: \( (\neg p \land r) \lor (q \land r) \)
This is now in DNF form!
| \( p \) | \( q \) | \( f \) |
|---|---|---|
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | F |
Row 1: \( p \land q \)
Row 3: \( \neg p \land q \)
DNF: \( (p \land q) \lor (\neg p \land q) \)
Can be simplified to: \( q \)
Converting to CNF
Take rows where \( f = F \):
Row 2: \( p \land \neg q \) is false, so \( \neg p \lor q \) must be true
Row 4: \( \neg p \land \neg q \) is false, so \( p \lor q \) must be true
CNF: \( (\neg p \lor q) \land (p \lor q) \)
Can be simplified to: \( q \)
Algebra of Propositions
Fundamental Laws
| Law Name | AND Form | OR Form |
|---|---|---|
| Identity | \( p \land T \equiv p \) | \( p \lor F \equiv p \) |
| Domination | \( p \land F \equiv F \) | \( p \lor T \equiv T \) |
| Idempotent | \( p \land p \equiv p \) | \( p \lor p \equiv p \) |
| Complement | \( p \land \neg p \equiv F \) | \( p \lor \neg p \equiv T \) |
| Commutative | \( p \land q \equiv q \land p \) | \( p \lor q \equiv q \lor p \) |
| Associative | \( (p \land q) \land r \equiv p \land (q \land r) \) | \( (p \lor q) \lor r \equiv p \lor (q \lor r) \) |
| Distributive | \( p \land (q \lor r) \equiv (p \land q) \lor (p \land r) \) | \( p \lor (q \land r) \equiv (p \lor q) \land (p \lor r) \) |
| De Morgan's | \( \neg(p \land q) \equiv \neg p \lor \neg q \) | \( \neg(p \lor q) \equiv \neg p \land \neg q \) |
| Absorption | \( p \land (p \lor q) \equiv p \) | \( p \lor (p \land q) \equiv p \) |
| Double Negation | \( \neg(\neg p) \equiv p \) | |
- Swapping \( \land \) with \( \lor \)
- Swapping \( T \) with \( F \)
Solution:
Step 1: Apply distributive law: \( p \lor (q \land \neg q) \)
Step 2: Apply complement law: \( p \lor F \)
Step 3: Apply identity law: \( p \)
Left side:
= \( (\neg p \lor q) \land (\neg p \lor r) \)
= \( \neg p \lor (q \land r) \) [Distributive law]
= \( p \to (q \land r) \) [Implication definition]
Both sides are equal. Q.E.D.
The SAT Problem
Input: A propositional formula \( \phi \)
Question: Does there exist a truth assignment such that \( \phi \) evaluates to true?
Analysis:
From clause 3: \( q = F \)
Substitute into clause 1: \( p \lor F \equiv p \), so \( p = T \)
Check clause 2: \( \neg T \lor F \equiv F \lor F \equiv F \)
Result: UNSATISFIABLE (no assignment makes all clauses true)
Variants of SAT
2-SAT: Each clause has at most 2 literals (solvable in polynomial time!)
3-SAT: Each clause has at most 3 literals (NP-complete)
- It is in NP (solutions can be verified in polynomial time)
- Every problem in NP can be reduced to it in polynomial time
Motivations for Studying SAT
🔬 Theoretical Importance
SAT is the foundational problem in computational complexity theory. Understanding SAT helps us understand the limits of efficient computation.
💻 Practical Applications
Modern SAT solvers are used in:
- Hardware verification and design
- Software verification and testing
- Artificial intelligence and planning
- Bioinformatics
- Cryptanalysis
Approach: Encode the circuit as a Boolean formula. Use a SAT solver to check if there's an input that makes output = 0.
If SAT solver finds no such input, the circuit is correct!
- Conflict-driven clause learning (CDCL)
- Boolean constraint propagation
- Intelligent backtracking
Functional Completeness
Also called: Universal set of connectives, adequate set, basis
- \( \{\neg, \land, \lor\} \) - Standard basis
- \( \{\neg, \land\} \) - Minimal basis (since \( p \lor q \equiv \neg(\neg p \land \neg q) \))
- \( \{\neg, \lor\} \) - Minimal basis (since \( p \land q \equiv \neg(\neg p \lor \neg q) \))
- \( \{\neg, \to\} \) - Since \( p \land q \equiv \neg(p \to \neg q) \)
Single Connective Bases
Truth Table:
| \( p \) | \( q \) | \( p \mid q \) |
|---|---|---|
| T | T | F |
| T | F | T |
| F | T | T |
| F | F | T |
Truth Table:
| \( p \) | \( q \) | \( p \downarrow q \) |
|---|---|---|
| T | T | F |
| T | F | F |
| F | T | F |
| F | F | T |
Proof for NAND:
- NOT: \( \neg p \equiv p \mid p \)
- AND: \( p \land q \equiv (p \mid q) \mid (p \mid q) \)
- OR: \( p \lor q \equiv (p \mid p) \mid (q \mid q) \)
RHS = \( \neg p \mid \neg q \)
= \( \neg(\neg p \land \neg q) \)
= \( p \lor q \) [De Morgan's Law]
Verified!
Analogy to Vector Space Basis
🔢 Linear Algebra Connection
Just as a basis for an \( n \)-dimensional vector space consists of \( n \) linearly independent vectors that can express any vector in that space, a functionally complete set of logical operators can express any Boolean function.
Examples:
- 1 variable: \( 2^{2^1} = 4 \) functions
- 2 variables: \( 2^{2^2} = 16 \) functions
- 3 variables: \( 2^{2^3} = 256 \) functions
| Concept | Vector Spaces | Boolean Functions |
|---|---|---|
| Space | \( \mathbb{R}^n \) | All Boolean functions on \( n \) variables |
| Basis | Set of \( n \) linearly independent vectors | Functionally complete set of operators |
| Span | Linear combinations | Compositions of operators |
| Minimal Basis | No vector is redundant | No operator can be expressed by others |
- \( \{\land, \lor\} \) - Cannot express negation
- \( \{\neg\} \) - Can only negate, not combine propositions
- \( \{\to\} \) - Cannot express conjunction
- \( \{\oplus\} \) (XOR) - Cannot express AND or OR
Rules of Inference
An argument is valid if and only if:
Whenever all premises are true, the conclusion is also true.
Formally: \( (p_1 \land p_2 \land \dots \land p_n) \to q \) is a tautology.
Standard Rules of Inference
| Rule Name | Rule Form | Tautology |
|---|---|---|
| Modus Ponens | \( \begin{aligned} & p \to q \\ & p \\ \hline \therefore & q \end{aligned} \) | \( ((p \to q) \land p) \to q \) |
| Modus Tollens | \( \begin{aligned} & p \to q \\ & \neg q \\ \hline \therefore & \neg p \end{aligned} \) | \( ((p \to q) \land \neg q) \to \neg p \) |
| Hypothetical Syllogism | \( \begin{aligned} & p \to q \\ & q \to r \\ \hline \therefore & p \to r \end{aligned} \) | \( ((p \to q) \land (q \to r)) \to (p \to r) \) |
| Disjunctive Syllogism | \( \begin{aligned} & p \lor q \\ & \neg p \\ \hline \therefore & q \end{aligned} \) | \( ((p \lor q) \land \neg p) \to q \) |
| Addition | \( \begin{aligned} & p \\ \hline \therefore & p \lor q \end{aligned} \) | \( p \to (p \lor q) \) |
| Simplification | \( \begin{aligned} & p \land q \\ \hline \therefore & p \end{aligned} \) | \( (p \land q) \to p \) |
| Conjunction | \( \begin{aligned} & p \\ & q \\ \hline \therefore & p \land q \end{aligned} \) | \( ((p) \land (q)) \to (p \land q) \) |
| Resolution | \( \begin{aligned} & p \lor q \\ & \neg p \lor r \\ \hline \therefore & q \lor r \end{aligned} \) | \( ((p \lor q) \land (\neg p \lor r)) \to (q \lor r) \) |
Common Fallacies
Why it's wrong: If \( p \to q \) is true and \( q \) is true, \( p \) could still be false.
"If it rains, the grass is wet. The grass is wet. Therefore, it rained." (Maybe the sprinkler was on!)
Why it's wrong: If \( p \) is false, \( q \) could still be true.
"If it rains, the grass is wet. It didn't rain. Therefore, the grass is not wet." (Again, sprinklers!)
Detailed Examples
- "It is not sunny this afternoon and it is colder than yesterday."
- "We will go swimming only if it is sunny."
- "If we do not go swimming, then we will take a canoe trip."
- "If we take a canoe trip, then we will be home by sunset."
Proof:
Let \( p \): "It is sunny", \( q \): "Colder than yesterday", \( r \): "Go swimming", \( s \): "Canoe trip", \( t \): "Home by sunset".
1. \( \neg p \land q \) (Premise 1)
2. \( \neg p \) (Simplification on 1)
3. \( r \to p \) (Premise 2: "only if" introduces necessary condition)
4. \( \neg r \) (Modus Tollens on 2 and 3)
5. \( \neg r \to s \) (Premise 3)
6. \( s \) (Modus Ponens on 4 and 5)
7. \( s \to t \) (Premise 4)
8. \( t \) (Modus Ponens on 6 and 7)
Conclusion: \( t \) is true. Valid argument!
Quick Reference
📋 Implication Essentials
• \( p \to q \equiv \neg p \lor q \)
• Contrapositive: \( p \to q \equiv \neg q \to \neg p \)
• Negation: \( \neg(p \to q) \equiv p \land \neg q \)
• Original ≠ Converse ≠ Inverse
🔄 Normal Forms
DNF: OR of ANDs (sum of products)
CNF: AND of ORs (product of sums)
Every formula has equivalent DNF and CNF forms.
🧮 Algebraic Laws
Key laws: Identity, Domination, Distributive, De Morgan's, Absorption
Duality: Swap \( \land \leftrightarrow \lor \) and \( T \leftrightarrow F \)
🎯 SAT Problem
Question: Is formula satisfiable?
Status: NP-complete (Cook-Levin)
Use: Verification, AI, design
⚡ Functional Completeness
Complete sets:
• \( \{\neg, \land, \lor\} \) - Standard
• \( \{\neg, \land\} \) or \( \{\neg, \lor\} \) - Minimal
• \( \{\mid\} \) (NAND) or \( \{\downarrow\} \) (NOR) - Single operator
🔗 Vector Space Analogy
Functionally complete set ≈ Basis of vector space
Both span entire space using combinations
Minimal sets have no redundancy
- ✓ Can you convert any formula to DNF and CNF?
- ✓ Can you prove contrapositive equivalence?
- ✓ Do you understand why NAND alone is complete?
- ✓ Can you apply algebraic laws to simplify formulas?
- ✓ Do you know why SAT is important?