Logic and Proofs
Introduction to logic
A proposition is a statement which is either true or false. For example:
- “The sun is a star."
- "The moon is made of cheese."
- " ."
- " ."
- "Every even integer greater than 4 is the sum of two prime numbers."
- " or ."
- "If the world is flat then .”
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 " ", " ", “The world is flat”, and " ". 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.
- ” "
- " for some integer "
- "Shake well before opening"
- "CompSci 225 is the largest course at the University of Auckland”
Notation
Link copiedWe typically use letters like , and to stand for simple propositions: we call these propositional variables. We usually use capital letters like , and to denote compound propositions, or propositions which might be simple or might be compound.
Connectives
Link copiedWhen we want to build more complicated propositions out of simpler ones, we use connectives. If and are propositions, then so are the following:
We read these as “not ”, ” and ”, ” or ”, ” implies ” (or “if then ”) and ” is equivalent to ” (or ” if and only if ”) respectively. We can combine compound propositions into more and more complicated propositions. For example, if denotes the proposition “It is raining”, denotes the proposition “The sun is shining” and denotes the proposition “There is a rainbow”, then represents the proposition “If it is raining and the sun is shining, then there is a rainbow”, while represents the proposition “If it is raining and there is no rainbow, then the sun is not shining”.
”If you drink and drive, you’re a bloody idiot.”
Solution. Let denote the proposition “You drink”.\ Let denote the proposition “You drive”.\ Let denote the proposition “You’re a bloody idiot”\ Then the slogan can be expressed as\
”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”.
Truth
Link copiedThe truth value of a compound proposition depends on the truth values of the propositions it was built from, according to the following rules:
- is false if is true, and it is true if is false.
- is true if both and are true: otherwise it is false.
- is true if either or is true, or if both are true (so represents “inclusive or”).
- is true unless is true and is false. [This rule may seem odd---why is true? This rule is a standard convention in logic. To help make sense of it, consider the statement “For any real number , if then “. Try substituting the values and into “if then ”.]
- is true if and have the same truth value, and false otherwise.
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 .
Truth tables
Link copiedUsing these rules, we can build up the truth table for any compound proposition.
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.
p : Blaise Pascal invented several calculating machines,
q : The first all-electronic digital computer was constructed in the twentieth century,
r : 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 was calculated to 1,000,000 decimal digits in 1954.
Other connectives
Link copiedWe can define some other useful binary connectives besides the ones we have already mentioned. The most useful ones are , NAND and NOR, which denote “exclusive or”, “not-and” and “not-or”. Thus is true if and only if either is true or is true, but not both. Also NAND is true if and only if is false, and NOR is true if and only if is false.
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 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.
- is a tautology.
- is a tautology.
- is a contradiction.
- is a contradiction.
- is contingent.
- is contingent.
Logical equivalence and logical implication
Two propositions and are logically equivalent, written , if, whenever we assign truth values to the propositional variables they contain, and have the same truth value. Thus holds if and only if is a tautology. To decide whether or not two propositions are logically equivalent, we can use truth tables. For example, to show that , we build up the following truth table:
Notice that columns 3 and 5 are identical.
Alternatively, we can try to convert one to the other using the following standard logical equivalences:
For example, we can show that as follows:
- .
Logical implication
Link copiedLet and be propositions. We say that logically implies , written , if, whenever we assign truth values to the propositional variables they contain, if is true then is also true. Thus if and only if is a tautology, and if and only if and . That is, if and only if is a tautology.
To clarify, the symbol is a logical operation (defined using a truth table) while the symbol 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 copiedAn 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.
- An integer is even if it is something like 2 or 4.
- An integer is even if there exists an integer such that .
- An integer is even if there exists an integer such that .
- An integer is even if .
- An integer is even if .
Theorems
Link copiedA 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:
- ’ is a ’ (i.e., the object satisfies the definition ).
- ‘if then ’ (i.e., if is an object that satisfies definition then it also satisfies definition ).
- ‘there is an that satisfies ’ (i.e., a definition is not vacuous).
Hypothesis and conclusion
Link copiedWhen the theorem is expressed as a conditional statement then is called the hypothesis and is called the conclusion of the theorem.
Proofs
Link copiedMathematics 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 copiedBy 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 . Since is true whenever is false, we need only show that whenever is true, so is .
Therefore:
in a direct proof we assume that the hypothesis of the theorem, , is true and demonstrate that the conclusion, is true.
It then follows that is always true.
Examples with integers
Link copiedWe 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.
- An integer is called even if it can be written in the form for some integer .
- An integer is called odd if it can be written in the form for some integer .
Proof: Let for some integer . Then is of the form for some integer , and so 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.
Suppose that is even. Then for some integer k. Let for some integer . This shows that is even.
Law of syllogism
Link copiedMany proofs use the law of syllogism, which states
Write out the logical expression established in the previous example. Hence, by two applications of the law of syllogism we conclude that , that is, the theorem is proved.
Proofs by contraposition and contradiction
The law of contraposition
Link copiedThe contrapositive law states that the propositions and are logically equivalent.
To prove a theorem by this method, we give a direct proof of the proposition by assuming and proving . The contrapositive law allows us to conclude that .
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.
Proof by contradictio_n
Link copiedA very different style of proof is proof by contradiction.
To prove the theorem : Assume and are true and deduce a false statement . Since is true but is false, we can conclude that the premise of this conditional statement is false. But then its negation is true, which is logically equivalent to the desired statement .
Solution. Assume, for a contradiction, that is odd, is even and is even. So and for some integers . But then . Since it follows that is odd, but this contradicts the fact that is even. Hence cannot have been even and so must be odd.
Proving this theorem by contradiction seems natural because the theorem expresses a negative idea (that is not equal to ). Thus, when we negate the conclusion, we obtain the positive statement that .
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 is a rational number, then . Again proving this theorem by contradiction seems natural because the theorem expresses a negative idea (that is not equal to 2). Thus, when we negate the conclusion, we obtain the positive statement that there is a rational number such that .
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 for some natural number . Consider the number . By its construction, is not divisible by any of the primes . Hence, must itself be prime or it must be divisible by another prime that is not in the set . 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 copiedTo prove: if and only if then we need to prove and . Sometimes “if and only if” is abbreviated as “iff”.
Counterexamples and proof by cases
Proof by cases
Link copiedThere 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.
Counterexamples
Link copiedTo close this section, we will briefly consider the problem of disproving a proposition , 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 is true and is false. Such an instance is called a counter-example to the statement.
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.
We can prove it by constructing such a positive integer . Simply take . This is greater than , and when we divide by we get remainder .
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-
Tell the reader from the start what the general approach of the proof will be.
-
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).
-
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 copiedTo Prove: Implication . If true then true.
Method: Assume true and deduce true.
Start Cues: “We prove directly … ”, “Let be as in the statement”.
End Cues: ” , as required.” “Q.E.D.”, , ”… 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 copiedTo Prove: Implication . If (true) then (true).
Method: Prove " ". Assume not , deduce not .
Start Cues: “We prove the contrapositive”, “We show not implies not ”, “We procede indirectly”, “Assume not …”
End Cues: “So, by contraposition”, Restatement of the original ' '
The thing to remember is that once you start down this path assuming and deducing , the proof is really a direct one, although something different than what you started with.
Proof by contradiction
Link copiedTo Prove: Implication . If then .
Method: Assume AND not , deduce a contradiction
Start Cues: “We prove by contradiction”, “Assume, for a contradiction”, “Suppose (not )“
End Cues: “Which is a contradiction. Hence must be true, which completes the proof.”
Proof by cases
Link copiedTo Prove:
Method: Prove , then prove
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 such that is a proposition/statement for each value .
For example, for , could be any of
- is even.
- is prime
These are not predicates :
- \ for all \
A statement like that includes the variable is not a proposition, since it cannot be said to be true or false until we know what is. There are two ways we can turn it into a proposition. The first is to substitute in some particular value of , to get propositions like and . The other way is to quantify the predicate. To do this we use one of the two quantifiers and . The first of these, , is called the universal quantifier. It means “For all _”, or “For every _“. So, for example, the statement means “For every , is even”. The second quantifier, , is called the existential quantifier. It means “For some _”, or “There exists _ such that”. For example, means “There is some such that is even”. So in this case is false, whereas is true. Sometimes we make the domain of definition more explicit: for example, we could have written these examples as and ” .
If we quantify a predicate to get a proposition, the truth value of a resulting proposition depends on the truth values of the various propositions for the elements of the domain of definition. To be precise, is true if is true for every element of the domain of definition of . On the other hand, is true if is true for at least one element of the domain of definition.
Then is false and is true.
What are and ?
Is true or false?
Is true or false?
What happens if we change to be the predicate ?
”All lions are fierce"
"Some lions do not drink coffee."
"Some fierce creatures do not drink coffee.”
Let , , and be the statements ” is a lion,” ” is fierce,” and ” drinks coffee,” respectively. Assuming that the universe of discourse is the set of all creatures, express the statements in the argument using quantifiers and , , and .
All humans make mistakes.
I do not make mistakes.
Therefore, I am not a human.
Express this argument using quantifiers.
Solution. Let be the statement “x is human”.
Let be the statement “x makes mistakes”.
The statement “All humans make mistakes” is .
Let the constant symbol stand for the individual “I”.
Then the argument becomes:
Free and bound variables
Link copiedWe refer to the variable in a predicate as a free variable. This is because we are free to substitute any particular value of to get a proposition. In contrast, the variables in or in are called bound variables. They are bound by the quantifiers, so we cannot substitute particular values in.
Predicates with more than one variable
Link copiedWe allow predicates to have two or more variables. For example, we may use to denote the predicate ” is greater than ”, (" ") with domain of definition the set . Then and are both free variables in . We can quantify either one of the variables, or we can quantify both of them. For example, is a predicate that has only one free variable, namely . In this case, it means ” is greater than every real number”. Of course, this is false for every real number (since is false), so is a false proposition. On the other hand, consider the predicate , which has as its only free variable. This means “Some real number is greater than “. This is true for every , since for example holds. So the proposition is true. This example shows that we have to be careful about the order of the quantifiers: and 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 denotes the set of all people, then we can use to denote the relation “person is more than years old”, with domain of definition . Of course, if we intend to use both ” and then the domains should be the same.
- Everybody knows Andrew: .
- Everybody who knows Andrew likes him: .
- Nobody likes a person who is famous but not rich: .
- Some famous people are not rich: .
- Not every rich person is famous: either or .
- Everybody likes anybody who is rich: or .
- Andrew likes everybody who is not rich: .
- Everybody likes somebody: .
Notice that we actually translate “Some famous people are not rich” as “At least one famous person is not rich”.
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.
- is not a tautology
- is a tautology.
- is a tautology.
- is not a tautology.
Proof
-
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 and to be " ". Then is true and is false, so is false. Thus there is some such that is false, so is false. Therefore there is some for which is false, so is false. Thus is not a tautology.
-
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 be a non-empty set, and let be a predicate with domain of definition . Then, since is non-empty, we can find some . Now is either true or it is false: either way, is true. Therefore there is some such that is true, so is true. Thus there is some such that is true, so is true. Since this is true for any domain and any predicate , is a tautology.
-
Exercise
-
Exercise
Some implications
Link copiedRecall that we say propositions and be propositions in predicate logic. We say that and are logically equivalent (written ) if is a tautology, in other words if and must have the same truth value. We say that logically implies (written ) if is a tautology, in other words, if is true then must be true.
- .
- .
Proof
-
Let and be non-empty sets, and let be a predicate with domain of definition . Then is true if and only if is true for every , and the same holds for . So and always have the same truth value.
-
Exercise.
Negating quantifiers
Link copiedProof
-
Let be a non-empty set and let be a predicate with domain of definition . Suppose is true. Then is false, in other words it is not the case that is true for every . So there must be some for which is false. Then is true, so is true.
On the other hand, if is false, then is true, so is true for every . Thus is false for every , in other words there is no for which is true, so is false. -
Exercise.
- .
- .
Solution.
- .
- .