Skip to main content
โšก Calmops

Scope and Variable Binding in Predicate Logic

Introduction

Scope and variable binding are fundamental concepts in predicate logic that determine how quantifiers interact with variables and formulas. Understanding these concepts is essential for:

  • Correctly interpreting logical formulas
  • Avoiding logical errors
  • Understanding the semantics of quantified statements
  • Writing correct logical proofs

In this article, we’ll explore scope, variable binding, free and bound variables, and how to work with them correctly.

What is Scope?

Scope is the range of a formula over which a quantifier applies. It determines which variables are bound by a quantifier and which are free.

Scope Notation

The scope of a quantifier extends from the quantifier to the end of the formula or to the matching closing parenthesis.

Examples:

โˆ€x P(x)
Scope of โˆ€x: P(x)

โˆ€x (P(x) โˆง Q(x))
Scope of โˆ€x: (P(x) โˆง Q(x))

โˆ€x (P(x) โ†’ โˆƒy Q(y))
Scope of โˆ€x: (P(x) โ†’ โˆƒy Q(y))
Scope of โˆƒy: Q(y)

Scope Hierarchy

When quantifiers are nested, inner quantifiers have narrower scope than outer quantifiers.

Example:

โˆ€x (P(x) โ†’ โˆƒy Q(x, y))
     โ†‘                โ†‘
     Outer scope (โˆ€x)
              โ†‘    โ†‘
              Inner scope (โˆƒy)

Free and Bound Variables

A variable is bound if it appears within the scope of a quantifier that binds it. A variable is free if it is not bound by any quantifier.

Identifying Bound Variables

A variable is bound if it appears within the scope of a quantifier with the same variable name.

Examples:

โˆ€x P(x)
x is bound (appears in scope of โˆ€x)

โˆ€x (P(x) โˆง Q(x))
Both x's are bound (appear in scope of โˆ€x)

โˆ€x P(x, y)
x is bound, y is free (no quantifier for y)

Identifying Free Variables

A variable is free if it appears outside the scope of any quantifier that binds it.

Examples:

P(x)
x is free (no quantifier)

โˆ€x P(x, y)
x is bound, y is free

โˆ€x P(x) โˆง Q(y)
x is bound, y is free (Q(y) is outside scope of โˆ€x)

Examples with Multiple Variables

โˆ€x โˆƒy P(x, y)
x is bound by โˆ€x
y is bound by โˆƒy
No free variables

โˆ€x (P(x, y) โ†’ Q(x))
x is bound by โˆ€x
y is free (no quantifier for y)

โˆ€x P(x) โˆง Q(y)
x is bound by โˆ€x
y is free (Q(y) is outside scope of โˆ€x)

โˆ€x (P(x, y) โˆง โˆƒy Q(y))
First x is bound by โˆ€x
First y is free (in P(x, y), outside scope of โˆƒy)
Second y is bound by โˆƒy

Scope Ambiguity

Scope ambiguity occurs when it’s unclear which quantifier binds a variable or where a quantifier’s scope ends.

Example 1: Ambiguous Scope

โˆ€x P(x) โˆจ Q(x)

Interpretation 1: (โˆ€x P(x)) โˆจ Q(x)
Scope of โˆ€x: P(x)
x in Q(x) is free

Interpretation 2: โˆ€x (P(x) โˆจ Q(x))
Scope of โˆ€x: (P(x) โˆจ Q(x))
Both x's are bound

These have different meanings:

  • Interpretation 1: Either all x satisfy P, or some specific x satisfies Q
  • Interpretation 2: For all x, either P(x) or Q(x)

Example 2: Multiple Quantifiers

โˆ€x โˆƒy P(x, y)

Interpretation 1: For every x, there exists a y such that P(x, y)
โˆ€x (โˆƒy P(x, y))

Interpretation 2: There exists a y such that for every x, P(x, y)
โˆƒy (โˆ€x P(x, y))

These have very different meanings:

  • Interpretation 1: Each person has a mother (different mothers possible)
  • Interpretation 2: There is one person who is everyone’s mother

Resolving Ambiguity

Use parentheses to make scope explicit:

Ambiguous: โˆ€x P(x) โˆจ Q(x)

Clear: (โˆ€x P(x)) โˆจ Q(x)
or
Clear: โˆ€x (P(x) โˆจ Q(x))

Variable Binding Rules

Rule 1: A Quantifier Binds All Occurrences in Its Scope

When a quantifier binds a variable, all occurrences of that variable within its scope are bound by that quantifier.

Example:

โˆ€x (P(x) โˆง Q(x) โ†’ R(x))
All three x's are bound by โˆ€x

Rule 2: Inner Quantifiers Override Outer Quantifiers

When a variable is bound by both an inner and outer quantifier, the inner quantifier takes precedence.

Example:

โˆ€x (P(x) โˆง โˆƒx Q(x))
First x is bound by โˆ€x
Second x is bound by โˆƒx (inner quantifier)
The โˆƒx "shadows" the โˆ€x for its scope

This is called variable shadowing or variable capture.

Rule 3: Scope Extends to the End or Matching Parenthesis

The scope of a quantifier extends from the quantifier to the end of the formula or to the matching closing parenthesis.

Examples:

โˆ€x P(x) โˆง Q(x)
Scope of โˆ€x: P(x)
x in Q(x) is free

โˆ€x (P(x) โˆง Q(x))
Scope of โˆ€x: (P(x) โˆง Q(x))
Both x's are bound

Substitution and Variable Renaming

Substitution

Substitution is the process of replacing a variable with a term throughout a formula.

Example:

Formula: โˆ€x P(x, y)
Substitute y with a:
Result: โˆ€x P(x, a)

Formula: โˆ€x (P(x) โ†’ Q(x, y))
Substitute y with f(x):
Result: โˆ€x (P(x) โ†’ Q(x, f(x)))

Variable Renaming

Variable renaming (also called alpha-conversion) is the process of renaming bound variables without changing the meaning of a formula.

Example:

โˆ€x P(x) is equivalent to โˆ€y P(y)
โˆƒx Q(x) is equivalent to โˆƒz Q(z)

Key point: Only bound variables can be renamed. Free variables cannot be renamed without changing the formula’s meaning.

โˆ€x P(x, y) is NOT equivalent to โˆ€x P(x, z)
(y and z are free, so renaming changes meaning)

When to Use Variable Renaming

Variable renaming is useful for:

  • Avoiding variable capture
  • Making formulas clearer
  • Preparing formulas for substitution

Example:

Original: โˆ€x (P(x) โˆง โˆƒx Q(x))
Rename inner x to y: โˆ€x (P(x) โˆง โˆƒy Q(y))
Now it's clear that the two x's are different

Scope in Natural Language

Translating Scope from English

English sentences often have scope ambiguities that must be resolved when translating to logic.

Example 1:

"Every student has a teacher"

Interpretation 1: Each student has some teacher (possibly different)
โˆ€x (student(x) โ†’ โˆƒy (teacher(y) โˆง teaches(y, x)))

Interpretation 2: There is one teacher for all students
โˆƒy (teacher(y) โˆง โˆ€x (student(x) โ†’ teaches(y, x)))

Example 2:

"A student in every class is smart"

Interpretation 1: For each class, there is a student in that class who is smart
โˆ€x (class(x) โ†’ โˆƒy (student(y) โˆง in(y, x) โˆง smart(y)))

Interpretation 2: There is a student who is in every class and is smart
โˆƒy (student(y) โˆง โˆ€x (class(x) โ†’ in(y, x)) โˆง smart(y))

Context Determines Scope

The intended meaning usually depends on context:

"Every student has a teacher"
Natural interpretation: Each student has their own teacher
โˆ€x (student(x) โ†’ โˆƒy (teacher(y) โˆง teaches(y, x)))

"There is a teacher for every student"
Natural interpretation: One teacher for all students
โˆƒy (teacher(y) โˆง โˆ€x (student(x) โ†’ teaches(y, x)))

Scope in Logical Proofs

Scope in Universal Instantiation

When using universal instantiation, we must respect the scope of the quantifier.

Example:

Given: โˆ€x P(x)
We can instantiate: P(a)

Given: โˆ€x (P(x) โ†’ Q(x))
We can instantiate: P(a) โ†’ Q(a)

Given: โˆ€x P(x) โˆจ Q(x)
We can instantiate: P(a) โˆจ Q(x)
(x in Q(x) is free, so it remains free)

Scope in Existential Generalization

When using existential generalization, we must ensure the variable is free.

Example:

Given: P(a)
We can generalize: โˆƒx P(x)

Given: P(a, b)
We can generalize: โˆƒx P(x, b)
or: โˆƒy P(a, y)

Given: โˆ€x Q(x)
We cannot generalize to: โˆƒx โˆ€x Q(x)
(x is already bound)

Common Scope Errors

Error 1: Incorrect Scope of Quantifier

Incorrect: โˆ€x P(x) โˆง Q(x)
(Intends: โˆ€x (P(x) โˆง Q(x)))

Correct: โˆ€x (P(x) โˆง Q(x))

Error 2: Variable Capture

Incorrect: โˆ€x (P(x) โˆง โˆƒx Q(x))
(Inner x shadows outer x, confusing)

Better: โˆ€x (P(x) โˆง โˆƒy Q(y))
(Clear that x and y are different)

Error 3: Free Variable Treated as Bound

Incorrect: โˆ€x P(x, y) where y is free
Then claiming: "For all x and y, P(x, y)"

Correct: โˆ€x โˆ€y P(x, y)
(If both should be bound)

Error 4: Incorrect Scope in Translation

English: "All students study some subject"

Incorrect: โˆ€x โˆ€y (student(x) โˆง subject(y) โ†’ studies(x, y))
(This says all students study all subjects)

Correct: โˆ€x (student(x) โ†’ โˆƒy (subject(y) โˆง studies(x, y)))
(Each student studies some subject)

Glossary

  • Scope: The range of a formula over which a quantifier applies
  • Bound variable: A variable that appears within the scope of a quantifier
  • Free variable: A variable that is not bound by any quantifier
  • Variable binding: The process of a quantifier binding variables
  • Variable shadowing: When an inner quantifier binds a variable already bound by an outer quantifier
  • Substitution: Replacing a variable with a term
  • Variable renaming: Renaming bound variables (alpha-conversion)
  • Scope ambiguity: Unclear which quantifier binds a variable or where scope ends
  • Occurs check: Checking if a variable appears in a term

Practice Problems

Problem 1: Identifying Bound and Free Variables

For each formula, identify which variables are bound and which are free:

  1. โˆ€x P(x, y)
  2. โˆ€x (P(x) โˆง Q(y))
  3. โˆ€x โˆƒy P(x, y)
  4. โˆ€x (P(x) โ†’ Q(x, y))
  5. โˆ€x P(x) โˆง Q(x)

Solution:

  1. x bound, y free
  2. x bound, y free
  3. x and y both bound
  4. x bound, y free
  5. x bound in P(x), x free in Q(x)

Problem 2: Scope Ambiguity

For each ambiguous formula, provide two interpretations:

  1. โˆ€x P(x) โˆจ Q(x)
  2. โˆ€x P(x) โ†’ Q(x)

Solution:

  1. Interpretation 1: (โˆ€x P(x)) โˆจ Q(x) - Either all x satisfy P, or some x satisfies Q Interpretation 2: โˆ€x (P(x) โˆจ Q(x)) - For all x, either P(x) or Q(x)

  2. Interpretation 1: (โˆ€x P(x)) โ†’ Q(x) - If all x satisfy P, then some x satisfies Q Interpretation 2: โˆ€x (P(x) โ†’ Q(x)) - For all x, if P(x) then Q(x)

Problem 3: Variable Renaming

Rename the bound variables to avoid shadowing:

  1. โˆ€x (P(x) โˆง โˆƒx Q(x))
  2. โˆ€x (โˆ€x P(x) โ†’ Q(x))

Solution:

  1. โˆ€x (P(x) โˆง โˆƒy Q(y))
  2. โˆ€x (โˆ€y P(y) โ†’ Q(x))

Problem 4: Translation with Scope

Translate to predicate logic, being careful about scope:

  1. “Every student studies some subject”
  2. “Some subject is studied by every student”
  3. “For every person, there is someone they like”

Solution:

  1. โˆ€x (student(x) โ†’ โˆƒy (subject(y) โˆง studies(x, y)))
  2. โˆƒy (subject(y) โˆง โˆ€x (student(x) โ†’ studies(x, y)))
  3. โˆ€x (person(x) โ†’ โˆƒy (person(y) โˆง likes(x, y)))

Online Platforms

Interactive Tools

  • “Language, Proof, and Logic” by Barwise & Etchemendy - Scope and binding
  • “Introduction to Logic” by Hurley - Comprehensive coverage
  • “Symbolic Logic” by Lewis & Langford - Classic text
  • “Logic: The Basics” by Priest - Accessible introduction
  • “Formal Semantics” by Heim & Kratzer - Advanced topics

Academic Journals

Software Tools

Conclusion

Scope and variable binding are fundamental concepts that determine how quantifiers interact with variables and formulas:

  • Scope defines the range over which a quantifier applies
  • Bound variables are within the scope of a quantifier
  • Free variables are not bound by any quantifier
  • Variable renaming helps avoid confusion and shadowing
  • Scope ambiguity must be resolved using parentheses and context

Mastering these concepts is essential for correctly interpreting and writing logical formulas.

In the next article, we’ll explore predicate logic equivalences, which show how different formulas can express the same logical relationships.


Next Article: Predicate Logic Equivalences

Previous Article: Translating English to Predicate Logic

Comments