Open Sentences vs. Propositions: The equation x + 5 = 12 is an open sentence (predicate). It becomes a proposition only when a specific value is assigned to variable x or when bound by a quantifier (∃x (x + 5 = 12)).
Propositions, truth tables, logical connectives, conditionals, De Morgan's laws, quantifiers, proof techniques, and Boolean satisfiability (SAT).
Mathematical Logic is the formal language of reasoning in mathematics and computer science. It provides the rigorous syntactic and semantic rules that underpin digital circuit design, compiler construction, formal verification, algorithm correctness proofs, database query optimization, and artificial intelligence knowledge representation.
This module covers Propositional Logic, Truth Tables, Logical Connectives, Quantifiers (First-Order Logic), and Proof Techniques.
By the end of this module, you will be able to:
| # | Topic | Skill |
|---|---|---|
| 1 | Propositions & Truth Values | Distinguish valid propositions from non-propositions (T vs. F) |
| 2 | Logical Connectives | Master NOT (¬), AND (∧), OR (∨), XOR (⊕), Implication (⟹), and Biconditional (⟺) |
| 3 | Conditionals & Equivalences | Construct Converse (q ⟹ p), Inverse (¬p ⟹ ¬q), and Contrapositive (¬q ⟹ ¬p) |
| 4 | Truth Tables & Classification | Classify compound statements as Tautologies, Contradictions, or Contingencies |
| 5 | Laws of Logical Equivalence | Simplify complex boolean formulas using De Morgan's, Distributive, and Absorption laws |
| 6 | Predicates & Quantifiers | Translate natural language into First-Order Logic using ∀x (Universal) and ∃x (Existential) |
| 7 | Negating Quantified Statements | Correctly negate complex assertions using generalized De Morgan's laws for quantifiers |
| 8 | Proof Techniques | Construct Direct Proofs, Proof by Contraposition, Proof by Contradiction, and Counterexamples |
| 9 | Digital Logic & Circuit Gates | Map boolean formulas to hardware logic gates (AND, OR, NOT, NAND, NOR, XOR, XNOR) |
| 10 | Boolean Satisfiability (SAT) | Understand CNF/DNF normal forms and the foundational role of SAT in P vs. NP complexity |
Propositional Connectives:
First-Order Logic Quantifiers:
What is a Proposition? A proposition (or statement) is a declarative sentence that is either strictly True (T) or strictly False (F), but not both simultaneously.
Sentence | Proposition? | Truth Value
----------------------------------------------|--------------|-------------
"Paris is the capital of France." | YES | True (T)
"2 + 3 = 7" | YES | False (F)
"Python is an interpreted programming lang." | YES | True (T)
"What time is it?" | NO (Question)| N/A
"Please submit your assignment." | NO (Command) | N/A
"x + 5 = 12" | NO (Open eq) | Depends on x
"This statement is false." | NO (Paradox) | Neither T nor F
Open Sentences vs. Propositions: The equation x + 5 = 12 is an open sentence (predicate). It becomes a proposition only when a specific value is assigned to variable x or when bound by a quantifier (∃x (x + 5 = 12)).
Compound propositions are formed by combining atomic propositions using logical operators (connectives).
Master Truth Table for Basic Connectives
+-------+-------+----------+---------------+--------------+----------------+
| p | q | Negation | Conjunction | Disjunction | Exclusive OR |
| | | (¬ p) | (p ∧ q) | (p ∨ q) | (p ⊕ q) |
+-------+-------+----------+---------------+--------------+----------------+
| T | T | F | T | T | F |
| T | F | F | F | T | T |
| F | T | T | F | T | T |
| F | F | T | F | F | F |
+-------+-------+----------+---------------+--------------+----------------+
# Boolean logic in Python
p = True
q = False
print("NOT p (¬p):", not p) # False
print("p AND q (p ∧ q):", p and q) # False
print("p OR q (p ∨ q):", p or q) # True
print("p XOR q (p ⊕ q):", p ^ q) # True
In the implication p ⟹ q:
The Golden Rule of Implication: p ⟹ q is FALSE in ONLY ONE CASE: When the hypothesis p is True and the conclusion q is False (T ⟹ F). In all other cases, p ⟹ q is True (even when p is False — known as Vacuous Truth).
Truth Table for Conditional and Biconditional
+-------+-------+-------------------------+-------------------------+
| p | q | Conditional (p ⟹ q) | Biconditional (p ⟺ q) |
+-------+-------+-------------------------+-------------------------+
| T | T | T | T |
| T | F | F (Violation)| F |
| F | T | T (Vacuous) | F |
| F | F | T (Vacuous) | T |
+-------+-------+-------------------------+-------------------------+
GATE Translation Cheat Sheet for Conditional Statements (p ⟹ q):
In GATE exams, questions regularly test your ability to correctly identify the Hypothesis (p) vs. the Conclusion (q) in natural language sentences:
| English Phrasing | Symbolic Translation | Which is the Hypothesis (Premise)? |
|---|---|---|
| "If p, then q" | p ⟹ q | p is hypothesis |
| "q if p" | p ⟹ q | p is hypothesis |
| "q when p" | p ⟹ q | p is hypothesis |
| "q whenever p" | p ⟹ q | p is hypothesis |
| "p is sufficient for q" | p ⟹ q | p is hypothesis |
| "q is necessary for p" | p ⟹ q | p is hypothesis |
| "p only if q" | p ⟹ q | p is hypothesis (Trap!) |
| "q provided that p" | p ⟹ q | p is hypothesis |
| "q unless p" | ¬p ⟹ q or q ∨ p | ¬p is hypothesis |
Fundamental Equivalence of Implication:
p ⟹ q ≡ ¬p ∨ q
p ⟺ q states "p if and only if q" (often written iff). It is True whenever p and q share the exact same truth value (T ⟺ T and F ⟺ F).
p ⟺ q ≡ (p ⟹ q) ∧ (q ⟹ p)
Given any conditional statement p ⟹ q, three related conditional statements can be formed:
| Form | Symbolic Expression | Relationship to Original |
|---|---|---|
| Original Implication | p ⟹ q | Baseline statement |
| Converse | q ⟹ p | Reverse direction (NOT equivalent to original) |
| Inverse | ¬p ⟹ ¬q | Negate both terms (NOT equivalent to original) |
| Contrapositive | ¬q ⟹ ¬p | Reverse and negate (LOGICALLY EQUIVALENT to original) |
Comparison of Truth Tables for Related Conditionals
+---+---+---------------+---------------+-----------------+--------------------+
| p | q | p ⟹ q (Orig) | q ⟹ p (Conv) | ¬p ⟹ ¬q (Inv) | ¬q ⟹ ¬p (Contra) |
+---+---+---------------+---------------+-----------------+--------------------+
| T | T | T | T | T | T |
| T | F | F | T | T | F |
| F | T | T | F | F | T |
| F | F | T | T | T | T |
+---+---+---------------+---------------+-----------------+--------------------+
Key Insights:
Compound propositions are classified based on the truth values in their final column:
p ∨ ¬p, p ⟹ p).p ∧ ¬p).# Truth Table Generator in Python
def truth_table_3var():
print(" p | q | r | (p ∧ q) → r | (p → r) ∨ (q → r)")
print("-" * 46)
for p in [True, False]:
for q in [True, False]:
for r in [True, False]:
lhs = (not (p and q)) or r
rhs = ((not p) or r) or ((not q) or r)
print(f" {int(p)} | {int(q)} | {int(r)} | {int(lhs)} | {int(rhs)} | Equivalent: {lhs == rhs}")
truth_table_3var()
Two propositions P and Q are logically equivalent (P ≡ Q) if and only if P ⟺ Q is a tautology.
| Law Name | Equivalence 1 | Equivalence 2 |
|---|---|---|
| Identity Laws | p ∧ T ≡ p | p ∨ F ≡ p |
| Domination Laws | p ∨ T ≡ T | p ∧ F ≡ F |
| Idempotent Laws | p ∨ p ≡ p | p ∧ p ≡ p |
| Double Negation | ¬(¬p) ≡ p | — |
| Commutative Laws | p ∨ q ≡ q ∨ p | p ∧ q ≡ q ∧ p |
| Associative Laws | (p ∨ q) ∨ r ≡ p ∨ (q ∨ r) | (p ∧ q) ∧ r ≡ p ∧ (q ∧ r) |
| Distributive Laws | p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) | p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) |
| De Morgan's Laws | ¬(p ∧ q) ≡ ¬p ∨ ¬q | ¬(p ∨ q) ≡ ¬p ∧ ¬q |
| Absorption Laws | p ∨ (p ∧ q) ≡ p | p ∧ (p ∨ q) ≡ p |
| Negation (Complement) | p ∨ ¬p ≡ T | p ∧ ¬p ≡ F |
A predicate P(x) is a statement containing variable x. Once a domain of discourse D is specified, quantifiers turn predicates into complete propositions.
In GATE, questions frequently involve binary relational predicates P(x, y) (e.g., M(x, y): "x knows y", L(x, y): "x loves y", D(x, y): "x divides y") over a domain D.
╔══════════════════════════════════════════════════════════════════════════════════════════════════╗
║ THE GOLDEN QUANTIFIER RULE ║
║ 1. Universal Quantifier (∀x) naturally pairs with IMPLICATION (→) ║
║ "Every student who studies passes" ⟹ ∀x (Student(x) ∧ Studies(x) → Passes(x)) ║
║ [Trap: Using ∧ with ∀ makes it assert EVERY object in the universe is a student!] ║
║ ║
║ 2. Existential Quantifier (∃x) naturally pairs with CONJUNCTION (∧) ║
║ "There is a student who passes" ⟹ ∃x (Student(x) ∧ Passes(x)) ║
║ [Trap: Using → with ∃ is vacuously True if any non-student exists in the universe!] ║
╚══════════════════════════════════════════════════════════════════════════════════════════════════╝
Consider predicate M(x, y) meaning "x knows y":
∀x ((x ≠ y) ⟹ M(x, y))
∀x ((x ≠ y) ⟹ ¬M(y, x))
(∃y)(∀x)((x ≠ y) ⟹ (M(x, y) ∧ ¬M(y, x)))
Order of Quantifiers Matters:
∃y ∀x P(x, y) asserts ONE single person y works for all x simultaneously (Strong statement).∀x ∃y P(x, y) allows each x to have their own different y (Weaker statement).∃y ∀x P(x, y) ⟹ ∀x ∃y P(x, y), but the converse is FALSE!The uniqueness quantifier ∃!x P(x) asserts that there exists one and only one element in domain D satisfying predicate P.
∃y P(y)z ≠ y cannot satisfy P, or equivalently, if P(z) holds, then z must be y.Let mother(y, x) denote "y is the mother of x" and noteq(x, y) denote x ≠ y:
Form 1: Universal Non-Equality Implication (GATE Standard Form):
∀x ∃y [mother(y, x) ∧ ∀z (noteq(z, y) ⟹ ¬mother(z, x))](For every x, there is a mother y, and anyone z distinct from y is NOT a mother of x)
Form 2: Existential Negation via De Morgan's Law (Equivalent Form):
∀x ∃y [mother(y, x) ∧ ¬∃z (noteq(z, y) ∧ mother(z, x))](For every x, there is a mother y, and NO person z distinct from y is also a mother of x)
Form 3: Contrapositive Equivalence:
∀x ∃y [mother(y, x) ∧ ∀z (mother(z, x) ⟹ ¬noteq(z, y))](If z is also a mother of x, then z MUST be y)
Common GATE Traps in Uniqueness Questions (AIR 1 Traps):
∀x ∃y ∃z (mother(y, x) ∧ ¬mother(z, x)) only says x has at least one mother and someone in the universe is not a mother. It does NOT restrict x from having 10 mothers!∀x ∀y [mother(y, x) ⟹ ∃z (mother(z, x) ∧ z = y)] simplifies to mother(y, x) ⟹ mother(y, x) (a vacuous tautology that asserts neither existence nor uniqueness).In GATE, questions frequently test implication strength between quantified formulas (i.e., whether Premise A ⟹ Conclusion B).
∃y ∀x φ(x, y) ⟹ ∀x ∃y φ(x, y)
∃y ∀x), then for every x, we can simply choose that same witness y (∀x ∃y).∀x ∃y φ(x, y) DOES NOT imply ∃y ∀x φ(x, y).∀x ∃y (y = x+1)] is True, but "There is a single number that is successor to all numbers" [∃y ∀x (y = x+1)] is False!)When variable y does not occur free in P(x):
∃y [P(x) ⟹ Q(x, y)] ≡ P(x) ⟹ ∃y Q(x, y)∀y [P(x) ⟹ Q(x, y)] ≡ P(x) ⟹ ∀y Q(x, y)Quantifier Flip Rule when moving from Antecedent (Hypothesis): When variable x moves out of the hypothesis of an implication, the quantifier FLIPS:
[∀x P(x)] ⟹ Q ≡ ∃x [P(x) ⟹ Q][∃x P(x)] ⟹ Q ≡ ∀x [P(x) ⟹ Q]To test whether Premise A implies Target G: ∀x [P(x) ⟹ ∃y Q(x, y)]:
∀x ∀y Q(x, y) is True, then ∃y Q(x, y) is always True. Because Anything ⟹ True ≡ True, the conjecture is guaranteed to hold.∃x [...] can never imply a universal claim ∀x [...] over an infinite domain.To negate quantified statements, we use De Morgan's Laws for Quantifiers:
Original Statement | Symbolic Form | Negated Form | English Negation
----------------------------------|------------------|-------------------|-----------------------------
"All students passed the exam." | ∀x Passed(x) | ∃x ¬Passed(x) | "Some student did not pass."
"Some integers are negative." | ∃x Negative(x) | ∀x ¬Negative(x) | "All integers are non-neg."
"Every prime number is odd." | ∀x Odd(x) | ∃x ¬Odd(x) | "There is an even prime (2)."
Proof techniques form the foundation for proving algorithm termination, time complexity lower bounds, and software correctness.
Assume hypothesis p is true, apply definitions and algebraic steps, and show that conclusion q must be true.
n = 2k + 1 ⟹ n² = (2k+1)² = 4k² + 4k + 1 = 2(2k² + 2k) + 1, which is odd. ∎Instead of proving p ⟹ q, prove the logically equivalent contrapositive ¬q ⟹ ¬p.
3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1) is even. Thus ¬q ⟹ ¬p is proven. ∎To prove proposition p, assume ¬p is true. Derive a logical impossibility or contradiction (such as 1 = 0 or k is both even and odd). Hence, ¬p must be false, so p is true.
To disprove a universal statement ∀x P(x), it suffices to construct one concrete instance c where P(c) is false.
Mathematical induction is a fundamental proof technique for establishing that a predicate P(x) holds for all natural numbers ℕ = {0, 1, 2, ...}.
(P(0) ∧ ∀x [P(x) ⟹ P(x+1)]) ⟹ ∀x P(x)
GATE Common Induction Fallacies (AIR 1 Traps):
(P(0) ∧ ∀x [P(x) ⟹ P(x-1)]) DOES NOT imply ∀x P(x)(P(1000) ∧ ∀x [P(x) ⟹ P(x+1)]) DOES NOT imply ∀x P(x)(P(0) ∧ ∀x [(∀k ≤ x P(k)) ⟹ P(x+1)]) ⟹ ∀x P(x).Digital computers implement propositional logic directly using transistors:
(x₁ ∨ ¬x₂ ∨ x₃).(x₁ ∨ x₂) ∧ (¬x₁ ∨ x₃) ∧ (¬x₂ ∨ ¬x₃)Cook-Levin Theorem (1971): The Boolean Satisfiability Problem (SAT) was the first problem proven to be NP-Complete. Determining whether a boolean formula in CNF has a satisfying truth assignment is the central benchmark problem in theoretical computer science.
| Concept | Symbolic Expression | Essential Rule |
|---|---|---|
| Negation | ¬p | Flips T ↔ F |
| Conjunction | p ∧ q | True only when BOTH are True |
| Disjunction | p ∨ q | True when AT LEAST ONE is True |
| Implication | p ⟹ q ≡ ¬p ∨ q | False ONLY when T ⟹ F |
| Contrapositive | ¬q ⟹ ¬p | Equivalent to original implication p ⟹ q |
| Converse | q ⟹ p | NOT equivalent to p ⟹ q |
| Tautology | ⊤ or T | Always True under all assignments |
| Contradiction | ⊥ or F | Always False under all assignments |
| De Morgan's (Logic) | ¬(p ∧ q) ≡ ¬p ∨ ¬q | ¬(p ∨ q) ≡ ¬p ∧ ¬q |
| Universal Quantifier | ∀x P(x) | True if holds for all elements |
| Existential Quantifier | ∃x P(x) | True if holds for at least one element |
| Quantifier Negation | ¬(∀x P(x)) ≡ ∃x ¬P(x) | ¬(∃x P(x)) ≡ ∀x ¬P(x) |
| Mathematical Induction | [P(0) ∧ ∀x(P(x)⇒P(x+1))] ⇒ ∀xP(x) | Proves universal validity over ℕ |
Interactive:
Academic References:
Test your understanding with step-by-step solutions
5 questions · 90s per question
Each question has a 90-second time limit. Unanswered questions will be auto-submitted when time runs out.