Definition

A free variable in an Expression is a variable that is not bound by any quantifier, lambda abstraction, or other binding construct within that expression.

A variable occurrence is free if it refers to a value from an enclosing context rather than being locally bound within the expression.

Examples

In the expression :

  • is bound by the lambda abstraction
  • is free (not bound within this expression)

In the expression :

  • is bound by the universal quantifier
  • is free

In the expression :

  • Both and are free (no binding constructs present)

Formal Definition

The set of free variables of an expression can be defined inductively:

  • for a variable

Closed Expressions

An expression with no free variables is called closed or a combinator. Closed expressions are self-contained and do not depend on any external context.

Substitution

Free variables are the targets of substitution. When substituting for in expression , written , only the free occurrences of in are replaced.

Care must be taken to avoid variable capture, where substitution would incorrectly bind a free variable.