CS 637: Mathematics-II

What is an Implication?

Lecture 2: Deep Dive into Implication

Understanding Implication

Def 1Implication (Material Conditional)
An implication \( p \to q \) is a compound proposition that is false only when \( p \) is true and \( q \) is false. In all other cases, it is true.

Truth Table:
\( p \) \( q \) \( p \to q \)
T T T
T F F
F T T
F F T
Def 2Hypothesis (Antecedent)
In an implication \( p \to q \), the proposition \( p \) is called the hypothesis, antecedent, or premise.
Def 3Conclusion (Consequent)
In an implication \( p \to q \), the proposition \( q \) is called the conclusion, consequent, or result.
Key Insight Why is \( F \to T \) and \( F \to F \) both true?
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

Def 4Converse
The converse of \( p \to q \) is \( q \to p \).
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).
Def 5Contrapositive
The contrapositive of \( p \to q \) is \( \neg q \to \neg p \).
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."
Def 6Inverse
The inverse of \( p \to q \) is \( \neg p \to \neg q \).
Important: \( p \to q \not\equiv \neg p \to \neg q \) in general.
Note: The inverse is the contrapositive of the converse.
Theorem 1Equivalence Relationships
For any implication \( p \to q \):
  • 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

Thm 2Implication as Disjunction
\( p \to q \equiv \neg p \lor q \)

This is the most fundamental equivalence for implication. It shows that an implication can always be rewritten as a disjunction.
Ex 1Verifying Implication Equivalence
Verify \( p \to q \equiv \neg p \lor q \) using truth table:
\( 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
The last two columns are identical, confirming the equivalence.
Thm 3Negation of Implication
\( \neg(p \to q) \equiv p \land \neg q \)

To negate an implication, the hypothesis must be true AND the conclusion must be false.
Common Error Many students incorrectly think: \( \neg(p \to q) \equiv \neg p \to \neg q \)
This is WRONG! The correct negation is \( p \land \neg q \).

Predicate Logic Equivalences

Def 7Logically Equivalent Predicates
Two predicate expressions are logically equivalent if they have the same truth value for all possible values of their variables in the domain and for all possible predicates.

Quantifier Equivalences

Theorem 4De Morgan's Laws for Quantifiers
  • \( \neg (\forall x \, P(x)) \equiv \exists x \, \neg P(x) \)
  • \( \neg (\exists x \, P(x)) \equiv \forall x \, \neg P(x) \)
Intuition: "Not everyone likes pizza" means "Someone doesn't like pizza." "Nobody likes anchovies" means "Everyone doesn't like anchovies."
Theorem 5Distributive Laws for Quantifiers
For conjunction:
  • \( \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!)
For disjunction:
  • \( \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!)
Ex 2Non-equivalence Example
Consider domain of people: Let \( P(x) \) = "x is male" and \( Q(x) \) = "x is female".

\( (\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!
Theorem 6Nested Quantifier Relationships
  • \( \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!)
Ex 3Order Matters!
Let domain be real numbers.

\( \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

Def 8Literal
A propositional variable or its negation. Examples: \( p, \neg q, r, \neg s \)
Def 9Minterm
A conjunction (AND) of literals in which each variable appears exactly once (either positive or negated).
Example: For variables \( p, q, r \): \( p \land \neg q \land r \) is a minterm.
Def 10Maxterm
A disjunction (OR) of literals in which each variable appears exactly once (either positive or negated).
Example: For variables \( p, q, r \): \( p \lor \neg q \lor r \) is a maxterm.
Def 11Disjunctive Normal Form (DNF)
A formula is in DNF if it is a disjunction (OR) of conjunctions (AND) of literals.
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) \)
Def 12Conjunctive Normal Form (CNF)
A formula is in CNF if it is a conjunction (AND) of disjunctions (OR) of literals.
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) \)
Mnemonic Remember:
  • DNF: "Disjunction of conjunctions" = "OR of ANDs" = "Sum of products"
  • CNF: "Conjunction of disjunctions" = "AND of ORs" = "Product of sums"
Theorem 7Existence of Normal Forms
Every propositional formula can be converted to an equivalent formula in DNF and also to an equivalent formula in CNF.

Converting to DNF

Ex 4Converting to DNF
Convert \( (p \to q) \land r \) 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!
Ex 5Truth Table to DNF
Given this truth table, construct DNF:
\( p \) \( q \) \( f \)
T T T
T F F
F T T
F F F
Solution: Take rows where \( f = T \):
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

Ex 6Truth Table to CNF
Using the same truth table from Ex 5, construct 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

Def 13Propositional Algebra
A mathematical system consisting of propositions with operations \( \land, \lor, \neg \) that satisfies certain algebraic laws. This allows us to manipulate logical formulas algebraically, similar to how we manipulate algebraic expressions.

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 \)
Duality Principle Principle of Duality: Every logical law has a dual obtained by:
  • Swapping \( \land \) with \( \lor \)
  • Swapping \( T \) with \( F \)
If a law is true, its dual is also true.
Ex 7Algebraic Simplification
Simplify: \( (p \lor q) \land (p \lor \neg q) \)

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 \)
Ex 8Proving Equivalence Algebraically
Prove: \( (p \to q) \land (p \to r) \equiv p \to (q \land r) \)

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

Def 14Boolean Satisfiability Problem (SAT)
Given a propositional formula, determine whether there exists a truth assignment that makes the formula true.

Input: A propositional formula \( \phi \)
Question: Does there exist a truth assignment such that \( \phi \) evaluates to true?
Ex 9SAT Instance
Is \( (p \lor q) \land (\neg p \lor q) \land (\neg q) \) satisfiable?

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

Def 15k-SAT Problem
The SAT problem restricted to formulas in CNF where each clause has at most \( k \) literals.
2-SAT: Each clause has at most 2 literals (solvable in polynomial time!)
3-SAT: Each clause has at most 3 literals (NP-complete)
Def 16NP-Completeness
A problem is NP-complete if:
  • It is in NP (solutions can be verified in polynomial time)
  • Every problem in NP can be reduced to it in polynomial time
SAT was the first problem proven to be NP-complete (Cook-Levin Theorem, 1971).
Theorem 8Cook-Levin Theorem
The Boolean satisfiability problem (SAT) is NP-complete. This means that if we can solve SAT efficiently, we can solve all NP problems efficiently.

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

Ex 10SAT in Circuit Design
Problem: Verify that a circuit always outputs 1 given certain constraints.

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!
Modern SAT Solvers Despite SAT being NP-complete (no known polynomial-time algorithm), modern SAT solvers can efficiently solve instances with millions of variables in practice using heuristics like:
  • Conflict-driven clause learning (CDCL)
  • Boolean constraint propagation
  • Intelligent backtracking

Functional Completeness

Def 17Functionally Complete Set
A set of logical connectives is functionally complete (or adequate) if every possible Boolean function can be expressed using only the connectives in that set.

Also called: Universal set of connectives, adequate set, basis
Theorem 9Standard Complete Sets
The following sets are functionally complete:
  • \( \{\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

Def 18NAND Operator (Sheffer Stroke)
The NAND operator \( p \mid q \) (also written \( p \uparrow q \)) is defined as \( \neg(p \land q) \).

Truth Table:
\( p \) \( q \) \( p \mid q \)
T T F
T F T
F T T
F F T
Def 19NOR Operator (Peirce Arrow)
The NOR operator \( p \downarrow q \) is defined as \( \neg(p \lor q) \).

Truth Table:
\( p \) \( q \) \( p \downarrow q \)
T T F
T F F
F T F
F F T
Theorem 10NAND and NOR are Complete
Both \( \{\mid\} \) (NAND) and \( \{\downarrow\} \) (NOR) are functionally complete by themselves.

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) \)
Since we can express \( \{\neg, \land, \lor\} \) using only NAND, NAND is complete.
Ex 11Expressing OR using NAND
Show \( 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.

Def 20Boolean Function Space
For \( n \) Boolean variables, there are \( 2^{2^n} \) possible Boolean functions (since each function maps \( 2^n \) input combinations to T or F).

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
Key Insight A functionally complete set is like a "basis" for Boolean logic - you can build any logical expression you need from just these basic operations, similar to how any vector can be built from basis vectors.
Non-Complete Sets These sets are NOT functionally complete:
  • \( \{\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

Def 21Valid Argument
An argument is a sequence of propositions where the final proposition (conclusion) follows from the truth of the preceding propositions (premises).
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

Fallacy 1 Affirming the Consequent (Invalid)
\( \begin{aligned} & p \to q \\ & q \\ \hline \therefore & p \end{aligned} \)

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!)
Fallacy 2 Denying the Antecedent (Invalid)
\( \begin{aligned} & p \to q \\ & \neg p \\ \hline \therefore & \neg q \end{aligned} \)

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

Ex 12Building a Valid Argument
Premises:
  1. "It is not sunny this afternoon and it is colder than yesterday."
  2. "We will go swimming only if it is sunny."
  3. "If we do not go swimming, then we will take a canoe trip."
  4. "If we take a canoe trip, then we will be home by sunset."
Conclusion: "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

Study Tips Mastery Checklist:
  • ✓ 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?
Key TakeawayThe Big Picture
This lecture bridges theory and practice: implication forms the basis of logical reasoning, normal forms provide canonical representations, the algebra lets us manipulate formulas systematically, SAT connects to real-world applications, and functional completeness shows us the minimal tools needed to express all of logic. These concepts form the foundation for computation theory and formal verification.
CS 637 – Lecture 2: Propositional Logic • Theory of Computation and Graph Theory
© 2025 Dr. Debasish Pattanayak • Department of Computer Science
🏠