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:
- ψ: (R → S) & (T → S)
is a substitution instance of
- φ: P & Q
That is, ψ can be obtained by replacing P and Q in φ with (R → S) and (T → S) respectively. Similarly:
- ψ: (A ↔ A) ↔ (A ↔ A)
is a substitution instance of:
- φ: (A ↔ A)
since ψ can be obtained by replacing each A in φ with (A ↔ A).
In some deduction systems for propositional logic, a new expression (a proposition) may be entered on a line of a derivation if it is a substitution instance of a previous line of the derivation.[failed verification] 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 (or interpretation) 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 σ: V → T from variables to terms; many,: 73 : 445 but not all: 250 authors additionally require σ(x) = x for all but finitely many variables x. The notation { x1 ↦ t1, …, xk ↦ tk } refers 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 { x1 ↦ t1, ..., xk ↦ tk }; it means to (simultaneously) 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 { x ↦ z, z ↦ h(a,y) } to the term
f( z , a, g( x ), y) yields f( h(a,y) , a, g( z ), y) .
The domain dom(σ) of a substitution σ is commonly defined as the set of variables actually replaced, i.e. dom(σ) = { x ∈ V | xσ ≠ x }. A substitution is called a ground substitution if it maps all variables of its domain to ground, i.e. variable-free, terms. The substitution instance tσ of a ground substitution is a ground term if all of t's variables are in σ's domain, i.e. if vars(t) ⊆ dom(σ). A substitution σ is called a linear substitution if tσ is a linear term for some (and hence every) linear term t containing precisely the variables of σ's domain, i.e. with vars(t) = 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, { x ↦ 2, y ↦ 3+4 } is a ground substitution, { x ↦ x1, y ↦ y2+4 } is non-ground and non-flat, but linear, { x ↦ y2, y ↦ y2+4 } is non-linear and non-flat, { x ↦ y2, y ↦ y2 } is flat, but non-linear, { x ↦ x1, y ↦ y2 } 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 {x,y} as its domain. An example for a renaming substitution is { x ↦ x1, x1 ↦ y, y ↦ y2, y2 ↦ x }, it has the inverse { x ↦ y2, y2 ↦ y, y ↦ x1, x1 ↦ x }. The flat substitution { x ↦ z, y ↦ z } cannot have an inverse, since e.g. (x+y) { x ↦ z, y ↦ z } = 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 { x ↦ 2 } cannot have an inverse due to a similar loss of origin information e.g. in (x+2) { x ↦ 2 } = 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 σ = { x1 ↦ t1, …, xk ↦ tk } and τ = { y1 ↦ u1, …, yl ↦ ul } is obtained by removing from the substitution { x1 ↦ t1τ, …, xk ↦ tkτ, y1 ↦ u1, …, yl ↦ ul } those pairs yi ↦ ui for which yi ∈ { x1, …, xk }. The composition of σ and τ is denoted by στ. Composition is an associative operation, and is compatible with substitution application, i.e. (ρσ)τ = ρ(στ), and (tσ)τ = 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 { x1 ↦ t1, …, xk ↦ tk } 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.: 73–74 : 445–446
For example, { x ↦ 2, y ↦ 3+4 } is equal to { y ↦ 3+4, x ↦ 2 }, but different from { x ↦ 2, y ↦ 7 }. The substitution { x ↦ y+y } is idempotent, e.g. ((x+y) {x↦y+y}) {x↦y+y} = ((y+y)+y) {x↦y+y} = (y+y)+y, while the substitution { x ↦ x+y } is non-idempotent, e.g. ((x+y) {x↦x+y}) {x↦x+y} = ((x+y)+y) {x↦x+y} = ((x+y)+y)+y. An example for non-commuting substitutions is { x ↦ y } { y ↦ z } = { x ↦ z, y ↦ z }, but { y ↦ z} { x ↦ y} = { x ↦ y, y ↦ z }.
Mathematics
In mathematics, there are two common uses of substitution: substitution of variables for constants (also called assignment for that variable), 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 x, y, and z, 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 (like the coefficients of a polynomial), 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. (This is called Universal instantiation)
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 (though the latter term is usually reserved for philosophical contexts), 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 (with a free variable x). For example: For all real numbers a and b, if a = b, then a ≥ 0 implies b ≥ 0 (here, is x ≥ 0). This is a property which is most often used in algebra, especially in solving systems of equations, but is apllied 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 (in the case of polynomials, the ring structure).[citation needed]
Algebra
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 (or another expression) 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(X)", 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.
See also
- Integration by substitution
- Lambda calculus § Substitution
- String interpolation
- Substitution property of Equality
- Trigonometric substitution
- Universal instantiation
- Principal equation form
Notes
- Some authors use [ t1/x1, …, tk/xk ] to denote that substitution, e.g. M. Wirsing (1990). Jan van Leeuwen (ed.). Algebraic Specification. Handbook of Theoretical Computer Science. Vol. B. Elsevier. pp. 675–788., here: p. 682.
- From a term algebra point of view, the set T of terms is the free term algebra over the set V of variables, hence for each substitution mapping σ: V → T there is a unique homomorphism σ: T → T that agrees with σ on V ⊆ T; the above-defined application of σ to a term t is then viewed as applying the function σ to the argument t.
Citations
- Hunter, Geoffrey (1996) [1971]. Metalogic: An Introduction to the Metatheory of Standard First-Order Logic. University of California Press (published 1973). p. 118. ISBN 9780520023567. OCLC 36312727. (accessible to patrons with print disabilities)
- David A. Duffy (1991). Principles of Automated Theorem Proving. Wiley.
- Franz Baader, Wayne Snyder (2001). Alan Robinson and Andrei Voronkov (ed.). Unification Theory (PDF). Elsevier. pp. 439–526. Archived from the original (PDF) on 2015-06-08. Retrieved 2014-09-24.
- N. Dershowitz; J.-P. Jouannaud (1990). "Rewrite Systems". In Jan van Leeuwen (ed.). Formal Models and Semantics. Handbook of Theoretical Computer Science. Vol. B. Elsevier. pp. 243–320.
- Sobolev, S. K. (2001) [1994], "Equality axioms", Encyclopedia of Mathematics, EMS Press
- Deutsch, Harry and Pawel Garbacz, "Relative Identity", The Stanford Encyclopedia of Philosophy (Fall 2024 Edition), Edward N. Zalta & Uri Nodelman (eds.), forthcoming URL: https://plato.stanford.edu/entries/identity-relative/#StanAccoIden
- Sobolev, S. K. (2001) [1994], "Individual variable", Encyclopedia of Mathematics, EMS Press
- Sobolev, S. K. (2001) [1994], "Free variable", Encyclopedia of Mathematics, EMS Press
- Fitting, M., First-Order Logic and Automated Theorem Proving (Berlin/Heidelberg: Springer, 1990), pp. 198–200.
- Margret H. Hoft; Hartmut F.W. Hoft (6 November 2002). Computing with Mathematica. Elsevier. ISBN 978-0-08-048855-4.
- Andre Heck (6 December 2012). Introduction to Maple. Springer Science & Business Media. ISBN 978-1-4684-0484-5.
substitution.
References
- Crabbé, M. (2004). On the Notion of Substitution. Logic Journal of the IGPL, 12, 111–124.
- Curry, H. B. (1952) On the definition of substitution, replacement and allied notions in an abstract formal system. Revue philosophique de Louvain 50, 251–269.
- Kleene, S. C. (1967). Mathematical Logic. Reprinted 2002, Dover. ISBN 0-486-42533-9
- Robinson, Alan J. A.; Voronkov, Andrei (2001-06-22). Handbook of Automated Reasoning. Elsevier. ISBN 978-0-08-053279-0
External links
- Substitution at the nLab
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 logicDefinition Where ps and f represent formulas of propositional logic ps is a substitution instance of f if and only if ps may be obtained from f by substituting formulas for propositional variables in f replacing each occurrence of the same variable by an occurrence of the same formula For example ps R S amp T S dd is a substitution instance of f P amp Q dd That is ps can be obtained by replacing P and Q in f with R S and T S respectively Similarly ps A A A A dd is a substitution instance of f A A dd since ps can be obtained by replacing each A in f with A A In some deduction systems for propositional logic a new expression a proposition may be entered on a line of a derivation if it is a substitution instance of a previous line of the derivation failed verification 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 or interpretation of its predicate symbols If F is a tautology and 8 is a substitution instance of F then 8 is again a tautology This fact implies the soundness of the deduction rule described in the previous section First order logicIn first order logic a substitution is a total mapping s V T from variables to terms many 73 445 but not all 250 authors additionally require s x x for all but finitely many variables x The notation x1 t1 xk tk refers 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 x1 t1 xk tk it means to simultaneously replace every occurrence of each xi in t by ti The result ts of applying a substitution s to a term t is called an instance of that term t For example applying the substitution x z z h a y to the term f z a g x y yieldsf h a y a g z y The domain dom s of a substitution s is commonly defined as the set of variables actually replaced i e dom s x V xs x A substitution is called a ground substitution if it maps all variables of its domain to ground i e variable free terms The substitution instance ts of a ground substitution is a ground term if all of t s variables are in s s domain i e if vars t dom s A substitution s is called a linear substitution if ts is a linear term for some and hence every linear term t containing precisely the variables of s s domain i e with vars t dom s A substitution s is called a flat substitution if xs is a variable for every variable x A substitution s is called a renaming substitution if it is a permutation on the set of all variables Like every permutation a renaming substitution s always has an inverse substitution s 1 such that tss 1 t ts 1s for every term t However it is not possible to define an inverse for an arbitrary substitution For example x 2 y 3 4 is a ground substitution x x1 y y2 4 is non ground and non flat but linear x y2 y y2 4 is non linear and non flat x y2 y y2 is flat but non linear x x1 y y2 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 x y as its domain An example for a renaming substitution is x x1 x1 y y y2 y2 x it has the inverse x y2 y2 y y x1 x1 x The flat substitution x z y z cannot have an inverse since e g x y x z y z 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 x 2 cannot have an inverse due to a similar loss of origin information e g in x 2 x 2 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 s t if xs xt for each variable x V The composition of two substitutions s x1 t1 xk tk and t y1 u1 yl ul is obtained by removing from the substitution x1 t1t xk tkt y1 u1 yl ul those pairs yi ui for which yi x1 xk The composition of s and t is denoted by st Composition is an associative operation and is compatible with substitution application i e rs t r st and ts t t st respectively for every substitutions r s t and every term t The identity substitution which maps every variable to itself is the neutral element of substitution composition A substitution s is called idempotent if ss s and hence tss ts for every term t When xi ti for all i the substitution x1 t1 xk tk is idempotent if and only if none of the variables xi occurs in any tj Substitution composition is not commutative that is st may be different from ts even if s and t are idempotent 73 74 445 446 For example x 2 y 3 4 is equal to y 3 4 x 2 but different from x 2 y 7 The substitution x y y is idempotent e g x y x y y x y y y y y x y y y y y while the substitution x x y is non idempotent e g x y x x y x x y x y y x x y x y y y An example for non commuting substitutions is x y y z x z y z but y z x y x y y z MathematicsIn mathematics there are two common uses of substitution substitution of variables for constants also called assignment for that variable 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 x y and z 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 like the coefficients of a polynomial 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 This is called Universal instantiation 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 i lt kaik textstyle sum i lt k a ik depending on the context the variable i textstyle i can be free and k textstyle k 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 though the latter term is usually reserved for philosophical contexts 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 a b ϕ a ϕ b displaystyle a b implies bigl phi a Rightarrow phi b bigr For every a textstyle a and b textstyle b and any well formed formula ϕ x textstyle phi x with a free variable x For example For all real numbers a and b if a b then a 0 implies b 0 here ϕ x displaystyle phi x is x 0 This is a property which is most often used in algebra especially in solving systems of equations but is apllied 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 b 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 in the case of polynomials the ring structure citation needed Algebra 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 or another expression 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 P X X5 3X2 5X 17 displaystyle P X X 5 3X 2 5X 17 so that substitution for X can be designated by replacement inside P X say P 2 13 displaystyle P 2 13 or P X 1 X5 5X4 10X3 7X2 4X 14 displaystyle P X 1 X 5 5X 4 10X 3 7X 2 4X 14 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 See alsoIntegration by substitution Lambda calculus Substitution String interpolation Substitution property of Equality Trigonometric substitution Universal instantiation Principal equation formNotesSome authors use t1 x1 tk xk to denote that substitution e g M Wirsing 1990 Jan van Leeuwen ed Algebraic Specification Handbook of Theoretical Computer Science Vol B Elsevier pp 675 788 here p 682 From a term algebra point of view the set T of terms is the free term algebra over the set V of variables hence for each substitution mapping s V T there is a unique homomorphism s T T that agrees with s on V T the above defined application of s to a term t is then viewed as applying the function s to the argument t CitationsHunter Geoffrey 1996 1971 Metalogic An Introduction to the Metatheory of Standard First Order Logic University of California Press published 1973 p 118 ISBN 9780520023567 OCLC 36312727 accessible to patrons with print disabilities David A Duffy 1991 Principles of Automated Theorem Proving Wiley Franz Baader Wayne Snyder 2001 Alan Robinson and Andrei Voronkov ed Unification Theory PDF Elsevier pp 439 526 Archived from the original PDF on 2015 06 08 Retrieved 2014 09 24 N Dershowitz J P Jouannaud 1990 Rewrite Systems In Jan van Leeuwen ed Formal Models and Semantics Handbook of Theoretical Computer Science Vol B Elsevier pp 243 320 Sobolev S K 2001 1994 Equality axioms Encyclopedia of Mathematics EMS Press Deutsch Harry and Pawel Garbacz Relative Identity The Stanford Encyclopedia of Philosophy Fall 2024 Edition Edward N Zalta amp Uri Nodelman eds forthcoming URL https plato stanford edu entries identity relative StanAccoIden Sobolev S K 2001 1994 Individual variable Encyclopedia of Mathematics EMS Press Sobolev S K 2001 1994 Free variable Encyclopedia of Mathematics EMS Press Fitting M First Order Logic and Automated Theorem Proving Berlin Heidelberg Springer 1990 pp 198 200 Margret H Hoft Hartmut F W Hoft 6 November 2002 Computing with Mathematica Elsevier ISBN 978 0 08 048855 4 Andre Heck 6 December 2012 Introduction to Maple Springer Science amp Business Media ISBN 978 1 4684 0484 5 substitution ReferencesCrabbe M 2004 On the Notion of Substitution Logic Journal of the IGPL 12 111 124 Curry H B 1952 On the definition of substitution replacement and allied notions in an abstract formal system Revue philosophique de Louvain 50 251 269 Kleene S C 1967 Mathematical Logic Reprinted 2002 Dover ISBN 0 486 42533 9 Robinson Alan J A Voronkov Andrei 2001 06 22 Handbook of Automated Reasoning Elsevier ISBN 978 0 08 053279 0External linksSubstitution at the nLab