# Substitution and Interchange

This page will use the notions of occurrence and subformula introduced at the Additional terminology section of Formal Syntax. These notions have been little used if at all since then, so you might want to review them.

## Substitution
### Tautological forms

We have introduced a number of tautologies, one example being
    (1) $\mathrm {Q} \rightarrow (\mathrm {P} \rightarrow \mathrm {Q} )\,\!$
Use the metavariables $\psi$ and $\varphi$ to replace $\mathrm {Q}$ and $\mathrm {R}$ in (1). This produces the form
    (2) $\psi \rightarrow (\varphi \rightarrow \psi )\,\!$
As it turns out, any formula matching this form is a tautology. Thus, for example, let $\psi =\mathrm {R} \land \mathrm {S}$ and $\varphi =\mathrm {P} \lor \mathrm {Q}$. Then,
    (3) $\mathrm {R} \land \mathrm {S} \rightarrow (\mathrm {P} \lor \mathrm {Q} \rightarrow \mathrm {R} \land \mathrm {S} )\,\!$
is a tautology. This process can be generalized to all tautologies: for any tautology, find its explicit form by replacing each sentence letters with distinct metavariables (written as Greek letters, as shown in (2)). We can call this a tautological form, which is a metalogical expression rather than a formula. Any instance of this tautological form is a tautology.

### Substitution instances

The preceding illustrated how we can generate new tautologies from old ones via tautological forms. Here, we will show how to generate tautologies without resorting to tautological forms. To do this, we define a substitution instance of a formula. Any substitution instance of a tautology is also a tautology.
First, we define the simple substitution instance of a formula for a sentence letter. Let $\varphi \,\!$ and $\psi \,\!$ be formulae and $\pi \,\!$ be a sentence letter. The simple substitution instance $\varphi [\pi /\psi ]\,\!$ is the result of replacing every occurrence of $\pi \,\!$ in $\varphi \,\!$ with an occurrence of $\psi \,\!$. A substitution instance of formulae for a sentence letters is the result of a chain of simple substitution instances. In particular, a chain of zero simple substitutions instances starting from $\varphi \,\!$ is a substitution instance and indeed is just $\varphi \,\!$ itself. Thus, any formula is a substitution instance of itself.
It turns out that if $\varphi \,\!$ is a tautology, then so is any simple substitution instance $\varphi [\pi /\psi ]\,\!$. If we start with a tautology and generate a chain of simple substitution instances, then every formula in the chain is also a tautology. Thus any (not necessarily simple) substitution instance of a tautology is also a tautology.

### Substitution examples

Consider (1) again. We substitute $\mathrm {R} \land \mathrm {S} \,\!$ for every occurrence of $\mathrm {Q} \,\!$ in (1). This gives us the following simple substitution instance of (1):
    (4) $\mathrm {R} \land \mathrm {S} \rightarrow (\mathrm {P} \rightarrow \mathrm {R} \land \mathrm {S} )\,\!$
In this, we substitute $\mathrm {P} \lor \mathrm {Q} \,\!$ for $\mathrm {P} \,\!$. That gives us (3) as a simple substitution instance of (4). Since (3) is the result of a chain of two simple substitution instances, it is a (non-simple) substitution instance of (1) Since (1) is a tautology, so is (3). We can express the chain of substitutions as
    $\mathrm {Q} \rightarrow (\mathrm {P} \rightarrow \mathrm {Q} )[\mathrm {Q} /\mathrm {R} \land \mathrm {S} ][\mathrm {P} /\mathrm {P} \lor \mathrm {Q} ]\,\!$
Take another example, also starting from (1). We want to obtain
    (5) $\mathrm {P} \rightarrow (\mathrm {Q} \rightarrow \mathrm {P} )\,\!$
Our first attempt might be to substitute $\mathrm {P} \,\!$ for $\mathrm {Q} \,\!$,
    (6) $\mathrm {P} \rightarrow (\mathrm {P} \rightarrow \mathrm {P} )\,\!$
This is indeed a tautology, but it is not the one we wanted. Instead, we substitute $\mathrm {R} \,\!$ for $\mathrm {P} \,\!$ in (1), obtaining
    $\mathrm {Q} \rightarrow (\mathrm {R} \rightarrow \mathrm {Q} )\,\!$
Now substitute $\mathrm {P} \,\!$ for $\mathrm {Q} \,\!$ obtaining
    $\mathrm {P} \rightarrow (\mathrm {R} \rightarrow \mathrm {P} )\,\!$
Finally, substituting $\mathrm {Q} \,\!$ for $\mathrm {R} \,\!$ gets us the result we wanted, namely (5). Since (1) is a tautology, so is (5). We can express the chain of substitutions as
    $\mathrm {Q} \rightarrow (\mathrm {P} \rightarrow \mathrm {Q} )[\mathrm {P} /\mathrm {R} ][\mathrm {Q} /\mathrm {P} ][\mathrm {R} /\mathrm {Q} ]\!$

### Simultaneous substitutions

We can compress a chain of simple substitutions into a single complex substitution. Let $\varphi \,\!$, $\psi _{1}\,\!$, $\psi _{2}\,\!$, ... be formulae; let $\pi _{1}\,\!$, $\pi _{2}\,\!$, ... be sentence letters. We define a simultaneous substitution instance of formulas for sentence letters $\varphi [\pi _{1}/\psi _{1},\ \pi _{2}/\psi _{2},\ ...]\,\!$ be the result of starting with $\varphi \,\!$ and simultaneously replacing $\pi _{1}\,\!$ with $\psi _{1}\,\!$, $\pi _{2}\,\!$ with $\psi _{2}\,\!$, .... We can regenerate our examples.
The previously generated formula (3) is
    $\mathrm {Q} \rightarrow (\mathrm {P} \rightarrow \mathrm {Q} )[\mathrm {P} /\mathrm {P} \lor \mathrm {Q} ,\mathrm {Q} /\mathrm {R} \land \mathrm {S} ]\,\!$
Similarly, (5) is
    $\mathrm {Q} \rightarrow (\mathrm {P} \rightarrow \mathrm {Q} )[\mathrm {P} /\mathrm {Q} ,\ \mathrm {Q} /\mathrm {P} ]\,\!$
Finally (6) is
    $\mathrm {Q} \rightarrow (\mathrm {P} \rightarrow \mathrm {Q} )[\mathrm {Q} /\mathrm {P} ]\,\!$
When we get to predicate logic, simultaneous substitution instances will not be available. That is why we defined substitution instance by reference to a chain of simple substitution instances rather than as a simultaneous substitution instance.

## Interchange
### Interchange of equivalent subformulae

We previously saw the following equivalence at Properties of Sentential Connectives:
    (7) $\mathrm {P} \,\!$  $\lnot \lnot \mathrm {P} \,\!$
You then might expect the following equivalence:
    $\mathrm {P} \rightarrow \mathrm {Q} \land \mathrm {R} \,\!$  $\lnot \lnot (\mathrm {P} \rightarrow \mathrm {Q} \land \mathrm {R} )\,\!$
This expectation is correct; the two formulae are equivalent. Let $\varphi \,\!$ and $\psi \,\!$ be equivalent formulae. Let $\chi _{1}\,\!$ be a formula in which $\varphi \,\!$ occurs as a subformula. Finally, let $\chi _{2}\,\!$ be the result of replacing in $\chi \,\!$ at least one (not necessarily all) occurrences of $\varphi \,\!$ with $\psi \,\!$. Then $\chi _{1}\,\!$ and $\chi _{2}\,\!$ are equivalent. This replacement is called an interchange.
For a second example, suppose we want to generate the equivalence
    (8) $\mathrm {P} \rightarrow \mathrm {Q} \land \mathrm {R} \,\!$  $\mathrm {P} \rightarrow \lnot \lnot (\mathrm {Q} \land \mathrm {R} )\,\!$
We note the following equivalence:
    (9) $\mathrm {Q} \land \mathrm {R} \,\!$  $\lnot \lnot (\mathrm {Q} \land \mathrm {R} )\,\!$
These two formulae can be confirmed to be equivalent either by truth table or, more easily, by substituting $\mathrm {Q} \land \mathrm {R} \,\!$ for $\mathrm {P} \,\!$ in both formulae of (7).
This substitution does indeed establish (9) as an equivalence. We already noted that $\varphi \,\!$ and $\psi \,\!$ are equivalent if and only if $\varphi \leftrightarrow \psi \,\!$ is a tautology. Based on (7), we get the tautology
    $\mathrm {P} \leftrightarrow \lnot \lnot \mathrm {P} \,\!$
Our substitution then yields
    $\mathrm {Q} \land \mathrm {R} \leftrightarrow \lnot \lnot (\mathrm {Q} \land \mathrm {R} )\,\!$
which is also a tautology. The corresponding equivalence is then (9).
Based on (9), we can now replace the consequent of $\mathrm {P} \rightarrow \mathrm {Q} \land \mathrm {R} \,\!$ with its equivalent. This generates the desired equivalence, namely (8).
Every formula equivalent to a tautology is also a tautology. Thus an interchange of equivalent subformulae within a tautology results in a tautology. For example, we can use the substitution instance of (7):
    $\mathrm {Q} \,\!$  $\lnot \lnot \mathrm {Q} \,\!$
together with the tautology previously seen at Properties of Sentential Connectives:
    $(\mathrm {P} \rightarrow \mathrm {Q} )\lor (\mathrm {Q} \rightarrow \mathrm {R} )\,\!$
to obtain
    $(\mathrm {P} \rightarrow \lnot \lnot \mathrm {Q} )\lor (\mathrm {Q} \rightarrow \mathrm {R} )\,\!$
as a new tautology.

### Interchange example

As an example, we will use the interdefinability of connectives to express
    (10) $\mathrm {P} \leftrightarrow \mathrm {Q} \lor \mathrm {R} \,\!$
using only conditionals and negations.
Based on
    $\mathrm {P} \lor \mathrm {Q} \,\!$  $\lnot \mathrm {P} \rightarrow \mathrm {Q} \,\!$
we get the substitution instance
    $\mathrm {Q} \lor \mathrm {R} \,\!$  $\lnot \mathrm {Q} \rightarrow \mathrm {R} \,\!$
which in turn allows us to replace the appropriate subformula in (10) to get:
    (11) $\mathrm {P} \leftrightarrow \lnot \mathrm {Q} \rightarrow \mathrm {R} \,\!$
The equivalence
    $\mathrm {P} \leftrightarrow \mathrm {Q} \,\!$ $(\mathrm {P} \rightarrow \mathrm {Q} )\land (\mathrm {Q} \rightarrow \mathrm {P} )\,\!$
together with the appropriate substitution gives us
    (12) $(\mathrm {P} \rightarrow (\lnot \mathrm {Q} \rightarrow \mathrm {R} ))\land ((\lnot \mathrm {Q} \rightarrow \mathrm {R} )\rightarrow \mathrm {P} )\,\!$
as equivalent to (11).
Finally, applying
    $\mathrm {P} \land \mathrm {Q} \,\!$  $\lnot (\mathrm {P} \rightarrow \lnot \mathrm {Q} )\,\!$
together with the appropriate substitution, yields our final result:
    $\lnot (\mathrm {P} \rightarrow (\lnot \mathrm {Q} \rightarrow \mathrm {R} )\rightarrow \lnot ((\lnot \mathrm {Q} \rightarrow \mathrm {R} )\rightarrow \mathrm {P} ))\,\!$

## Summary

This page has presented two claims.
* A substitution instance of a tautology is also a tautology.
* Given a formula, the result of interchanging a subformula with an equivalent is a formula equivalent to the given formula.
These claims are not trivial observations or the result of a simple truth table. They are substantial claims that need proof. Proofs are available in a number of standard metalogic textbooks, but are not presented here.
| ← Properties of Sentential Connectives | ↑ Sentential Logic | Translations → |