Skip to main content

Natural Deduction for Predicate Logic

Before seeing the natural deduction rules for handling the quantifiers (\forall and \exists), we will need to be careful about how we handle variables in proofs. We will now have three1 different uses of identifiers in our proofs, representing different entities that we want to be able to refer to by name:

  • Propositions (pp, qq, ) and predicates (PP, QQ, ) stand for primitive statements that may be true or false, perhaps depending on the values of arguments. When we show that an argument is valid for pp and Q(a)Q(a), for example, we have also shown that the argument is valid when those propositional and predicate variables are replaced by actual statements, such as "It is raining" or "aa is an even number". As long as we are consistent about replacing variables with the same statement each time they occur, the resulting argument will have the same structure and be equally valid. If we are careful, we can even perform substitutions such as pp becomes qq and (simultaneously) qq becomes ¬p\lnot p; for example, if we have proven the argument pq,¬q¬pp\rightarrow q, \lnot q\vdash\lnot p (Modus Tollens), then applying this substitution would allow us to also use the argument q¬p,¬¬p¬qq\rightarrow\lnot p, \lnot\lnot p\vdash\lnot q as a step in a proof.

  • Line labels (ii, jj, , as well as 1\ell_1, 2\ell_2, ) allow us to name individual steps and assumptions in our proofs. I have been following the convention that lines in an actual proof are named 1\ell_1, 2\ell_2, , although they could be given more meaningful names such as hypothesis, first_case, or premise2. When describing the deduction rules, I have been using labels such as ii and jj to emphasize that the line being referenced could be anywhere earlier in the proof (as long as it is not local to a nested subproof).

  • Entity variables (xx, yy, , as well as aa, bb, ) stand for entities from the domain of discourse. I have been using aa, bb, to stand for particular values, such as the number 42 or the student Joe, that might be used in an argument, so Q(a)Q(a) could represent the statement "42 is an even number." When the variable is bound by a quantifier, I generally use xx or yy instead, to emphasize that the formula is saying something about the full range of values from the domain of discourse, and we are not free to interpret it as any particular entity. The actual name of a bound variable does not matter, only the association between its uses and the quantifier that is binding it. That is, we will consider xP(x)\exists xP(x) and yP(y)\exists yP(y) to be the same (and we may choose the name of the variable to avoid confusion with other variables as needed).2

Just as we can introduce temporary assumptions into subproofs, that are only available within that nested block of the proof, we will also introduce temporary entity variables in proofs by writing an assumption such as "fresh x0x_0" (or x1x_1, , as needed). This means that, within that subproof, the variable x0x_0 will refer to some entity from the domain of discourse. Unlike the variables (xx, yy, ) bound by quantifiers, such a fresh variable should be understood as representing a single entity; it can stand alone in a statement such as Q(x0)Q(x_0). However, unlike the top-level free variables (aa, bb, ), we do not get to choose a value for a fresh variable, nor is it allowed to escape from its subproof. That is, no formula outside of the braces is allowed to refer to x0x_0.

Universal Quantification

To prove a proposition xP(x)\forall xP(x), and "introduce" a universal quantifier, we need to show that P(x)P(x) is true regardless of which entity is substituted for xx. This is what a subproof with a fresh variable gives us:

i:fresh x0{P(x0)}xP(x),I i\begin{array}{l} i: \text{fresh}\ x_0\Rightarrow\{\\ \quad\ldots\\ \quad P(x_0)\\ \}\\ \hline\therefore \forall xP(x), \quad\forall I\ i \end{array}

The nested proof is a demonstration that P(x0)P(x_0) is true with no external assumptions on which entity x0x_0 refers to. The only way we can do this is if P(x)P(x) is actually true for all entities xx in the domain of discourse, that is, xP(x)\forall xP(x).

Here is an example, proving the validity of the argument px(Q(x)pQ(x))p\vdash\forall x(Q(x)\rightarrow p\land Q(x)):

1:ppremise2:fresh x0{3:Q(x0){4:pQ(x0)I 1,3}5:Q(x0)pQ(x0)I 3}6:x(Q(x)pQ(x))I 2\begin{array}{l|l} \ell_1: p & \text{premise}\\ \ell_2: \text{fresh}\ x_0\Rightarrow\{\\ \quad\ell_3: Q(x_0)\Rightarrow\{\\ \quad\quad\ell_4: p\land Q(x_0) & \land I\ \ell_1, \ell_3\\ \quad\}\\ \quad\ell_5: Q(x_0)\rightarrow p\land Q(x_0) & \rightarrow I\ \ell_3\\ \}\\ \ell_6: \forall x(Q(x)\rightarrow p\land Q(x)) & \forall I\ \ell_2 \end{array}

At step 5\ell_5, we are asserting that Q(x0)pQ(x0)Q(x_0)\rightarrow p\land Q(x_0) is true for some entity x0x_0, but since we were able to conclude this with no extra conditions on which entity that is, in 6\ell_6 we can introduce the universal quantifier. At this point, there are no remaining references to x0x_0, so nothing about the result can depend on which entity we useit must be true for all of them.

The corresponding elimination rule for the universal quantifier is simple: from the premise xP(x)\forall xP(x) we may conclude that the predicate PP holds for any entity aa in the domain of discourse:

i:xP(x)P(a),E i,a\begin{array}{l} i: \forall xP(x)\\ \hline\therefore P(a), \quad\forall E\ i, a \end{array}

For example, we can use this to prove the following quantified version of modus ponens: x(P(x)Q(x)),P(a)Q(a)\forall x(P(x)\rightarrow Q(x)), P(a)\vdash Q(a). That is, if P(x)P(x) implies Q(x)Q(x) for each xx, then knowing that P(a)P(a) holds for some aa lets us conclude that also Q(a)Q(a) holds. Here is the proof:

1:x(P(x)Q(x))premise2:P(a)Q(a)E 1,a3:P(a)premise4:Q(a)E 2,3\begin{array}{l|l} \ell_1: \forall x(P(x)\rightarrow Q(x)) & \text{premise}\\ \ell_2: P(a)\rightarrow Q(a) & \forall E\ \ell_1, a\\ \ell_3: P(a) & \text{premise}\\ \ell_4: Q(a) & \rightarrow E\ \ell_2, \ell_3 \end{array}

Here is a longer example showing a quantified version of the law of syllogism, x(P(x)Q(x)),x(Q(x)R(x))x(P(x)R(x))\forall x(P(x)\rightarrow Q(x)), \forall x(Q(x)\rightarrow R(x))\vdash\forall x(P(x)\rightarrow R(x)):

1:fresh x0{2:P(x0){3:x(P(x)Q(x))premise4:P(x0)Q(x0)E 3,x05:Q(x0)E 4,26:x(Q(x)R(x))premise7:Q(x0)R(x0)E 6,x08:R(x0)E 7,5}9:P(x0)R(x0)I 2}10:x(P(x)R(x))I 1\begin{array}{l|l} \ell_1: \text{fresh}\ x_0\Rightarrow\{\\ \quad\ell_2: P(x_0)\Rightarrow\{\\ \quad\quad\ell_3: \forall x(P(x)\rightarrow Q(x)) & \text{premise}\\ \quad\quad\ell_4: P(x_0)\rightarrow Q(x_0) & \forall E\ \ell_3, x_0\\ \quad\quad\ell_5: Q(x_0) & \rightarrow E\ \ell_4, \ell_2\\ \quad\quad\ell_6: \forall x(Q(x)\rightarrow R(x)) & \text{premise}\\ \quad\quad\ell_7: Q(x_0)\rightarrow R(x_0) & \forall E\ \ell_6, x_0\\ \quad\quad\ell_8: R(x_0) & \rightarrow E\ \ell_7, \ell_5\\ \quad\}\\ \quad\ell_9: P(x_0)\rightarrow R(x_0) & \rightarrow I\ \ell_2\\ \}\\ \ell_{10}: \forall x(P(x)\rightarrow R(x)) & \forall I\ \ell_1 \end{array}

Existential Quantification

Extending the analogy between the conjunction/disjunction operators and the universal/existential quantifiers, we find that the rule for introducing an existential is the dual of the universal elimination rule:

i:P(a)xP(x),I i,a\begin{array}{l} i: P(a)\\ \hline\therefore \exists xP(x), \quad\exists I\ i, a \end{array}

That is, to show that there exists some xx making P(x)P(x) true it is enough to show a specific aa in the domain of discourse such that P(a)P(a) holds.

For example, we may prove the validity of the argument xP(x)xP(x)\forall xP(x)\vdash\exists xP(x), as long as we are able to name some element aa of the domain of discourse:

1:xP(x)premise2:P(a)E 1,a3:xP(x)I 2,a\begin{array}{l|l} \ell_1: \forall xP(x) & \text{premise}\\ \ell_2: P(a) & \forall E\ \ell_1, a\\ \ell_3: \exists xP(x) & \exists I\ \ell_2, a \end{array}

For a different sort of example, suppose we are proving statements of arithmetic, and we have some means of deriving various equations and inequations about integers. Then we might see the following in a proof:

1:67=42arithmetic2:7>1arithmetic3:7>167=42I 2,14:n(n>16n=42)I 3,75:6>1arithmetic6:6>1n(n>16n=42)I 5,47:m(m>1n(n>1mn=42))I 6,6\begin{array}{l|l} \ell_1: 6\cdot 7=42 & \text{arithmetic}\\ \ell_2: 7>1 & \text{arithmetic}\\ \ell_3: 7>1 \land 6\cdot 7=42 & \land I\ \ell_2, \ell_1\\ \ell_4: \exists n(n>1 \land 6\cdot n=42) & \exists I\ \ell_3, 7\\ \ell_5: 6>1 & \text{arithmetic}\\ \ell_6: 6>1 \land \exists n(n>1 \land 6\cdot n=42) & \land I\ \ell_5, \ell_4\\ \ell_7: \exists m(m>1 \land \exists n(n>1 \land m\cdot n=42)) & \exists I\ \ell_6, 6 \end{array}

The conclusion on the last line shows that the number 42 is composite. There are other proofs of this fact (for example, starting from 314=423\cdot 14=42); to show that 42 is composite, we only have to come up with one way of factoring it into numbers greater than 1.

Finally, just as with the elimination rule for disjunction, the elimination rule for the existential is somewhat more complicated. However, instead of doing a case analysis of the two ways that pqp\lor q could be true, and show that we can conclude a common result rr in either case, for the existential we must analyze the potentially infinite number of cases (over all of the entities in our domain of discourse) and show that in each case we may conclude the same common result. The idea of conducting a subproof with extra assumptions, including a fresh variable to stand for whatever entity it is that "witnesses" the truth of the existential, captures what we need here:

i:xP(x)j:fresh x0,P(x0){r}r,E i,j\begin{array}{l} i: \exists xP(x)\\ j: \text{fresh}\ x_0, P(x_0)\Rightarrow\{\\ \quad\ldots\\ \quad r\\ \}\\ \hline\therefore r, \quad\exists E\ i, j \end{array}

In the nested proof, we assume two additional pieces of information: first, that x0x_0 is the name of a value in the domain of discourse, and second, that we have the additional fact that P(x0)P(x_0) is true. Within the subproof, we may use this extra knowledge to prove our conclusion rr. However, since x0x_0 needs to be "fresh" to the subproof, the identity of the witnessing entity is not allowed to escape from the block3 This meshes with our understanding of the existentialit tells us that there is some xx making P(x)P(x) true, but it doesn't tell us which entity it is.

We may now prove a law about the interaction of the existential and conjunction: x(P(x)Q(x))(xP(x))(xQ(x))\exists x(P(x)\land Q(x))\vdash(\exists xP(x))\land(\exists xQ(x)).

1:x(P(x)Q(x))premise2:fresh x0,P(x0)Q(x0){3:P(x0)E1 24:xP(x)I 3,x05:Q(x0)E2 26:xQ(x)I 5,x07:(xP(x))(xQ(x))I 4,6}8:(xP(x))(xQ(x))E 1,2\begin{array}{l|l} \ell_1: \exists x(P(x)\land Q(x)) & \text{premise}\\ \ell_2: \text{fresh}\ x_0, P(x_0)\land Q(x_0)\Rightarrow\{\\ \quad\ell_3: P(x_0) & \land E_1\ \ell_2\\ \quad\ell_4: \exists xP(x) & \exists I\ \ell_3, x_0\\ \quad\ell_5: Q(x_0) & \land E_2\ \ell_2\\ \quad\ell_6: \exists xQ(x) & \exists I\ \ell_5, x_0\\ \quad\ell_7: (\exists xP(x))\land(\exists xQ(x)) & \land I\ \ell_4, \ell_6\\ \}\\ \ell_8: (\exists xP(x))\land(\exists xQ(x)) & \exists E\ \ell_1, \ell_2 \end{array}

It is instructive to see where the proof attempt fails if we try to go the other direction and show (xP(x))(xQ(x))x(P(x)Q(x))(\exists xP(x))\land(\exists xQ(x))\vdash\exists x(P(x)\land Q(x)):

1:(xP(x))(xQ(x))premise2:xP(x)E1 13:fresh x0,P(x0){4:xQ(x)E2 15:fresh x1,Q(x1){6:P(x0)Q(x1)I 3,5?\begin{array}{l|l} \ell_1: (\exists xP(x))\land(\exists xQ(x)) & \text{premise}\\ \ell_2: \exists xP(x) & \land E_1\ \ell_1\\ \ell_3: \text{fresh}\ x_0, P(x_0)\Rightarrow\{\\ \quad\ell_4: \exists xQ(x) & \land E_2\ \ell_1\\ \quad\ell_5: \text{fresh}\ x_1, Q(x_1)\Rightarrow\{\\ \quad\quad\ell_6: P(x_0)\land Q(x_1) & \land I\ \ell_3, \ell_5\\ \quad\quad\ldots? \end{array}

The problem comes in step 5\ell_5, where we must introduce a different variable, x1x_1, as the witness for xQ(x)\exists xQ(x), because of the requirement that the variable be fresh. This should match your intuition for why the claim failed: although there exists an xx making P(x)P(x) true and there also exists an xx making Q(x)Q(x) true, there is no reason to believe that they are the same entities. Indeed, if P(x)P(x) says "xx is odd" and Q(x)Q(x) says "xx is even", then there will be no overlap in the entities making each true. There are odd numbers, and there are even numbers, but there are no numbers that are both odd and even.

Exercises

  1. Prove a similar result to the one just above, showing the interaction of the existential and the universal quantifiers:

xyP(x,y)yxP(x,y)\exists x\forall y P(x, y)\vdash\forall y\exists x P(x, y)

Answer
1:fresh y0{2:xyP(x,y)premise3:fresh x0,yP(x0,y){4:P(x0,y0)E 3,y05:xP(x,y0)I 4,x0}6:xP(x,y0)E 2,3}7:yxP(x,y)I 1\begin{array}{l|l} \ell_1: \text{fresh}\ y_0\Rightarrow\{\\ \quad\ell_2: \exists x\forall y P(x, y) & \text{premise}\\ \quad\ell_3: \text{fresh}\ x_0, \forall y P(x_0, y)\Rightarrow\{\\ \quad\quad\ell_4: P(x_0, y_0) & \forall E\ \ell_3,y_0\\ \quad\quad\ell_5: \exists x P(x, y_0) & \exists I\ \ell_4,x_0\\ \quad\}\\ \quad\ell_6: \exists x P(x, y_0) & \exists E\ \ell_2,\ell_3\\ \}\\ \ell_7: \forall y\exists x P(x, y) & \forall I\ \ell_1 \end{array}
  1. Discuss why the opposite direction of the previous problem is not a valid argument:

yxP(x,y)xyP(x,y)\forall y\exists xP(x, y)\vdash\exists x\forall yP(x, y)

Answer

The premise claims that for any yy you can find an xx making P(x,y)P(x, y) true, but it might be a different xx for each yy. That is, the existential witness for xx should be expressed as a function of yy: given input yy, the output of the function is an appropriate witness (a value of xx such that P(x,y)P(x, y) for that particular choice of yy).

However, the conclusion of the argument asserts that there is a single xx that makes P(x,y)P(x, y) true for all values of yy. That's a much stronger statement, saying that we can choose the witness xx independent of knowing yy.

For a simple example, let P(x,y)P(x, y) be x=2yx=2y. The premise claims yx(x=2y)\forall y\exists x(x=2y), and it is easy to see that the function giving the witness is just f(y)=2yf(y)=2y. However, the conclusion of this invalid argument would claim that xy(x=2y)\exists x\forall y(x=2y), but there is no way that we can choose a single xx that is simultaneously equal to all of the even numbers!


  1. There is also a fourth use, if we are maintaining a library of previous proofs and applying them by name, such as "Modus Tollens", to justify steps in later proofs.
  2. The analogy in programming is to note that the index variable for a loop can be anything; although we might usually use i, we may consistently switch to using j for a given loop if there is already a variable named i in that part of the program.
  3. There is some sort of "witness protection program" analogy to be made here.