Skip to main content

7.3 First-Order Validity, Semantic Tableaux & Prenex Normal Form

πŸ“šModule 07: First-Order Predicate LogicTopic 7.3: First-Order Validity, Semantic Tableaux & Prenex Normal Form⏱️5 min read
🎯High-Yield For:Semester Exams β€’ GATE CSE β€’ Technical Interviews

πŸ’‘ Core Intuition: The 3-Second Mental Model​

🍳 The Everyday Analogy: Compiling High-Level Code to Assembly​

Think of advanced first-order logic like compiler parsing and intermediate code generation:

  1. First-Order Validity (Universal Truth across All Universes): In propositional logic, a tautology is true across a finite table of 2n2^n rows. In predicate logic, a valid formula must be true across every conceivable universeβ€”whether the universe has 1 element, 5 elements, or an infinite continuum of numbers!
  2. Prenex Normal Form (Hoisting Quantifiers): Just as JavaScript hoists variable declarations var x, y to the top of a function scope, Prenex Normal Form (PNF) pulls all quantifiers (βˆ€,βˆƒ\forall, \exists) out to the very front of the formula (Q1x1Q2x2…Q_1 x_1 Q_2 x_2 \dots), leaving a clean, flat, quantifier-free logic circuit (the Matrix) behind.
  3. The 4 Quantifier Inference Rules:
    • Universal Instantiation (UI): If a law applies to all citizens, it applies to Bob.
    • Universal Generalization (UG): If you proved a theorem for an arbitrary generic triangle without special assumptions, it holds for all triangles!
    • Existential Instantiation (EI): If a crime witness exists, name them "Witness X" (a fresh name not already used in court).
    • Existential Generalization (EG): If Bob solved the bug, then someone solved the bug!

πŸ’» Bridging to Computer Science: SMT Solvers, Skolemization & Undecidability​

In computer systems:

  • Skolemization in SMT Solvers (Z3, CVC5): Before automated theorem provers can check first-order assertions, they convert formulas to PNF and replace existential variables with Skolem functions.
  • GΓΆdel vs Church-Turing: GΓΆdel proved that first-order logic is Complete (every valid formula can be proven in finite steps). But Alonzo Church and Alan Turing proved it is Undecidableβ€”no algorithm can exist that halts and decides whether an arbitrary first-order formula is valid (Entscheidungsproblem)!

πŸ›οΈ Interpretations, Validity & Satisfiability​

In propositional logic, an evaluation is simply an assignment of True or False to atomic letters. In First-Order Logic (FOL), an evaluation requires an entire mathematical universe called an Interpretation.

πŸ“–Definition 7.4: Interpretation & First-Order Modeldefinition

An Interpretation I=(D,Οƒ)\mathcal{I} = (D, \sigma) for a first-order language consists of:

  1. A non-empty set DD called the Domain (or Universe).
  2. An assignment Οƒ\sigma that maps:
    • Each constant symbol cc to a concrete element in DD.
    • Each kk-ary function symbol ff to a mapping fI:Dkβ†’Df^{\mathcal{I}}: D^k \to D.
    • Each kk-ary predicate symbol PP to a relation PIβŠ†DkP^{\mathcal{I}} \subseteq D^k.

Classifications:

  • Valid (Universal Tautology): A formula Ο•\phi is valid if it evaluates to True in every possible interpretation I\mathcal{I} over every possible domain DD.
  • Satisfiable: A formula Ο•\phi is satisfiable if there exists at least one interpretation I\mathcal{I} under which Ο•\phi evaluates to True.
  • Unsatisfiable (Contradiction): A formula Ο•\phi is unsatisfiable if it evaluates to False in every interpretation.

πŸ“ The Master 10-Case Quantifier Distribution Matrix​

A classic question in competitive examinations (GATE) tests whether quantifiers distribute across ∨\lor, ∧\land, and β†’\to:

πŸ“Theorem 7.3: Quantifier Distributivity & Equivalencestheorem
  1. Full Equivalences (≑\equiv):
    • Universal over Conjunction: βˆ€x(P(x)∧Q(x))≑(βˆ€xP(x))∧(βˆ€xQ(x))\forall x (P(x) \land Q(x)) \equiv (\forall x P(x)) \land (\forall x Q(x)).
    • Existential over Disjunction: βˆƒx(P(x)∨Q(x))≑(βˆƒxP(x))∨(βˆƒxQ(x))\exists x (P(x) \lor Q(x)) \equiv (\exists x P(x)) \lor (\exists x Q(x)).
  2. One-Way Semi-Distributive Implications (β€…β€ŠβŸΉβ€…β€Š\implies):
    • Existential over Conjunction is one-way: βˆƒx(P(x)∧Q(x))β€…β€ŠβŸΉβ€…β€Š(βˆƒxP(x))∧(βˆƒxQ(x))\exists x (P(x) \land Q(x)) \implies (\exists x P(x)) \land (\exists x Q(x)).
    • Universal over Disjunction is one-way: (βˆ€xP(x))∨(βˆ€xQ(x))β€…β€ŠβŸΉβ€…β€Šβˆ€x(P(x)∨Q(x))(\forall x P(x)) \lor (\forall x Q(x)) \implies \forall x (P(x) \lor Q(x)).
    • Universal over Implication is one-way: βˆ€x(P(x)β†’Q(x))β€…β€ŠβŸΉβ€…β€Š(βˆ€xP(x)β†’βˆ€xQ(x))\forall x (P(x) \to Q(x)) \implies (\forall x P(x) \to \forall x Q(x)).

Master 10-Case Quantifier Distribution Reference Table​

IndexPremise FormConsequent FormValidity StatusMathematical Justification / Counterexample Valuation
1βˆƒx(P(x)∨Q(x))\exists x \big( P(x) \lor Q(x) \big)(βˆƒxP(x))∨(βˆƒxQ(x))\big( \exists x P(x) \big) \lor \big( \exists x Q(x) \big)Valid (≑\equiv)Full Distributivity: Witness for PP or QQ suffices for both sides
2(βˆƒxP(x))∨(βˆƒxQ(x))\big( \exists x P(x) \big) \lor \big( \exists x Q(x) \big)βˆƒx(P(x)∨Q(x))\exists x \big( P(x) \lor Q(x) \big)Valid (≑\equiv)Converse of Case 1 is strictly valid
3βˆƒx(P(x)∧Q(x))\exists x \big( P(x) \land Q(x) \big)(βˆƒxP(x))∧(βˆƒxQ(x))\big( \exists x P(x) \big) \land \big( \exists x Q(x) \big)Valid (β€…β€ŠβŸΉβ€…β€Š\implies)If single element satisfies both, separate witnesses trivially exist
4(βˆƒxP(x))∧(βˆƒxQ(x))\big( \exists x P(x) \big) \land \big( \exists x Q(x) \big)βˆƒx(P(x)∧Q(x))\exists x \big( P(x) \land Q(x) \big)INVALIDCounterexample: Over Z\mathbb{Z}, P(x)P(x) = even, Q(x)Q(x) = odd (Separate witnesses exist, but no number is both!)
5(βˆ€xP(x))∨(βˆ€xQ(x))\big( \forall x P(x) \big) \lor \big( \forall x Q(x) \big)βˆ€x(P(x)∨Q(x))\forall x \big( P(x) \lor Q(x) \big)Valid (β€…β€ŠβŸΉβ€…β€Š\implies)If all are PP (or all are QQ), then every element is P∨QP \lor Q
6βˆ€x(P(x)∨Q(x))\forall x \big( P(x) \lor Q(x) \big)(βˆ€xP(x))∨(βˆ€xQ(x))\big( \forall x P(x) \big) \lor \big( \forall x Q(x) \big)INVALIDCounterexample: Over Z\mathbb{Z}, every integer is even or odd, but not all are even nor all odd!
7βˆ€x(P(x)∧Q(x))\forall x \big( P(x) \land Q(x) \big)(βˆ€xP(x))∧(βˆ€xQ(x))\big( \forall x P(x) \big) \land \big( \forall x Q(x) \big)Valid (≑\equiv)Full Distributivity: Conjunction holds for all iff each holds for all
8(βˆ€xP(x))∧(βˆ€xQ(x))\big( \forall x P(x) \big) \land \big( \forall x Q(x) \big)βˆ€x(P(x)∧Q(x))\forall x \big( P(x) \land Q(x) \big)Valid (≑\equiv)Converse of Case 7 is strictly valid
9βˆ€x(P(x)β†’Q(x))\forall x \big( P(x) \to Q(x) \big)(βˆ€xP(x))β†’(βˆ€xQ(x))\big( \forall x P(x) \big) \to \big( \forall x Q(x) \big)Valid (β€…β€ŠβŸΉβ€…β€Š\implies)If P(x)β†’Q(x)P(x) \to Q(x) holds everywhere, then all PP forces all QQ
10(βˆ€xP(x))β†’(βˆ€xQ(x))\big( \forall x P(x) \big) \to \big( \forall x Q(x) \big)βˆ€x(P(x)β†’Q(x))\forall x \big( P(x) \to Q(x) \big)INVALIDCounterexample: Let βˆ€xP(x)\forall x P(x) be False (antecedent vacuously True), but P(a)=T,Q(a)=FP(a) = T, Q(a) = F for some element

πŸͺŸ Null Quantification Laws (Variable x Free of A)​

⚑Law 7.3: Null Quantification & Quantifier Hoistinglaw

Let AA be a formula in which variable xx does NOT occur as a free variable:

  1. Conjunction & Disjunction (Zero Quantifier Shift): βˆ€x(P(x)∧A)≑(βˆ€xP(x))∧A\forall x \big( P(x) \land A \big) \equiv \big( \forall x P(x) \big) \land A βˆ€x(P(x)∨A)≑(βˆ€xP(x))∨A\forall x \big( P(x) \lor A \big) \equiv \big( \forall x P(x) \big) \lor A βˆƒx(P(x)∧A)≑(βˆƒxP(x))∧A\exists x \big( P(x) \land A \big) \equiv \big( \exists x P(x) \big) \land A βˆƒx(P(x)∨A)≑(βˆƒxP(x))∨A\exists x \big( P(x) \lor A \big) \equiv \big( \exists x P(x) \big) \lor A
  2. Implication with Quantifier in Consequent (No Flip): βˆ€x(Aβ†’P(x))≑Aβ†’(βˆ€xP(x))\forall x \big( A \to P(x) \big) \equiv A \to \big( \forall x P(x) \big) βˆƒx(Aβ†’P(x))≑Aβ†’(βˆƒxP(x))\exists x \big( A \to P(x) \big) \equiv A \to \big( \exists x P(x) \big)
  3. Implication with Quantifier in Antecedent (QUANTIFIER FLIPS!): βˆ€x(P(x)β†’A)≑(βˆƒxP(x))β†’A(βˆ€Β flipsΒ toΒ βˆƒ!)\forall x \big( P(x) \to A \big) \equiv \big( \exists x P(x) \big) \to A \quad (\forall \text{ flips to } \exists!) βˆƒx(P(x)β†’A)≑(βˆ€xP(x))β†’A(βˆƒΒ flipsΒ toΒ βˆ€!)\exists x \big( P(x) \to A \big) \equiv \big( \forall x P(x) \big) \to A \quad (\exists \text{ flips to } \forall!)

Algebraic Proof of the Antecedent Flip:

P(x)β†’A≑¬P(x)∨AP(x) \to A \equiv \neg P(x) \lor Aβˆ€x(P(x)β†’A)β‰‘βˆ€x(Β¬P(x)∨A)≑(βˆ€xΒ¬P(x))∨A\forall x \big( P(x) \to A \big) \equiv \forall x \big( \neg P(x) \lor A \big) \equiv \big( \forall x \neg P(x) \big) \lor A

By Quantifier De Morgan: βˆ€xΒ¬P(x)≑¬(βˆƒxP(x))\forall x \neg P(x) \equiv \neg \big( \exists x P(x) \big):

Β¬(βˆƒxP(x))∨A≑(βˆƒxP(x))β†’A\neg \big( \exists x P(x) \big) \lor A \equiv \big( \exists x P(x) \big) \to A

πŸ“¦ Prenex Normal Form (PNF) Conversion​

πŸ“–Definition 7.5: Prenex Normal Form (PNF)definition

A first-order formula is in Prenex Normal Form (PNF) if it is structured as:

Q1x1 Q2x2 … Qkxk M(x1,x2,…,xk)Q_1 x_1 \, Q_2 x_2 \, \dots \, Q_k x_k \, M(x_1, x_2, \dots, x_k)

where:

  1. Each Qi∈{βˆ€,βˆƒ}Q_i \in \{\forall, \exists\} is a quantifier (the Prefix).
  2. MM is a completely quantifier-free propositional logic formula (the Matrix).

The 4-Step Prenex Normal Form (PNF) Conversion Algorithm

Standardized procedure to hoist all quantifiers to the leftmost prefix

Step 1

Eliminate Conditionals & Biconditionals

βœ‚οΈ

Replace a β†’ b with Β¬a ∨ b and a ↔ b with (Β¬a ∨ b) ∧ (Β¬b ∨ a).

↓Pure {Β¬, ∧, ∨} Connectives
Step 2

Push Negations Inward (NNF)

πŸ“₯

Apply De Morgan's laws: Β¬βˆ€x P(x) ≑ βˆƒx Β¬P(x) and Β¬βˆƒx P(x) ≑ βˆ€x Β¬P(x).

↓Negation Sits Only at Atomic Predicates
Step 3

Standardize Variables Apart (Alpha-Conversion)

🏷️

Rename dummy variables so every quantifier binds a unique variable name (e.g., βˆ€x P(x) ∨ βˆ€x Q(x) ⟹ βˆ€x P(x) ∨ βˆ€y Q(y)).

↓Zero Variable Clashes
Step 4

Hoist Quantifiers to the Prefix

πŸš€

Apply Null Quantification laws to pull all quantifiers to the left of the expression.


βš™οΈ The Four Quantifier Rules of Inference​

To extend propositional natural deduction to First-Order Logic, we introduce four formal quantifier rules:

The 4 Quantifier Inference Rules

Formal derivation rules bridging quantified formulas and individual instances

⬇️

Universal Instantiation (UI)

βˆ€x P(x) ⊒ P(c)
  • From βˆ€x P(x), deduce P(c) for ANY arbitrary element or constant c in the domain.
  • Zero restrictions: if a property holds for all elements, it holds for c.
  • Example: 'All humans are mortal' ⟹ 'Socrates is mortal'.
⬆️

Universal Generalization (UG)

P(c) ⊒ βˆ€x P(x)
  • From P(c), deduce βˆ€x P(x), provided c is an ARBITRARY, generic element.
  • Restriction: c must NOT appear in any prior un-discharged premises or hypotheses!
  • Standard method of mathematical proof: 'Let c be an arbitrary integer...'.
πŸ”“

Existential Instantiation (EI)

βˆƒx P(x) ⊒ P(c)
  • From βˆƒx P(x), deduce P(c) for a BRAND NEW constant symbol c.
  • Strict Restriction: c must be a FRESH constant that has NEVER appeared anywhere earlier in the proof!
  • Intuition: Name the unknown witness c; do not assume c is someone already known.
πŸ”’

Existential Generalization (EG)

P(c) ⊒ βˆƒx P(x)
  • From P(c) for a known specific element c, deduce βˆƒx P(x).
  • Zero restrictions: if c has the property, then at least one such element exists.
  • Example: '7 is prime' ⟹ 'There exists a prime number'.

πŸ“ Step-by-Step Worked Examples​

Example 1: Converting a First-Order Formula to Prenex Normal Form​

Problem Statement: Convert the formula Ο•=βˆ€xP(x)β†’βˆƒyQ(y)\phi = \forall x P(x) \to \exists y Q(y) into Prenex Normal Form (PNF).

Step-by-Step Solution:

  1. Step 1: Eliminate the implication (β†’\to)

    • Apply Aβ†’B≑¬A∨BA \to B \equiv \neg A \lor B: Ο•=Β¬(βˆ€xP(x))βˆ¨βˆƒyQ(y)\phi = \neg \big( \forall x P(x) \big) \lor \exists y Q(y)
  2. Step 2: Push negations inward using Quantifier De Morgan

    • Negate βˆ€xP(x)\forall x P(x): Β¬(βˆ€xP(x))β‰‘βˆƒx ¬P(x)\neg \big( \forall x P(x) \big) \equiv \exists x \, \neg P(x)
    • The expression becomes: Ο•=βˆƒx ¬P(x)βˆ¨βˆƒyQ(y)\phi = \exists x \, \neg P(x) \lor \exists y Q(y)
  3. Step 3: Standardize variables apart

    • The quantified variables are xx and yy. They are already distinct! No renaming needed.
  4. Step 4: Hoist quantifiers using Null Quantification

    • Variable yy does not appear in Β¬P(x)\neg P(x), and variable xx does not appear in Q(y)Q(y).
    • Hoist βˆƒx\exists x: βˆƒx(Β¬P(x)βˆ¨βˆƒyQ(y))\exists x \big( \neg P(x) \lor \exists y Q(y) \big)
    • Hoist βˆƒy\exists y: βˆƒxβˆƒy(Β¬P(x)∨Q(y))\exists x \exists y \big( \neg P(x) \lor Q(y) \big)
    • Prefix: βˆƒxβˆƒy\exists x \exists y. Matrix: (Β¬P(x)∨Q(y))(\neg P(x) \lor Q(y)).

Key Takeaway: An implication with βˆ€\forall in the antecedent converts into an existential prefix (βˆƒ\exists) in PNF due to the negation of the antecedent!


Example 2: Formal Deductive Proof in First-Order Logic​

Problem Statement: Prove the classic syllogism using first-order inference rules:

  1. "All men are mortal": βˆ€x(M(x)β†’D(x))\forall x (M(x) \to D(x))
  2. "Socrates is a man": M(s)M(s)
  3. Prove: "Socrates is mortal": D(s)D(s)

Step-by-Step Solution:

StepFormal ExpressionRule of Inference Applied
1βˆ€x(M(x)β†’D(x))\forall x (M(x) \to D(x))Premise 1
2M(s)M(s)Premise 2
3M(s)β†’D(s)M(s) \to D(s)Universal Instantiation (UI) on Step 1 with c=sc = s
4D(s)D(s)Modus Ponens on Steps 2 and 3

The conclusion D(s)D(s) is derived cleanly in 4 formal steps.


Example 3: Disproving an Invalid Quantifier Implication​

Problem Statement: Prove that (βˆ€xP(x)β†’βˆ€xQ(x))β€…β€ŠβŸΉβ€…β€Šβˆ€x(P(x)β†’Q(x))(\forall x P(x) \to \forall x Q(x)) \implies \forall x (P(x) \to Q(x)) is INVALID by constructing a formal interpretation counterexample.

Step-by-Step Solution:

  1. Choose Domain: Let D={1,2}D = \{1, 2\}.
  2. Assign Predicates:
    • Let P(1)=TP(1) = \mathbf{T} and P(2)=FP(2) = \mathbf{F}.
    • Let Q(1)=FQ(1) = \mathbf{F} and Q(2)=TQ(2) = \mathbf{T}.
  3. Evaluate the Antecedent: (βˆ€xP(x))β†’(βˆ€xQ(x))(\forall x P(x)) \to (\forall x Q(x)):
    • βˆ€xP(x)≑P(1)∧P(2)≑T∧F=F\forall x P(x) \equiv P(1) \land P(2) \equiv T \land F = F.
    • Since the hypothesis βˆ€xP(x)\forall x P(x) is False, the antecedent (βˆ€xP(x))β†’(βˆ€xQ(x))(\forall x P(x)) \to (\forall x Q(x)) is vacuously True (F→⋯≑TF \to \dots \equiv T)!
  4. Evaluate the Consequent: βˆ€x(P(x)β†’Q(x))\forall x (P(x) \to Q(x)):
    • For x=1x = 1: P(1)β†’Q(1)≑Tβ†’F=FP(1) \to Q(1) \equiv T \to F = F (False!).
    • Thus, βˆ€x(P(x)β†’Q(x))\forall x (P(x) \to Q(x)) is False!
  5. Conclusion:
    • Under this interpretation, Antecedent=T\text{Antecedent} = T while Consequent=F\text{Consequent} = F.
    • Therefore, the implication is INVALID!

🎯 Exam & Interview Pitfall Check​

Core Conceptual Questions

Question 1: Is First-Order Logic decidable? Key Focus Points: No! By Church's Theorem and Turing's Undecidability Theorem (1936), First-Order Logic is semi-decidable (recursively enumerable), but NOT decidable. If a formula is valid, a resolution refutation will eventually find a proof in finite time. But if a formula is invalid, an automated prover may loop forever without halting!

Question 2: Why does Existential Instantiation (EI) require a fresh, unused constant symbol? Key Focus Points: If βˆƒxP(x)\exists x P(x) is known, using an existing constant (say, cc) assumes that the witness is an already-known entity. For example, if you know "Someone committed the robbery" (βˆƒxR(x)\exists x R(x)) and you instantiate it with "Alice" without evidence, you have falsely accused Alice! A fresh symbol (e.g., wfreshw_{\text{fresh}}) guarantees that no prior assumptions pollute the witness.

Common Interview Traps: Architectural Trade-Offs

Trap 1: Forgetting that βˆ€x(P(x)β†’A)≑(βˆƒxP(x))β†’A\forall x (P(x) \to A) \equiv (\exists x P(x)) \to A Why it fails: When pulling a quantifier out of the antecedent of an implication, students often leave it as βˆ€\forall. Because P(x)β†’A≑¬P(x)∨AP(x) \to A \equiv \neg P(x) \lor A, the negation flips βˆ€\forall to βˆƒ\exists! Pulling quantifiers across the left side of β†’\to ALWAYS inverts the quantifier!

Trap 2: Renaming variables carelessly during PNF conversion Why it fails: In (βˆ€xP(x))∨(βˆƒxQ(x))(\forall x P(x)) \lor (\exists x Q(x)), hoisting without renaming produces βˆ€xβˆƒx(P(x)∨Q(x))\forall x \exists x (P(x) \lor Q(x)), where the inner βˆƒx\exists x illegally shadows the outer βˆ€x\forall x. You must always standardize variables apart first: (βˆ€xP(x))∨(βˆƒyQ(y))β‰‘βˆ€xβˆƒy(P(x)∨Q(y))(\forall x P(x)) \lor (\exists y Q(y)) \equiv \forall x \exists y (P(x) \lor Q(y)).

πŸ’¬

Discussion & Doubts