7.1 Predicates, Quantifiers (∀, ∃) & Domain of Discourse Formalisms
💡 Core Intuition: The 3-Second Mental Model
🍳 The Everyday Analogy: Function Signatures & Database SQL Queries
Think of propositional logic vs predicate logic like hardcoded booleans vs parameterized functions:
- Propositional Logic (Hardcoded Flag): "The CPU is overheating." It is a static, rigid boolean flag (
boolean isOverheating = true;). It cannot talk about which CPU core or how many cores are overheating! - Predicate Logic (Parameterized Function):
isOverheating(core_id). The statement contains a parameter (). Its truth value changes depending on what you feed into it:isOverheating(0)might be True, whileisOverheating(1)might be False! - Quantifiers (SQL Aggregates):
- Universal Quantifier ():
SELECT ALL. "Every single core is overheating." (A single cool core destroys the claim). - Existential Quantifier ():
SELECT ANY. "At least one core is overheating." (A single overheating core proves the claim).
- Universal Quantifier ():
- Domain of Discourse (The Table): The set of all permissible values for . Saying "everyone is asleep" means something very different in your household versus the entire planet Earth!
💻 Bridging to Computer Science: SQL WHERE, Invariants & Formal Verification
In computer systems:
- Relational Databases (SQL):
ALLandANYin SQL clauses directly translate and :SELECT * FROM Users WHERE age >= ALL (SELECT age FROM Minors); - Loop Invariants & Hoare Logic: Formal verification of algorithms uses predicates like to prove that loops maintain correctness at every iteration.
- Static Analysis & Type Guards: Compilers use predicates like
x is NonNullable<T>to narrow types inside control flow blocks.
🔍 Why Propositional Logic Fails: The Need for Predicates
Consider the classic deductive argument:
- Premise 1 (): "Every Indian likes cricket."
- Premise 2 (): "Sunny is an Indian."
- Conclusion (): "Sunny likes cricket."
In propositional logic, each statement must be assigned a completely distinct atomic proposition letter:
Testing validity yields , which is a Contingency (Invalid)! Propositional logic treats statements as indivisible black boxes, completely blind to:
- The Subject (an individual entity like "Sunny").
- The Predicate (a property or relation like "is an Indian" or "likes cricket").
- The Quantity (generalizations like "All", "Every", or "Some").
To extract internal semantic relationships and deduce that follows inevitably from and , we must upgrade to First-Order Predicate Logic (FOL).
- Subject: The object or entity being described (e.g., "", "", "Sunny").
- Predicate: The property, attribute, or relation asserted about the subject (e.g., "is a natural number", "likes cricket").
- Denoted: , , .
- is the predicate symbol; is the subject variable.
- Domain of Discourse (Universe ): The non-empty set of all permissible values that the variable may assume.
- Example: Let be the set of all people.
- Predicate : " likes cricket".
- is now a valid proposition with a definite truth value!
- Truth Set: The subset of elements in domain for which evaluates to True:
The Anatomy of First-Order Predicate Statements
Key components distinguishing open formulas from closed propositions
Open Formula (Predicate)
Free Variable- Expression contains at least one unbound (free) variable x.
- Cannot be assigned a truth value until x is specified.
- Example: P(x): 'x > 5' is neither True nor False by itself.
Closed Formula (Proposition)
Bound Variable- Every variable is bound either by substitution or by a quantifier.
- Possesses an absolute, well-defined truth value.
- Example: P(8): '8 > 5' is True; ∀x P(x) is False over ℝ.
Domain of Discourse (U)
Evaluation Context- Defines the universe of eligible values (e.g., ℤ, ℝ, Strings, Students).
- Changing the domain can instantly flip the truth value of a statement!
- Example: '∃x (x² = 2)' is False over ℚ, but True over ℝ.
🌐 The Two Fundamental Quantifiers: ∀ and ∃
Universal Quantifier (∀) vs Existential Quantifier (∃)
The fundamental dual quantifiers of first-order mathematical logic
Universal Quantifier: ∀x P(x)
- •English: 'For all x', 'For every x', 'For each x', 'All'.
- •True Condition: P(x) is True for EVERY element x in the domain U.
- •False Condition: There exists AT LEAST ONE counterexample c ∈ U such that P(c) is False.
- •Finite Domain Expansion: P(a₁) ∧ P(a₂) ∧ ... ∧ P(aₙ) (Generalized Conjunction).
Existential Quantifier: ∃x P(x)
- •English: 'There exists an x', 'For some x', 'There is at least one x'.
- •True Condition: There exists AT LEAST ONE witness c ∈ U such that P(c) is True.
- •False Condition: P(x) is False for EVERY element x in the domain U.
- •Finite Domain Expansion: P(a₁) ∨ P(a₂) ∨ ... ∨ P(aₙ) (Generalized Disjunction).
In first-order logic translations:
- Universal Quantifiers () Pair with Implication ():
- Why NEVER ? Writing asserts that every single object in the universe is an and a ! For example, "All students are smart" with implies the Sun, the Moon, and your laptop are all students!
- Existential Quantifiers () Pair with Conjunction ():
- Why NEVER ? Writing is vacuously True if there exists any object that is not an ()! For example, "Some students are smart" with is proven True by a coffee mug, because a mug is not a student!
The Uniqueness Quantifier, denoted:
states: "There exists one and only one such that is True."
First-Order Formal Expansion: asserts both existence and uniqueness:
🔢 Finite Domain Expansions
When the domain of discourse is a finite set , quantifiers reduce directly to propositional logic:
Let be a finite universe:
- Universal Expansion (Generalized Conjunction):
- Existential Expansion (Generalized Disjunction):
Direct Consequence: In finite domains, searching for a counterexample for is searching for a False operand in a giant AND, while searching for a witness for is searching for a True operand in a giant OR!
🔒 Variable Binding, Scope & Free Variables
- Scope: The sub-formula over which the quantifier has binding authority. In , the scope of is .
- Bound Variable: An occurrence of variable is bound if it falls within the scope of a quantifier or .
- Free Variable: An occurrence of variable is free if it is not bound by any quantifier.
Example: In the formula:
- The variable in is bound by .
- The variable in is free.
- The variable in is outside the parentheses, so it is free!
- Because free variables exist, the entire formula is a predicate, not a proposition.
📝 Step-by-Step Worked Examples
Example 1: Evaluating Quantified Statements Across Different Domains
Problem Statement: Determine the truth value of each statement under two different domains:
- Domain 1: (All integers)
- Domain 2: (All real numbers)
- Statement A:
- Statement B:
- Statement C:
- Statement D:
Step-by-Step Solution:
-
Analysis of Statement A:
- Domain : For every integer, its square is non-negative (; ). True.
- Domain : The square of every real number is non-negative. True.
-
Analysis of Statement B:
- Counterexample Test: Does there exist any element with ?
- Setting gives , which is NOT strictly greater than .
- Since is a valid counterexample in both and , Statement B is False in both domains.
-
Analysis of Statement C:
- Domain : The solutions to are . Neither nor is an integer (). Thus, no integer satisfies the condition. False in .
- Domain : Since , is a valid witness. True in !
-
Analysis of Statement D:
- Subtracting from both sides gives , which is unconditionally true for all real numbers and integers.
- Statement D is True in both domains.
Key Takeaway: Always inspect the domain of discourse: statement C is False over integers but True over real numbers.
Example 2: Expressing Uniqueness Formally
Problem Statement: Let be the predicate " is an even prime number" over the domain of positive integers .
- Evaluate .
- Write the formal expansion of this statement in standard first-order logic.
Step-by-Step Solution:
-
Step 1: Truth Value Analysis
- Positive prime numbers are .
- The only even prime number is .
- Any prime is divisible by and therefore composite.
- Since is the unique even prime, the statement is True!
-
Step 2: Formal First-Order Expansion
- We must assert two sub-formulas:
- Existence: There exists an even prime: .
- Uniqueness: If any number is an even prime, it must be identical to : .
- Combining both with conjunction:
- Alternative equivalent formulation (asserting no second distinct witness exists):
- We must assert two sub-formulas:
🎯 Exam & Interview Pitfall Check
Question 1: Is the statement automatically True if the domain of discourse is the empty set ()? Key Focus Points: Yes! In formal logic, this is a vacuous truth. If the domain is empty, there are no elements to test, which means it is impossible to find a counterexample! Therefore, is vacuously True. Conversely, over an empty domain is always False because no witness exists!
Question 2: Can a formula have the same variable symbol appear both as a bound variable and as a free variable? Key Focus Points: Yes! For example, in , the first occurrence of is bound by , while the second occurrence in is free. To avoid confusion, best practice in computer science (variable renaming / alpha conversion) renames the bound variable: .
Trap 1: Dropping the domain when evaluating truth values Why it fails: "" has NO intrinsic truth value until the domain is stated! If , it is True. If , it is False. Never evaluate a quantified formula without first identifying its domain of discourse!
Trap 2: Assuming implies is true for most elements Why it fails: The existential quantifier requires only AT LEAST ONE witness. Even if an event occurs only once in a quadrillion cases ( failures and 1 success), is 100% True!