COMPSCI 225:
Discrete Structures in Mathematics and Computer Science

Logic and Proofs

Introduction to logic

A proposition is a statement which is either true or false. For example:

  1. “The sun is a star."
  2. "The moon is made of cheese."
  3. " 2+2=42+2=4 ."
  4. " 2+3=72+3=7 ."
  5. "Every even integer greater than 4 is the sum of two prime numbers."
  6. " 2>32>3 or 2<32<3 ."
  7. "If the world is flat then 2+2=42+2=4 .”

We only insist that the statement is true or false, we do not need to know which it is. Notice that the last two examples are formed by combining simpler propositions, namely "2>32>3 ", "2<32<3 ", “The world is flat”, and "2+2=42+2=4 ". A proposition which has been built up in this way is called a compound proposition, as opposed to a simple proposition which cannot be split into simpler propositions.

Example 1.1.Link copied Identify which of the following are propositions, and which are not:
  1. 2x=1002x=100 "
  2. " 2x=1002x=100 for some integer xx "
  3. "Shake well before opening"
  4. "CompSci 225 is the largest course at the University of Auckland”

Notation

Link copied

We typically use letters like pp , qq and rr to stand for simple propositions: we call these propositional variables. We usually use capital letters like AA , BB and CC to denote compound propositions, or propositions which might be simple or might be compound.

Connectives

Link copied

When we want to build more complicated propositions out of simpler ones, we use connectives. If AA and BB are propositions, then so are the following:

¬A\lnot A AB\qquad A\land B AB\qquad A\lor B AB\qquad A\to B AB\qquad A\leftrightarrow B

We read these as “not AA ”, ”AA and BB ”, ”AA or BB ”, ”AA implies BB ” (or “if AA then BB ”) and ”AA is equivalent to BB ” (or ”AA if and only if BB ”) respectively. We can combine compound propositions into more and more complicated propositions. For example, if pp denotes the proposition “It is raining”, qq denotes the proposition “The sun is shining” and rr denotes the proposition “There is a rainbow”, then (pq)r(p\land q)\to r represents the proposition “If it is raining and the sun is shining, then there is a rainbow”, while (p¬r)¬q(p\land \lnot r)\to\lnot q represents the proposition “If it is raining and there is no rainbow, then the sun is not shining”.

Example 1.2.Link copied How can the following advertising slogan be translated into a logical expression?

”If you drink and drive, you’re a bloody idiot.”

Solution. Let pp denote the proposition “You drink”.\ Let qq denote the proposition “You drive”.\ Let rr denote the proposition “You’re a bloody idiot”\ Then the slogan can be expressed as\

(pq)r(p\land q)\rightarrow r
Example 1.3.Link copied How can the following English sentence be translated into a logical expression?

”You cannot go to the pub if you are under 18 years old, unless you are accompanied by a parent.”

Truth values

We refer to the truth or falsity of a proposition as its truth value. The truth value of a compound proposition depends only on the truth or falsity of the propositions from which it was built, according to rules which we can give for each connective. We will consider these in detail later, but we can summarize them in the following table, which we call a “truth table”. In this table, 0 represents “false” and 1 represents “true”.

AB¬AABABABAB0010011011011010001001101111\begin{array}{c c||c|c|c|c|c} A & B & \lnot A & A\land B & A\lor B & A\to B & A\leftrightarrow B\\\hline 0 & 0 & 1 & 0 & 0 & 1 &1\\ 0 & 1 & 1 & 0 & 1 & 1 & 0\\ 1 & 0 & 0 & 0 & 1 & 0 & 0\\ 1 & 1 & 0 & 1 & 1 & 1 & 1\\ \end{array}

Truth

Link copied

The truth value of a compound proposition depends on the truth values of the propositions it was built from, according to the following rules:


Example 1.4.Link copied It is important to distinguish the logical connective \rightarrow from the rules of deduction.

Suppose that the proposition “if it snows today, then we will go skiing” is true. Suppose also that the hypothesis “it is snowing today” is true. Then from these two propositions we can deduce the conclusion “we will go skiing”.

The rule of deduction is called modus ponens _and can be written as (p(pq))q( p \land (p \rightarrow q) )\rightarrow q .

Truth tables

Link copied

Using these rules, we can build up the truth table for any compound proposition.

Example 1.5.Link copied For example, here are the truth tables for p(q¬r)p\to(q\lor\lnot r) and (pq)(qr)(p\to q)\lor(q\to r) .

pqr¬rq¬rp(q¬r)000111001001010111011011100111101000110111111011\begin{array}{c c c||ccc} p & q & r & \lnot r & q\lor\lnot r & p\to(q\lor\lnot r)\\\hline 0 & 0 & 0 & 1 & 1 & 1\\ 0 & 0 & 1 & 0 & 0 & 1\\ 0 & 1 & 0 & 1 & 1 & 1\\ 0 & 1 & 1 & 0 & 1 & 1\\ 1 & 0 & 0 & 1 & 1 & 1\\ 1 & 0 & 1 & 0 & 0 & 0\\ 1 & 1 & 0 & 1 & 1 & 1\\ 1 & 1 & 1 & 0 & 1 & 1\\ \end{array}
pqr(pq)(qr)00001010100010101011010011110001101111111001001010101100101111011111001111111111\begin{array}{c c c||rcl|c|rcl} p & q & r & (p & \to & q) & \lor & (q & \to & r)\\\hline 0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 & 1 & 0\\ 0 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 1\\ 0 & 1 & 0 & 0 & 1 & 1 & 1 & 1 & 0 & 0\\ 0 & 1 & 1 & 0 & 1 & 1 & 1 & 1 & 1 & 1\\ 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0\\ 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 1 & 1\\ 1 & 1 & 0 & 1 & 1 & 1 & 1 & 1 & 0 & 0\\ 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\ \end{array}

The second style becomes more useful as the propositions get more complicated. The column between the vertical lines gives the truth value of the whole proposition.

Example 1.6.Link copied Write out the truth table for p(qr)p\to (q\lor r) .

Example 1.7.Link copied Let

p : Blaise Pascal invented several calculating machines,

q : The first all-electronic digital computer was constructed in the twentieth century,

r : π\pi was calculated to 1,000,000 decimal digits in 1954.

Represent the following proposition symbolically and construct a truth table.

Either Blaise Pascal invented several calculating machines and it is not the case that the first all-electronic digital computer was constructed in the twentieth century: or π\pi was calculated to 1,000,000 decimal digits in 1954.

Other connectives

Link copied

We can define some other useful binary connectives besides the ones we have already mentioned. The most useful ones are \oplus , NAND and NOR, which denote “exclusive or”, “not-and” and “not-or”. Thus ABA\oplus B is true if and only if either AA is true or BB is true, but not both. Also AA NAND BB is true if and only if ABA\land B is false, and AA NOR BB is true if and only if ABA\lor B is false.

Example 1.8.Link copied Complete the following truth table:

pqpqp NAND qp NOR q00011011\begin{array}{c c|ccc} p & q & p\oplus q & p \ NAND \ q & p \ NOR \ q\\\hline 0 & 0 & & &&\\ 0 & 1 & & &&\\ 1 & 0 & & &&\\ 1 & 1 & & &&\\ \end{array}

Tautologies, contradictions and contingent propositions

A tautology is a proposition that is always true no matter what truth values we assign to the propositional variables it contains. For example, we showed in an earlier example that (pq)(qr)(p\to q)\lor(q\to r) is a tautology. A contradiction is a proposition that is always false no matter what truth values we assign to the propositional variables it contains. A proposition that is neither a tautology nor a contradiction is said to be contingent. Here are some examples.

  1. p¬pp\lor\lnot p is a tautology.
  2. ppp\to p is a tautology.
  3. p¬pp\land\lnot p is a contradiction.
  4. ¬(pq)¬p\lnot(p\to q)\land\lnot p is a contradiction.
  5. p(qr)p\to(q\to r) is contingent.
  6. p(qp)p\land(q\to p) is contingent.

Logical equivalence and logical implication

Two propositions AA and BB are logically equivalent, written ABA\Leftrightarrow B , if, whenever we assign truth values to the propositional variables they contain, AA and BB have the same truth value. Thus ABA\Leftrightarrow B holds if and only if ABA\leftrightarrow B is a tautology. To decide whether or not two propositions are logically equivalent, we can use truth tables. For example, to show that pq¬q¬pp\to q \Leftrightarrow \lnot q \to \lnot p , we build up the following truth table:

pqpq¬q¬p001111011011100100111010\begin{array}{cc||lr|c|c} p & q & p\to q & \lnot q & \to & \lnot p\\\hline 0 & 0 & 1 & 1 & 1 & 1\\ 0 & 1 & 1 & 0 & 1 & 1\\ 1 & 0 & 0 & 1 & 0 & 0\\ 1 & 1 & 1 & 0 & 1 & 0\\ \end{array}

Notice that columns 3 and 5 are identical.

Alternatively, we can try to convert one to the other using the following standard logical equivalences:

¬¬ppDouble negationpqpqqpqp}Commutative lawsp(qr)p(qr)(pq)r(pq)r}Associative lawsp(qr)p(qr)(pq)(pr)(pq)(pr)}Distributive lawspppppp}Idempotent laws¬(pq)¬(pq)¬p¬q¬p¬q}De Morgan’s lawspqpq¬pq¬(p¬q)}Implication laws\begin{array}{|rclcl|} \hline \\ \begin{array}{} \lnot\lnot p \end{array} & \begin{array}{} \Leftrightarrow \end{array} & \begin{array}{} p \end{array} & & \text{Double negation}\\ \\ \begin{array}{} p\land q \\ p\lor q \end{array} & \begin{array}{} \Leftrightarrow \\ \Leftrightarrow \end{array} & \begin{array}{} q\land p \\ q\lor p \end{array} & \Large \} & \text{Commutative laws}\\ \\ \begin{array}{} p\land (q\land r) \\ p\lor(q\lor r)\end{array} & \begin{array}{} \Leftrightarrow \\ \Leftrightarrow \end{array} & \begin{array}{} (p\land q)\land r \\ (p\lor q)\lor r \end{array} & \Large \} & \text{Associative laws}\\ \\ \begin{array}{} p\land (q\lor r) \\ p\lor (q\land r) \end{array} & \begin{array}{} \Leftrightarrow \\ \Leftrightarrow \end{array} & \begin{array}{} (p\land q)\lor(p\land r) \\ (p\lor q)\land(p\lor r) \end{array} & \Large \} & \text{Distributive laws}\\ \\ \begin{array}{} p\land p \\ p\lor p \end{array} & \begin{array}{} \Leftrightarrow \\ \Leftrightarrow \end{array} & \begin{array}{} p \\ p \end{array} & \Large \} & \text{Idempotent laws}\\ \\ \begin{array}{} \lnot(p\land q) \\ \lnot(p\lor q) \end{array} & \begin{array}{} \Leftrightarrow \\ \Leftrightarrow \end{array} & \begin{array}{} \lnot p\lor\lnot q \\ \lnot p\land\lnot q \end{array} & \Large \} & \text{De Morgan's laws}\\ \\ \begin{array}{} p\to q \\ p\to q \end{array} & \begin{array}{} \Leftrightarrow \\ \Leftrightarrow \end{array} & \begin{array}{} \lnot p\lor q \\ \lnot(p\land\lnot q) \end{array} & \Large \} & \text{Implication laws}\\ \\ \hline \end{array}

For example, we can show that p(qr)(pq)(pr)p\to(q\lor r)\Leftrightarrow(p\to q)\lor(p\to r) as follows:

pqp\to q
¬pq\Leftrightarrow \lnot p\lor q
q¬p\Leftrightarrow q\lor \lnot p
¬¬q¬p\Leftrightarrow \lnot\lnot q\lor \lnot p
¬q¬p\Leftrightarrow \lnot q\to \lnot p

Example 1.9.Link copied Show that ¬(pq)\neg ( p \vee q ) and ¬p¬q\neg p \wedge \neg q are logically equivalent. This equivalence is one of De Morgan’s laws for propositions, named after the English mathematician Augustus De Morgan, of the mid-19th century.

Example 1.10.Link copied Use De Morgan’s laws (and the other logic laws) to expand and simplify the negations of these propositions.
  1. p¬qp \land \lnot q
  2. (pq)(p \to q)
  3. (p¬q)(¬pr)(p \lor \lnot q) \land (\lnot p \lor r)
  4. (p¬q¬r)¬(q¬r)(p \land \lnot q \land \lnot r) \lor \lnot (q \lor \lnot r) .

Logical implication

Link copied

Let AA and BB be propositions. We say that AA logically implies BB , written ABA\Rightarrow B , if, whenever we assign truth values to the propositional variables they contain, if AA is true then BB is also true. Thus ABA\Rightarrow B if and only if ABA\to B is a tautology, and ABA\Leftrightarrow B if and only if ABA\Rightarrow B and BAB\Rightarrow A . That is, ABA\Leftrightarrow B if and only if ABA\leftrightarrow B is a tautology.

To clarify, the symbol \to is a logical operation (defined using a truth table) while the symbol \Rightarrow usually denotes some process of deduction.


Introduction to proofs

Mathematics is different from many other facets of life, as it is based on logic and proof. One of the most important reasons to study mathematics is to improve your ability to think logically, precisely, carefully and critically.

Definitions

Link copied

An important principle in mathematics is the need for precise definitions. Every technical word or symbol in mathematics has a precise definition. It must be un-ambiguous whether an object satisfies a definition or not.

Example 1.11.Link copied Which of the following are good definitions?
  1. An integer is even if it is something like 2 or 4.
  2. An integer nn is even if there exists an integer kk such that n=2kn = 2k .
  3. An integer nn is even if there exists an integer kk such that n=2k+1n = 2k+1 .
  4. An integer nn is even if nAn \in A .
  5. An integer nn is even if sin(n)=cos(n)=0\sin(n) = \cos(n) = 0 .

Theorems

Link copied

A theorem is a mathematical proposition that is true.

Theorems are essentially conditional statements, although the wording of a theorem may obscure this fact. Since theorems are conditional then we have to start doing mathematics with some initial facts that are assumed to be true: these are given by definitions and axioms.

There are several basic types of theorem:


Example 1.12.Link copied Theorem: 8 is an even integer.
Example 1.13.Link copied Theorem: If nn is even then n2n^2 is even.
Example 1.14.Link copied Theorem: Let nNn \in \N . A set with nn elements has exactly 2n2^n subsets. (In this wording the theorem does not seem to be a conditional statement; express this theorem as a conditional statement.)
Example 1.15.Link copied Theorem: Let nNn \in \N . There exists a set with nn elements.

Hypothesis and conclusion

Link copied

When the theorem is expressed as a conditional statement ABA \Rightarrow B then AA is called the hypothesis and BB is called the conclusion of the theorem.

Proofs

Link copied

Mathematics is about facts (theorems).

The interesting question is how do facts become “accepted” or “agreed” as part of mathematics. The discoverer of a mathematical fact is required to communicate their ideas to the wider community of mathematicians. But mathematicians are a hard audience to please: they are sceptical and don’t want to be fooled. So they do not simply believe everything that they are told is true. Mathematicians first insist on precise definitions before even agreeing that a claim is meaningful. Then, mathematicians are not convinced that a statement is true until a precise, rigorous, logical argument has been provided and checked: a mathematical proof. The ability to think logically and to read proofs not only increases mathematical understanding, but also hones skills that can be used in other situations. In this section we will discuss some basic methods of proof.

Direct proofs

Link copied

By a proof of a theorem we mean a logical argument that establishes the theorem to be true.

The most natural form of proof is a direct proof.

Suppose that we wish to prove the theorem PQP \Rightarrow Q . Since PQP \rightarrow Q is true whenever PP is false, we need only show that whenever PP is true, so is QQ .

Therefore:

in a direct proof we assume that the hypothesis of the theorem, PP , is true and demonstrate that the conclusion, QQ is true.

It then follows that PQP \rightarrow Q is always true.

Examples with integers

Link copied

We will illustrate some types of proofs by proving certain elementary facts about the integers. (Later on we will prove results about Sets and Graphs using the same types of proofs). We will use the following two definitions.

  1. An integer nn is called even if it can be written in the form n=2kn = 2k for some integer kk .
  2. An integer nn is called odd if it can be written in the form n=2k+1n= 2k + 1 for some integer kk .

Example 1.16.Link copied Prove the theorem: n=7n = 7 is an odd integer.

Example 1.17.Link copied Prove the theorem: If nn is an odd integer then n+1n+1 is an even integer.

Proof: Let n=2k+1n = 2k+1 for some integer kk . Then n+1=2k+1+1=2(k+1)n+1 = 2k+1+1 = 2(k+1) is of the form 2l2l for some integer ll , and so n+1n+1 is even.

We will also use the fact that every integer is either even or odd but not both. The following theorem is proved using a direct proof.


Example 1.18.Link copied Prove the theorem: If nn is an even integer, then n2n^2 is an even integer.

Example 1.19.Link copied Is the following argument correct? It supposedly shows that nn is an even integer whenever n2n^{2} is an even integer.

Suppose that n2n^{2} is even. Then n2=2kn^{2} = 2k for some integer k. Let n=2ln=2l for some integer ll . This shows that nn is even.


Example 1.20.Link copied Prove the theorem: If xx is a real number and x21=0x^2 - 1 = 0 , then x=1x = -1 or x=1x = 1 .

Law of syllogism

Link copied

Many proofs use the law of syllogism, which states

[(pq)(qr)](pr)[(p\rightarrow q)\wedge (q\rightarrow r)]\Rightarrow (p \rightarrow r)
Example 1.21.Link copied Suppose that xx is some fixed real number, and let pp , qq , rr and ss be the propositions
p:x21=0p: x^2 - 1 = 0
r:(x+1)(x1)=0r: (x + 1)(x - 1) = 0
s:x+1=0  or  x1=0s: x+1 = 0 ~~or~~ x-1 = 0
q:x=1  or  x=1q: x=-1 ~~or~~ x=1

Write out the logical expression established in the previous example. Hence, by two applications of the law of syllogism we conclude that pqp \Rightarrow q , that is, the theorem is proved.


Proofs by contraposition and contradiction

The law of contraposition

Link copied

The contrapositive law states that the propositions pqp\rightarrow q and ¬q¬p\neg q \rightarrow\neg p are logically equivalent.

To prove a theorem pqp \rightarrow q by this method, we give a direct proof of the proposition ¬q¬p\neg q \rightarrow \neg p by assuming ¬q\neg q and proving ¬p\neg p . The contrapositive law allows us to conclude that pqp \rightarrow q .


Example 1.22.Link copied Find the contrapositive of the statement:

If I have studied hard enough, I will find the exam easy.

Solution. If I find the exam difficult, then I didn’t study hard enough.


Example 1.23.Link copied Prove the following theorem using the law of contrapositive: If x+y>100x + y> 100 , then x>50x> 50 or y>50y >50 .

Example 1.24.Link copied Prove the following theorem using the law of contrapositive: If nn is an integer and n2n^2 is even, then nn is even.

Proof by contradictio_n

Link copied

A very different style of proof is proof by contradiction.

To prove the theorem pqp \rightarrow q : Assume pp and ¬q\neg q are true and deduce a false statement rr . Since (p¬q)r(p \wedge \neg q) \rightarrow r is true but rr is false, we can conclude that the premise p¬qp \wedge \neg q of this conditional statement is false. But then its negation ¬(p¬q)\neg (p \wedge \neg q) is true, which is logically equivalent to the desired statement pqp \rightarrow q .

Example 1.25.Link copied Show that ¬(p¬q)\neg (p \wedge \neg q) is logically equivalent to pqp \rightarrow q .

Example 1.26.Link copied Prove by contradiction: If a,bZa, b \in \Z are such that aa is odd and a+ba+b is even then bb is odd.

Solution. Assume, for a contradiction, that aa is odd, a+ba+b is even and bb is even. So a=2k+1a = 2k+1 and b=2lb = 2l for some integers k,lk, l . But then a+b=2k+1+2l=2(k+l)+1a+b = 2k+1 + 2l = 2(k+l) + 1 . Since k+lZk+l \in \Z it follows that a+ba+b is odd, but this contradicts the fact that a+ba+b is even. Hence bb cannot have been even and so bb must be odd.


Example 1.27.Link copied Prove by contradiction: If a,bZa, b \in \Z then a24b2a^2 - 4b \ne 2 .

Proving this theorem by contradiction seems natural because the theorem expresses a negative idea (that a24ba^2 - 4b is not equal to 22 ). Thus, when we negate the conclusion, we obtain the positive statement that a24b=2a^2 - 4b = 2 .


Example 1.28.Link copied Prove by contradiction that there is no rational number rr such that r2=2r^2=2 .

Recall that a rational number is one that can be written as the quotient of two integers. Note also that the theorem to be proved can be written as the conditional statement: If rr is a rational number, then r22r^2 \not = 2 . Again proving this theorem by contradiction seems natural because the theorem expresses a negative idea (that r2r^2 is not equal to 2). Thus, when we negate the conclusion, we obtain the positive statement that there is a rational number rr such that r2=2r^2 = 2 .

Example 1.29.Link copied Prove by contradiction: If a,bRa, b \in \R are such that aQa \in \mathbb{Q} and a+b∉Qa+b \not\in \mathbb{Q} then b∉Qb \not\in \mathbb{Q} .
Example 1.30.Link copied Prove by contradiction: If nn is the sum of the squares of two odd integers, then nn is not a perfect square.
Example 1.31.Link copied Prove by contradiction that there are infinitely many prime numbers.

Solution. (This proof is due to the great Euclid, who lived around 300 BC in ancient Greece.)

Assume, for a contradiction, that there are finitely many primes. Write them as {p1,p2,...pn}\{p_{1}, p_{2},...p_{n}\} for some natural number nn . Consider the number q=p1p2...pn+1q=p_{1} p_{2}...p_{n}+1 . By its construction, qq is not divisible by any of the primes p1,p2,...pnp_{1}, p_{2},...p_{n} . Hence, qq must itself be prime or it must be divisible by another prime that is not in the set {p1,p2,...pn}\{p_{1}, p_{2},...p_{n}\} . In either case, we find a prime that is not in our original set. Hence we achieve our contradiction.

If and only if statements

Link copied

To prove: AA if and only if BB then we need to prove ABA \rightarrow B and BAB \rightarrow A . Sometimes “if and only if” is abbreviated as “iff”.

Example 1.32.Link copied Prove that nn is even if and only if n2n^2 is even.

Counterexamples and proof by cases

Proof by cases

Link copied

There are other types of proofs as well. One method of proof that is quite important in discrete mathematics is proof by mathematical induction, which is discussed later in the course. Another type of proof is a proof by cases, in which the theorem to be proved is subdivided into parts, each of which is proved separately. The next example demonstrates this technique.


Example 1.33.Link copied Show that if nn is an integer then n3nn^3 - n is even. (Since every integer nn is either even or odd, consider these two cases.)

Example 1.34.Link copied Let x,yRx, y \in \R . Prove that xy=xy| xy | = |x| \cdot |y| .

Counterexamples

Link copied

To close this section, we will briefly consider the problem of disproving a proposition pqp \rightarrow q , that is, of showing that it is false. A conditional statement is false only when its premise is true and its conclusion is false, we must find an instance in which pp is true and qq is false. Such an instance is called a counter-example to the statement.

Example 1.35.Link copied For example, consider the statement: If an integer nn is the sum of the squares of two even integers, then nn is not a perfect square. To disprove this statement, find a counterexample.

Proof by construction

This method is a much more ‘positive’ method than proof by contradiction. It is a method for proving the existence of certain objects, by actually finding one.

Example 1.36.Link copied Prove that for every positive integer kk there exists a positive integer nn greater than kk such that the remainder of nn when divided by 55 is 11 .

We can prove it by constructing such a positive integer nn . Simply take n=5k+1n = 5k+1 . This is greater than kk , and when we divide nn by 55 we get remainder 11 .


Language in proofs

Human understanding and communication rely on language. The purpose of a proof is to communicate the truth of a statement through language. Remember that a proof is supposed to convince a sceptical reader that a statement is true. The right way to read a proof is to not believe it, but to challenge the proof and argue with it, and to try to break it. The right way to write a proof is to make the argument so clear and natural that no-one can doubt that the statement is true. To write a beautiful and convincing proof you should give the reader clues to what is going on both locally and in the proof as a whole. In the previous sections we looked at the proof structure as a whole; now we look at the usage of ordinary English, which mostly gives the local information about the proof.

Rules of thumb for proofs

Link copied
  1. Tell the reader from the start what the general approach of the proof will be.

  2. Introduce names for objects before you use them. Ensure that every technical word has a precise meaning that has been defined earlier (or is standard terminology in the subject).

  3. Use words like “hence”, “therefore”, “thus”, “so”, “then”, “note,” “recall” etc as signposts.

A proof that is well laid-out and signposted is much easier to read.

We now outline some starting statements and end cues that you might use in some common proof formats.

Direct proof

Link copied

To Prove: Implication pqp\rightarrow q . If pp true then qq true.

Method: Assume pp true and deduce qq true.

Start Cues: “We prove directly … ”, “Let pp be as in the statement”.

End Cues:qq , as required.” “Q.E.D.”, \Box , ”… as was to be shown”/ Restatement of the result.

The logical structure of direct proof is the most simpleminded and most common: assume the hypothesis or hypotheses and deduce the conclusion. Direct proof is frequently cued in the first sentence.

The “Q.E.D.” abbreviating the Latin “Quod Erat Demonstrandum” that you may have seen or written ought to be a reliable cue to the end of a direct proof.

Proof by contraposition

Link copied

To Prove: Implication pqp\rightarrow q . If pp (true) then qq (true).

Method: Prove "¬q¬p\neg q \rightarrow \neg p ". Assume not qq , deduce not pp .

Start Cues: “We prove the contrapositive”, “We show not qq implies not pp ”, “We procede indirectly”, “Assume not qq …”

End Cues: “So, by contraposition”, Restatement of the original 'pqp \rightarrow q '

The thing to remember is that once you start down this path assuming ¬q\neg q and deducing ¬p\neg p , the proof is really a direct one, although something different than what you started with.

Proof by contradiction

Link copied

To Prove: Implication pqp\rightarrow q . If pp then qq .

Method: Assume pp AND not qq , deduce a contradiction

Start Cues: “We prove by contradiction”, “Assume, for a contradiction”, “Suppose (not qq )“

End Cues: “Which is a contradiction. Hence qq must be true, which completes the proof.”

Proof by cases

Link copied

To Prove: (pq)r(p\lor q) \rightarrow r

Method: Prove prp\rightarrow r , then prove qrq\rightarrow r

Start Cues: “We prove by cases …”

Case start: “Case 1 (2,…)”, “In the first case”

Case end: ”… finishes Case 1”, “So we are done in the first case”

End Cues: “So in either case …”


Predicates and quantifiers

A predicate is a function on some domain DD such that P(x)P(x) is a proposition/statement for each value xDx \in D .

For example, for D=ND = \N , P(n)P(n) could be any of

  1. nn is even.
  2. nn is prime
  3. n=3n = 3
  4. n>512n > 512
  5. 1+2++n=n(n+1)/21 + 2 + \cdots + n = n(n+1)/2

These are not predicates P(n)P(n) :

  1. n=xn = x
  2. 1+2++n=n(n+1)/21 + 2 + \cdots + n = n(n+1)/2 \ for all \ nn

A statement like p(n)p(n) that includes the variable nn is not a proposition, since it cannot be said to be true or false until we know what nn is. There are two ways we can turn it into a proposition. The first is to substitute in some particular value of nn , to get propositions like p(4)p(4) and p(17)p(17) . The other way is to quantify the predicate. To do this we use one of the two quantifiers \forall and \exists . The first of these, \forall , is called the universal quantifier. It means “For all _”, or “For every _“. So, for example, the statement np(n)\forall n\,p(n) means “For every nn , nn is even”. The second quantifier, \exists , is called the existential quantifier. It means “For some _”, or “There exists _ such that”. For example, np(n)\exists n\,p(n) means “There is some nn such that nn is even”. So in this case np(n)\forall n\,p(n) is false, whereas np(n)\exists n\,p(n) is true. Sometimes we make the domain of definition more explicit: for example, we could have written these examples as nN(p(n))\forall n\in\N\,(p(n)) and ” />nN(p(n))/>\exists n\in\N\,(p(n)) .

If we quantify a predicate pp to get a proposition, the truth value of a resulting proposition depends on the truth values of the various propositions p(d)p(d) for the elements dd of the domain of definition. To be precise, xp(x)\forall x\,p(x) is true if p(d)p(d) is true for every element dd of the domain of definition of pp . On the other hand, xp(x)\exists x\,p(x) is true if p(d)p(d) is true for at least one element dd of the domain of definition.


Example 1.37.Link copied Let P(n)P(n) be the predicate with domain N\N such that P(n)P(n) is true if and only if nn is even. So P(1)P(1) is false and P(2)P(2) is true.

Then nN,P(n)\forall n \in \N, P(n) is false and nN,P(n)\exists n \in \N, P(n) is true.


Example 1.38.Link copied Let P(n)P(n) be the predicate with domain Z\Z such that P(n)P(n) is true if and only if n2nn^2 \ge n .

What are P(1)P(1) and P(2)P(2) ?

Is nZ,P(n)\forall n \in \Z, P(n) true or false?

Is nZ,P(n)\exists n \in \Z, P(n) true or false?

What happens if we change P(n)P(n) to be the predicate n2>n n^2 > n ?


Example 1.39.Link copied Consider the following statements (this example is due to Lewis Carroll, and is discussed in Rosen’s book). The first two are called_ premises and the third is called the conclusion. The entire set is called an argument.

”All lions are fierce"

"Some lions do not drink coffee."

"Some fierce creatures do not drink coffee.”

Let P(x)P(x) , Q(x)Q(x) , and R(x)R(x) be the statements ”xx is a lion,” ”xx is fierce,” and ”xx drinks coffee,” respectively. Assuming that the universe of discourse is the set of all creatures, express the statements in the argument using quantifiers and P(x)P(x) , Q(x)Q(x) , and R(x)R(x) .


Example 1.40.Link copied Consider the following argument:

All humans make mistakes.

I do not make mistakes.

Therefore, I am not a human.

Express this argument using quantifiers.


Solution. Let p(x)p(x) be the statement “x is human”.

Let q(x)q(x) be the statement “x makes mistakes”.

The statement “All humans make mistakes” is x,p(x)q(x)\forall x, p(x) \rightarrow q(x) .

Let the constant symbol aa stand for the individual “I”.

Then the argument becomes:(x(p(x)q(x)))¬q(a)¬p(a)\left( \forall x(p(x)\to q(x))\right) \land \lnot q(a) \rightarrow \lnot p(a)

Free and bound variables

Link copied

We refer to the variable nn in a predicate p(n)p(n) as a free variable. This is because we are free to substitute any particular value of nn to get a proposition. In contrast, the variables nn in np(n)\forall n\,p(n) or in np(n)\exists n\,p(n) are called bound variables. They are bound by the quantifiers, so we cannot substitute particular values in.

Predicates with more than one variable

Link copied

We allow predicates to have two or more variables. For example, we may use p(x,y)p(x,y) to denote the predicate ”xx is greater than yy ”, ("x>yx>y ") with domain of definition the set R×R<L\mathbb R\times\mathbb R<L . Then xx and />y/>y are both free variables in p(x,y)p(x,y) . We can quantify either one of the variables, or we can quantify both of them. For example, yp(x,y)\forall y\,p(x,y) is a predicate that has only one free variable, namely xx . In this case, it means ”xx is greater than every real number”. Of course, this is false for every real number xx (since p(x,x+1)p(x,x+1) is false), so xyp(x,y)\exists x\forall y\,p(x,y) is a false proposition. On the other hand, consider the predicate xp(x,y)\exists x\,p(x,y) , which has yy as its only free variable. This means “Some real number is greater than yy “. This is true for every yy , since for example p(y+1,y)p(y+1,y) holds. So the proposition yxp(x,y)\forall y\exists x\,p(x,y) is true. This example shows that we have to be careful about the order of the quantifiers: xyp(x,y)\exists x\forall y\,p(x,y) and yxp(x,y)\forall y\exists x\,p(x,y) do not have the same truth value.

If the predicate has more than one variable, it is not necessary for the domains of definition for the different variables to be the same. For example, if PP denotes the set of all people, then we can use p(x,y)p(x,y) to denote the relation “person xx is more than yy years old”, with domain of definition P×N<LP\times\mathbb N<L . Of course, if we intend to use both ” p(x,y)p(x,y) and p(y,x)p(y,x) then the domains should be the same.


Example 1.41.Link copied Suppose we define the predicates p(x,y)p(x,y) for ”xx knows yy ”, q(x,y)q(x,y) for ”xx likes yy ”, r(x)r(x) for ”xx is rich” and s(x)s(x) for ”xx is famous”, and the constant symbol aa for Andrew. Here are some examples of statements we can translate into predicate logic.

Notice that we actually translate “Some famous people are not rich” as “At least one famous person is not rich”.


Example 1.42.Link copied Let Q(x,y,z)Q(x, y, z) be the statement ” x+y=zx+y=z “. What are the truth values of the statements_
xyzQ(x,y,z)andzxyQ(x,y,z)?\forall x \forall y \exists z Q(x,y,z) \quad and \quad \exists z \forall x \forall y Q(x,y,z)?
Example 1.43.Link copied Use quantifiers to express the statement “There is a woman who has taken a flight on every airline in the world.”

Tautologies and implications in predicate logic

A proposition in predicate logic that is always true, no matter what the domains of definition and meaning of the predicates it contains (so long as the domains of definition are non-empty) is said to be a tautology.

Example 1.44.Link copied
  1. xy(p(x,y)p(y,x))\forall x\forall y\,(p(x,y)\to p(y,x)) is not a tautology
  2. xy(p(x,y)p(y,x))\exists x\exists y\,(p(x,y)\to p(y,x)) is a tautology.
  3. xyp(x,y)yxp(x,y)\exists x\forall y\,p(x,y)\to\forall y\exists x\,p(x,y) is a tautology.
  4. yxp(x,y)xyp(x,y)\forall y\exists x\,p(x,y)\to\exists x\forall y\,p(x,y) is not a tautology.

Proof

  1. To show that a proposition is not a tautology, we need to find some domain of definition and some meaning for the predicate in which the proposition is false. In this case we can take the domain to be R\mathbb R and p(x,y)p(x,y) to be "x>yx>y ". Then p(1,0)p(1,0) is true and p(0,1)p(0,1) is false, so p(1,0)p(0,1)p(1,0)\to p(0,1) is false. Thus there is some yy such that p(1,y)p(y,1)p(1,y)\to p(y,1) is false, so y(p(1,y)p(y,1))\forall y\,(p(1,y)\to p(y,1)) is false. Therefore there is some xx for which y(p(x,y)p(y,x))\forall y\,(p(x,y)\to p(y,x)) is false, so xy(p(x,y)p(y,x))\forall x\forall y\,(p(x,y)\to p(y,x)) is false. Thus xy(p(x,y)p(y,x))\forall x\forall y\,(p(x,y)\to p(y,x)) is not a tautology.

  2. To show that a proposition is a tautology, we need to show it is true in any non-empty domain of definition and any meaning of the predicate. So let DD be a non-empty set, and let p(x,y)p(x,y) be a predicate with domain of definition D×DD\times D . Then, since DD is non-empty, we can find some dDd\in D . Now p(d,d)p(d,d) is either true or it is false: either way, p(d,d)p(d,d)p(d,d)\to p(d,d) is true. Therefore there is some yDy\in D such that p(d,y)p(y,d)p(d,y)\to p(y,d) is true, so y(p(d,y)p(y,d))\exists y\,(p(d,y)\to p(y,d)) is true. Thus there is some xDx\in D such that y(p(x,y)p(y,x))\exists y\,(p(x,y)\to p(y,x)) is true, so xy(p(x,y)p(y,x))\exists x\exists y\,(p(x,y)\to p(y,x)) is true. Since this is true for any domain DD and any predicate pp , xy(p(x,y)p(y,x))\exists x\exists y\,(p(x,y)\to p(y,x)) is a tautology.

  3. Exercise

  4. Exercise

Some implications

Link copied

Recall that we say propositions AA and BB be propositions in predicate logic. We say that AA and BB are logically equivalent (written ABA\Leftrightarrow B ) if A    BA\iff B is a tautology, in other words if AA and BB must have the same truth value. We say that AA logically implies BB (written ABA\Rightarrow B ) if ABA\to B is a tautology, in other words, if AA is true then BB must be true.

Example 1.45.Link copied
  1. xyp(x,y)yxp(x,y)\forall x\forall y\,p(x,y)\Leftrightarrow\forall y\forall x\,p(x,y) .
  2. xyp(x,y)yxp(x,y)\exists x\exists y\,p(x,y)\Leftrightarrow\exists y\exists x\,p(x,y) .

Proof

  1. Let DD and EE be non-empty sets, and let pp be a predicate with domain of definition D×ED\times E . Then xyp(x,y)\forall x\forall y\,p(x,y) is true if and only if p(x,y)p(x,y) is true for every (x,y)D×E(x,y)\in D\times E , and the same holds for yxp(x,y)\forall y\forall x\,p(x,y) . So xyp(x,y)\forall x\forall y\,p(x,y) and yxp(x,y)\forall y\forall x\,p(x,y) always have the same truth value.

  2. Exercise.

Negating quantifiers

Link copied
  1. ¬(n,p(n))n,(¬p(n))\lnot ( \forall n, p(n) ) \quad \Leftrightarrow \quad \exists n, ( \lnot p(n))
  2. ¬(n,p(n))n,(¬p(n))\lnot ( \exists n, p(n) ) \quad \Leftrightarrow \quad \forall n, ( \lnot p(n))

Proof

  1. Let DD be a non-empty set and let pp be a predicate with domain of definition DD . Suppose ¬xp(x)\lnot\forall x\,p(x) is true. Then xp(x)\forall x\,p(x) is false, in other words it is not the case that p(x)p(x) is true for every xDx\in D . So there must be some xDx\in D for which p(x)p(x) is false. Then ¬p(x)\lnot p(x) is true, so x¬p(x)\exists x\,\lnot p(x) is true.
    On the other hand, if ¬xp(x)\lnot\forall x\,p(x) is false, then xp(x)\forall x\,p(x) is true, so p(x)p(x) is true for every xDx\in D . Thus ¬p(x)\lnot p(x) is false for every xDx\in D , in other words there is no xDx\in D for which ¬p(x)\lnot p(x) is true, so x¬p(x)\exists x\,\lnot p(x) is false.

  2. Exercise.

Example 1.46.Link copied Re-write these propositions without using any negation symbols.
  1. ¬xZ,yZ,xy=1\lnot \forall x \in \Z, \exists y \in \Z , xy = 1 .
  2. ¬xR,yQ,xy>1\lnot \exists x \in \R, \exists y \in \mathbb{Q} , xy > 1 .

Solution.

  1. xZ,yZ,xy1\exists x \in \Z, \forall y \in \Z , xy \ne 1 .
  2. xR,yQ,xy1\forall x \in \R, \forall y \in \mathbb{Q} , xy \le 1 .