Substitution (logic)
A substitution is a syntactic transformation on formal expressions.
To apply a substitution to an expression means to consistently replace its variable, or placeholder, symbols with other expressions.
The resulting expression is called a substitution instance, or instance for short, of the original expression.
Propositional logic
Definition
Where ψ and φ represent formulas of propositional logic, ψ is a substitution instance of φ if and only if ψ may be obtained from φ by substituting formulas for propositional variables in φ, replacing each occurrence of the same variable by an occurrence of the same formula. For example:is a substitution instance of
That is, ψ can be obtained by replacing P and Q in φ with and respectively. Similarly:
is a substitution instance of:
since ψ can be obtained by replacing each A in φ with.
In some deduction systems for propositional logic, a new expression may be entered on a line of a derivation if it is a substitution instance of a previous line of the derivation. This is how new lines are introduced in some axiomatic systems. In systems that use rules of transformation, a rule may include the use of a substitution instance for the purpose of introducing certain variables into a derivation.
Tautologies
A propositional formula is a tautology if it is true under every valuation of its predicate symbols. If Φ is a tautology, and Θ is a substitution instance of Φ, then Θ is again a tautology. This fact implies the soundness of the deduction rule described in the previous section.First-order logic
In first-order logic, a substitution is a total mapping from variables to terms; many, but not all authors additionally require σ = x for all but finitely many variables x. The notationrefers to a substitution mapping each variable xi to the corresponding term ti, for i=1,…,k, and every other variable to itself; the xi must be pairwise distinct. Most authors additionally require each term ti to be syntactically different from xi, to avoid infinitely many distinct notations for the same substitution. Applying that substitution to a term t is written in postfix notation as t ; it means to replace every occurrence of each xi in t by ti. The result tσ of applying a substitution σ to a term t is called an instance of that term t.
For example, applying the substitution to the term
The domain ''dom of a substitution σ'' is commonly defined as the set of variables actually replaced, i.e. dom =.
A substitution is called a ground substitution if it maps all variables of its domain to linear terms|ground], i.e. variable-free, terms.
The substitution instance tσ of a ground substitution is a ground term if all of ts variables are in σs domain, i.e. if vars ⊆ dom.
A substitution σ is called a linear substitution if tσ is a linear term for some linear term t containing precisely the variables of σs domain, i.e. with vars = dom.
A substitution σ is called a flat substitution if xσ is a variable for every variable x.
A substitution σ is called a renaming substitution if it is a permutation on the set of all variables. Like every permutation, a renaming substitution σ always has an inverse substitution σ−1, such that tσσ−1 = t = tσ−1σ for every term t. However, it is not possible to define an inverse for an arbitrary substitution.
For example, is a ground substitution, is non-ground and non-flat, but linear,
is non-linear and non-flat, is flat, but non-linear, is both linear and flat, but not a renaming, since it maps both y and y2 to y2; each of these substitutions has the set as its domain. An example for a renaming substitution is, it has the inverse. The flat substitution cannot have an inverse, since e.g. = z+''z, and the latter term cannot be transformed back to x''+y, as the information about the origin a z stems from is lost. The ground substitution cannot have an inverse due to a similar loss of origin information e.g. in = 2+2, even if replacing constants by variables was allowed by some fictitious kind of "generalized substitutions".
Two substitutions are considered equal if they map each variable to syntactically equal result terms, formally: σ = τ if xσ = xτ for each variable x ∈ V.
The composition of two substitutions σ = and τ = is obtained by removing from the substitution those pairs yi ↦ ui for which yi ∈.
The composition of σ and τ is denoted by στ. Composition is an associative operation, and is compatible with substitution application, i.e. τ = ρ, and τ = t, respectively, for every substitutions ρ, σ, τ, and every term t.
The identity substitution, which maps every variable to itself, is the neutral element of substitution composition. A substitution σ is called idempotent if σσ = σ, and hence tσσ = tσ for every term t. When xi≠ti for all i, the substitution is idempotent if and only if none of the variables xi occurs in any tj. Substitution composition is not commutative, that is, στ may be different from τσ, even if σ and τ are idempotent.
For example, is equal to, but different from. The substitution is idempotent, e.g. = = +y, while the substitution is non-idempotent, e.g. = = +y. An example for non-commuting substitutions is =, but =.
Mathematics
In mathematics, there are two common uses of substitution: substitution of variables for constants, and the substitution property of equality, also called Leibniz's Law.Considering mathematics as a formal language, a variable is a symbol from an alphabet, usually a letter like,, and, which denotes a range of possible values. If a variable is free in a given expression or formula, then it can be replaced with any of the values in its range. Certain kinds of bound variables can be substituted too. For instance, parameters of an expression, or the argument of a function. Moreover, variables being universally quantified can be replaced with any of the values in its range, and the result will a true statement.
For a non-formalized language, that is, in most mathematical texts outside of mathematical logic, for an individual expression it is not always possible to identify which variables are free and bound. For example, in, depending on the context, the variable can be free and bound, or vice-versa, but they cannot both be free. Determining which value is assumed to be free depends on context and semantics.
The substitution property of equality, or Leibniz's Law, generally states that, if two things are equal, then any property of one, must be a property of the other. It can be formally stated in logical notation as:For every and, and any well-formed formula . For example: For all real numbers and, if, then implies . This is a property which is most often used in algebra, especially in solving systems of equations, but is applied in nearly every area of math that uses equality. This, taken together with the reflexive property of equality, forms the axioms of equality in first-order logic.
Substitution is related to, but not identical to, function composition; it is closely related to β-reduction in lambda calculus. In contrast to these notions, however, the accent in algebra is on the preservation of algebraic structure by the substitution operation, the fact that substitution gives a homomorphism for the structure at hand.
Substitution is a basic operation in algebra, in particular in computer algebra.
A common case of substitution involves polynomials, where substitution of a numerical value for the indeterminate of a univariate polynomial amounts to evaluating the polynomial at that value. Indeed, this operation occurs so frequently that the notation for polynomials is often adapted to it; instead of designating a polynomial by a name like P, as one would do for other mathematical objects, one could define
so that substitution for X can be designated by replacement inside "P", say
or
Substitution can also be applied to other kinds of formal objects built from symbols, for instance elements of free groups. In order for substitution to be defined, one needs an algebraic structure with an appropriate universal property, that asserts the existence of unique homomorphisms that send indeterminates to specific values; the substitution then amounts to finding the image of an element under such a homomorphism.
Proof of substitution in ZFC
The following is a proof of the substitution property of equality in ZFC, which is adapted from Introduction to Axiomatic Set Theory by Gaisi Takeuti and Wilson M. Zaring.See Zermelo–Fraenkel set theory § Formal language for the definition of formulas in ZFC. The definition is recursive, so a proof by induction is used. In ZFC in first-order logic without equality, "set equality" is defined to mean that two sets have the same elements, written symbolically as "for all z, z is in x if and only if z is in y". Then, the Axiom of Extensionality asserts that if two sets have the same elements, then they belong to the same sets: