Mathematical Proof and the Principles of Mathematics/Logic/Logical connectives

In the previous section we made clear what mathematical statement is. In this section we talk about how mathematical statements can be combined to make more complex statements. This is done using what are called 'logical connectives' or 'logical operators'. You can think of these as functions of one or more variables, where the variables can be either True or False and the value of the function can be either True or False. The logical connectives commonly used in mathematics are negation, conjunction, disjunction, implication, and equivalence, which are fancy words for things you encounter in everyday English.

In this section the symbols $$P$$ and $$Q$$ denote mathematical statements.

Negation
The negation of a statement $$P$$ is the statement that $$P$$ is not true. Some ways to phrase this are
 * Not $$P$$.
 * It is false that $$P$$.

Examples:

Negation inverts the truth or falsehood of logical statements. In other words, not $$P$$ is False when $$P$$ is True, and Not $$P$$ is True when $$P$$ is False. In tabular form:

The logical symbol for negation is "$$\lnot$$", so you can write $$\lnot P$$ for Not $$P$$.

Even though "Not" is the simplest logical operator, the negation of statements is important when trying to prove that certain objects have or do not have certain properties. It makes the skill of being able to correctly negate statements an important one.

Conjunction
The conjunction of two statements $$P$$ and $$Q$$ is the statement that $$P$$ and $$Q$$ are both True. Some ways to phrase this are
 * $$P$$ and $$Q$$.
 * $$P$$ but $$Q$$.
 * $$P$$ however $$Q$$.

Note that phrasing in English can sometimes include meaning that is not captured by the word 'and'. For example the statement
 * We had a good time even though it rained.

captures the idea that the fact that it rained would lead you to expect that it would be difficult to have a good time. Logically though, the statement is equivalent to
 * We had a good time and it rained.

since both combine the statements
 * We had a good time.

and
 * It rained.

Examples:

Conjunction combines the assertions of two statements into a single statement. It's difficult to be more specific without being circular, but you might say $$P$$ and $$Q$$ is True when both $$P$$ and $$Q$$ are True, and False when either $$P$$ or $$Q$$ are False. In tabular form:

The logical symbol for conjunction is "$$\land$$", so you can write $$P \land Q$$ for $$P$$ and $$Q$$.

Disjunction
The disjunction of two statements $$P$$ and $$Q$$ is the statement that at least one of $$P$$ and $$Q$$ are True. Some ways to phrase this are
 * $$P$$ or $$Q$$.
 * $$P$$ unless $$Q$$.

In mathematics the exclusive or is never used, so
 * $$P$$ or $$Q$$.

always means
 * $$P$$ or $$Q$$ or both.

This contrasts with English where the exclusive or is often implied by context, as in
 * You can choose either the Big Box or whatever is behind Curtain #2.

In the rare cases where exclusive or is needed in mathematics, the phrase "but not both" can be added to make it clear.

Examples:

Disjunction offers two possibilities which are given by the two statements. Again, it's difficult to be more specific without being circular, but you might say $$P$$ or $$Q$$ is True when either $$P$$ or $$Q$$ (or both) are True, and False when both $$P$$ and $$Q$$ are False. In tabular form:

The logical symbol for disjunction is "$$\lor$$", so you can write $$P \lor Q$$ for $$P$$ and $$Q$$.

Implication
Implication is perhaps the most important, but also the most confusing of the logical connectives. In fact it even has a paradox named after it.

The implication of two statements $$P$$ and $$Q$$ is the statement is that $$Q$$ is True whenever $$P$$ is True. Some ways to phrase this are
 * $$P$$ implies $$Q$$.
 * If $$P$$ then $$Q$$.
 * $$P$$ only if $$Q$$.
 * $$Q$$ if $$P$$.
 * $$Q$$ is a necessary condition for $$P$$.
 * $$P$$ is a sufficient condition for $$Q$$.

When we use the phrase "If ... then ..." in English it usually means there is some sort of causality going on. For example the statement
 * If it rains the traffic will be terrible.

somehow contains the idea that the rain will cause the traffic to be terrible. But in terms of logic there doesn't have to be any such connection between the two statement. This is where the paradox, one of the 'paradoxes of material implication', comes in. Namely, if $$P$$ is a false statement, then the implication $$P$$ implies $$Q$$ is true, even if there is no connection between $$P$$ and $$Q$$. For example
 * If 0=1 then the moon is made of cheese.

is logically true even though whether the moon is made of cheese has nothing to do with whether 0 is equal to 1.

This state of affairs may seem rather strange, which is why it's called a paradox. So perhaps it would help to ask when you can say that the statement $$P$$ implies $$Q$$ is False rather than when you can say it's True. Imagine your dentist says to you
 * If you eat a lot of sugar then you'll get more cavities.

This is an implication between the two statements
 * You eat a lot of sugar.

and
 * You'll get more cavities.

Now suppose you want to prove your dentist wrong and say "Ha! You don't know what you're talking about. I shall seek dental care elsewhere." If you stay away from sugar and don't get cavities then your dentist will be right. If you stay away from sugar but get cavities anyway then your dentist can ask "Did you brush after eating?" and you'll say "No," and your dentist will say "There you go!" and will still be right. The only way you can prove your dentist wrong is to eat a lot of sugar but not get cavities.

This fact is actually useful in some situations and since it's logically valid there's nothing wrong with using it in a proof.

Examples:

As we've seen, the implication $$P$$ implies $$Q$$ is True when $$P$$ is false. It's also True when $$Q$$ is True and only false when $$P$$ is True and $$Q$$ is False. In tabular form:

The logical symbol for implication is "$$\implies$$", though "$$\supset$$" is sometimes seen instead. so you can write $$P \implies Q$$ for $$P$$ implies $$Q$$.

Unlike $$P$$ and $$Q$$ and $$P$$ or $$Q$$, the value of $$P$$ implies $$Q$$ may change if you switch $$P$$ with $$Q$$. In other words
 * $$P$$ implies $$Q$$

is not always the same as
 * $$Q$$ implies $$P$$.

The two statements are related though and we call the statement
 * $$Q$$ implies $$P$$

the 'converse' of
 * $$P$$ implies $$Q$$

Implication plays an important role since most theorems take on the form of an implication.

Equivalence
The last connective we'll be talking about is equivalence. This one does not occur in English very often, so some of the ways of stating an equivalence may be unfamiliar. But it is important enough in mathematics that it gets its own terminology.

The equivalence of two statements $$P$$ and $$Q$$ is the statement is that $$P$$ and $$Q$$ have the same truth value. Another way of say this is that $$P$$ implies $$Q$$ and $$Q$$ implies $$P$$.

Some ways to phrase this are
 * $$P$$ is equivalent to $$Q$$.
 * $$P$$ if and only if $$Q$$.
 * $$P$$ exactly when $$Q$$.
 * $$P$$ iff $$Q$$. (iff is an abbreviation for if and only if).
 * $$P$$ is a necessary and sufficient condition for $$Q$$.

Examples:

The equivalence $$P$$ iff $$Q$$ is True when $$P$$ and $$Q$$ have the same truth values, and False when they have different truth values. In other words $$P$$ iff $$Q$$ is True when $$P$$ and $$Q$$ are both True or both False, and $$P$$ iff $$Q$$ is False is one of $$P$$ and $$Q$$ is True while the other is false. In tabular form:

The logical symbol for implication is "$$\iff$$", so you can write $$P \iff Q$$ for $$P$$ iff $$Q$$.

The statement
 * $$P$$ iff $$Q$$

states that the implication
 * $$P$$ implies $$Q$$

and its converse are both true.

Complex expression
With the connectives given above we can build up more complex expressions. For example
 * (not $$P$$) or $$Q$$
 * ($$P$$ or $$Q$$) and $$R$$

To avoid writing excessive parentheses, there are precedence rules to decide the order of operations in otherwise ambiguous expressions. The top priority is 'not', so you never need to put parentheses around 'not $$P$$'. Next comes 'and' and 'or' which have the same priority. Then 'implies' and finally 'iff'.

So, for example, the first example above can be written more simply as
 * not $$P$$ or $$Q$$

but the second example can't be simplified.

It can be shown that any logical connective in any number of variables can be expressed as some combination of the connectives given above. In fact you really only need 'not', 'and', and 'or'. We won't prove this here since it's really a theorem in logic rather than mathematics, but we can give you the basic idea by constructing an expression for exclusive or. First, list the conditions where the connective is True; in this case $$P$$ xor $$Q$$ is True when $$P$$ is True and $$Q$$ is False, or $$P$$ is False and $$Q$$ is True, and False otherwise. Now list state each condition as a conjunction, so in this case we get
 * $$P$$ and not $$Q$$

and
 * not $$P$$ and $$Q$$

Finally form the disjunction of all the statements formed in the previous step, so the final result, which we can take as the definition of $$P$$ xor $$Q$$, is
 * ($$P$$ and not $$Q$$) or (not $$P$$ and $$Q$$)

<!-- In this chapter we will define and derive rules for working with compound logical statements. The symbols used to combining statements are called "logical operators".

Basic results
In this section we will prove some basic equivalences for compounded logical statements. We say that two (compound) statements are logically equivalent when written in the same truth table, their columns are identical. Knowing how to write statements into logically equivalent statements is very useful in the sense that a statement might be difficult to prove, yet a logically equivalent statement might be easier to prove.

Lemma 1 (DeMorgan's law, part 1)
$$\lnot(P\land Q)$$ is logically equivalent to $$\lnot P \lor \lnot Q$$

Proof

Since the columns for the compound statements are identical, they are logically equivalent. QED

Proving the following theorems are left as exercises.

Lemma 2 (DeMorgan's law, part 2)
$$\lnot(P\lor Q)$$ is logically equivalent to $$\lnot P \land \lnot Q$$

Lemma 3
$$P\Leftrightarrow Q$$ is logically equivalent to $$(P\Rightarrow Q)\land(Q\Rightarrow P)$$

Lemma 4
$$\lnot(P\Rightarrow Q)$$ is logically equivalent to $$P\land(\lnot Q)$$

Lemma 5
$$P\Rightarrow Q$$ is logically equivalent to $$\lnot P\lor Q$$

Lemma 6 (Contrapositive)
$$P\Rightarrow Q$$ is logically equivalent to $$\lnot Q \Rightarrow \lnot P$$

Lemma 7
$$P\Leftrightarrow Q$$ is logically equivalent to $$\lnot P \Leftrightarrow \lnot Q$$

= Predicates and Quantifiers =

A predicate is defined to be a function mapping any set into the set $$\{T,F\}$$ where the symbols $$T$$ and $$F$$ mean 'true' and 'false' respectively. A predicate can be thought of a collection of statements, one for each element of the domain of the predicate.

For example, we may define the predicate $$P:\mathbb{Z}\to \{T,F\}$$ by $$P(x):=$$"x is an even integer". Instead of writing "$$P(5)=F$$" and "$$P(16)=T$$" we will say and write "$$P(5)$$ is false" and "$$P(16)$$ is true".

If $$P:A\to \{T,F\}$$ is a predicate, then the predicate $$\lnot P:A\to \{T,F\}$$ defined to be such that $$\lnot P(x)$$ is true exactly when $$P(x)$$ is false and $$\lnot P(x)$$ is false exactly when $$P(x)$$ is true, is called the negation of $$P$$.

There are two quantifiers denoted by the symbols "$$\forall$$" and "$$\exists$$" which read "for all" and "there exists" respectively.

Let $$P:A\to \{T,F\}$$ be a predicate and let $$B$$ be any subset of $$A$$ (subsets are discussed in the next section). Then $$\forall x\in B:P(x)$$ which reads "For all elements $$x$$ contained in $$B$$, P(x) is true." is a statement, and is defined to be true exactly when $$P(x)$$ is true for every element $$x$$ contained in $$B$$.

Similarly, $$\exists x\in B:P(x)$$ which reads "There exists an element $$x$$ contained in $$B$$ such that P(x) is true." is a statement, and is defined to be true exactly when $$P(x)$$ is true for at least one element $$x$$ contained in $$B$$.

We define the negation of statements involving quantifiers as follows $$\lnot(\forall x\in B:P(x)):=\exists x\in B:\lnot P(x)$$ and $$\lnot(\exists x\in B:P(x)):=\forall x\in B:\lnot P(x)$$

-->