It can be likened to program scope in coding, since a (programming) variable only makes sense within its function scope, just like a (logical) variable is only bound inside its quantifier scope.

Variable Binding

A quantifier over some variable binds in its scope. Alternatively, is said to be a bound variable. Any unbound variable is said to be a free variable.

Bad Conventions

Technically speaking, unlike in maths, we can assign the same symbol to multiple variables. I.e., if we were to have a mathematical equation, it would be something like , whereas a valid (here meaning obeying the rules) formula can just only use without any subscripts if each instance is in a different binding scope. That is, if we have a formula where is bound under different quantifiers (and/or is free) we can give it different meanings. This is similar to variable shadowing in programming, where variables with the same names have different purposes in different program scopes. It’s not good practice, but again, technically it’s possible.

Some examples:

  • : is bound, is a free variable
  • : is bound throughout the formula, while the first (on the left) is free. The second (after the ) is bound.
  • : The first and last instances of are bound, while the middle one is free.

A formula is closed if it contains no free variables

Substitution Inside Scope

Bound variables can be renamed to other variable symbols (thus binding them instead) provided there is no clashing. To avoid clashing, the renamed variable must not be inside the quantifier scope (it does not matter if it is free or bound!). If these restrictions hold, then substitution does not change the semantics of the formula. That is, it preserves semantic consequences.

This does not hold when renaming free variables. Any renaming of a free variable no longer preserves semantic conseqeunces

For example, take the formula . We can identify that (in the quantifier scope), is a bound variable and is a free variable:

  • is a substitution of a bound variable to an out-of-scope variable, . Hence, semantic consequences are preserved i.e. the meaning of the formula is unchanged.
  • is a substitution of a bound variable to an in-scope variable. This formula has a very different meaning to the original . Hence, semantic consequences are not preserved.
  • is a substitution of a free variable. Semantic consequences are not preserved.