Skip to main content

Discrete Mathematics for Computing (Draft)

Section 3.1 Statements and Symbolic Logic

Statements and logic are foundational across all of mathematics. In this section, we’ll formally introduce the definition of a mathematical statement and we’ll introduce symbolic logic as a set of notation to remove the ambiguity that often accompanies written language. Along the way, we’ll also provide a limited introduction to truth tables as a mechanism for analyzing the conditions under which compound logical statements are valid (true).

Subsection 3.1.1 Statements

In mathematics, a statement is a claim which is either true or false, but for which there is no ambiguity. The following are examples of statements.
  • Water boils at \(100^\circ\)C.
  • If a triangle is a right triangle, and \(a\) and \(b\) are the lengths of its legs while \(c\) is the length of its hypotenuse, then \(a^2 + b^2 = c^2\text{.}\)
  • The real number \(\pi\) is even.
Notice that each of these claims is either true or false, and the truth value of the claim does not depend on the reader. Water indeed boils at \(100^\circ\)C, the Pythagorean Theorem does hold for right triangles, and the number \(\pi\) is not an even number. That is the first two claims are true, while the second one is false. Since the three claims have these truth values regardless of who is evaluating them, they are indeed statements.
Since we’ve defined what a statement is, it will also be helpful to have examples of what a statement isn’t. The following are examples which are not statements.
  • Trigonometry is difficult.
  • Are you enjoying this book so far?
  • Make sure you complete all the embedded exercises in this section.
None of the above are statements because they do not have truth values. The first is a matter of opinion, whose truth value is dependent on the reader. The second is a question, while the third is a command.
Now is a good time for you to try your hand at identifying statements. Use the following embedded exercises to check your understanding.

Checkpoint 3.1.1. Identifying Statements.

If you got all of those correct on the first try, nice work! If you got any wrong on the first try, click the button to generate a new version and try again on a new set of questions.

Subsection 3.1.2 Symbolic Logic

Written and spoken language can have ambiguous meaning. For example, if we say "I will be at the gym or I will be studying at the library", what we really mean is that I will be doing one or the other -- but not both. In mathematics we do not work with ambiguity, indeed compound statements -- individual (atomic) statements joined by logical operators (like or) -- must be statements in their own right. That is, these compound logical statements must be true or false, but not both. For this reason, we’ll develop symbolic logic, including a set of boolean (true/false) algebraic operators in our further exploration of logic.
We’ll refer to an atomic statement as a statement which cannot be decomposed into smaller substatements. For example, the statement "it is raining" is an atomic statement, while the statement "it is raining and I have an umbrella" is not an atomic statement. The latter can be decomposed into the atomic statements "it is raining" and "I have an umbrella". In symbolic logic we’ll use letters like \(p\text{,}\) \(q\text{,}\) \(r\text{,}\) etc. to represent atomic statements. For example,
\begin{gather*} p:~ \text{I am writing in Python}\\ q:~ \text{I am using correct indentation}\\ r:~ \text{my code will run} \end{gather*}
Each of those statements listed above is an atomic statement which cannot be decomposed into smaller sub-statements. Using \(p\text{,}\) \(q\text{,}\) and \(r\) to represent their corresponding statements is convenient and efficient.
We’ll now introduce four logical operators, corresponding to not, and, or, and if/then. These operators allow us to combine statements to build compound logical statements just like we do in written and spoken language.
The negation operator corresponds to the word "not" and is used to switch the truth value of a statement. There are a variety of symbols which can be used to represent the negation operator. Common symbols are \(\neg\text{,}\) \(\sim\text{,}\) or \(!\) -- since the focus of this text is mathematics for computing, we’ll use \(!\) to signify negation, since that is common in programming languages. That is, the statement \(!p\) is the negation of the statement \(p\) -- they have opposite truth values. We can make use of a truth table to describe all of this compactly.
Table 3.1.2.
\(p\) \(!p\)
T F
F T
The conjunction operator takes the place of the word "and". The conjunction is denoted by \(\land\text{,}\) and it requires two statements -- one to the left of the operatory and one to the right, for example \(p \land q\text{.}\) The compound logical expression \(p \land q\) evaluates to *true* only if both of its components (\(p\) and \(q\)) are true. That is,
Table 3.1.3.
\(p\) \(q\) \(p \land q\)
T T T
T F F
F T F
F F F
The disjunction operator replaces the word "or", and is denoted by \(\lor\text{.}\) Like the conjunction, the disjunction requires two statements but it evaluates to *true* as long as at least one of its components are true. That is,
Table 3.1.4.
\(p\) \(q\) \(p \lor q\)
T T T
T F T
F T T
F F F
The implication (or conditional) operator is used to denote "if/then" statements. This is another operator that requires two component statements. The implication operator is typically written as an arrow (either \(\to\) or \(\implies\)). I’ll use the single line arrow to denote the implication -- that is, \(p \to q\text{.}\) As mentioned at the beginning of this paragraph, it is common to read \(p\to q\) as "if \(p\text{,}\) then \(q\)", but another common reading is that "\(p\) implies \(q\)". The implication is true in all cases except when \(p\) is *true* and \(q\) is *false*. That is,
Table 3.1.5.
\(p\) \(q\) \(p \to q\)
T T T
T F F
F T T
T T T
For the implication \(p\to q\text{,}\) we consider \(p\) the hypothesis and \(q\) to be the conclusion. This is helpful for constructing formal arguments, writing technical mathematical theorems, and more. if you are not quite that you grasp the notion of a conditional statement just yet, it may be helpful to think of \(p\to q\) as a promise. That is, "if you do \(p\) for me, then I will do \(q\) for you". A simple example I often give my students is "If you mow my lawn, then I will pay you $20" -- my promise made is only broken if you mow my lawn but I don’t pay you. This is just like the implication.

Subsection 3.1.3 Summary

That’s plenty for this section. Here you were introduced to statements, which are claims which are either true or false -- but cannot be both. You were also introduced to our foundational logical operators -- the negation (not), the conjunction (and), the disjunction (or), and the conditional (if/then). These are all of the main building blocks of logic. We’ll see more with formal logic, in particular with compound logical statements and truth tables for evaluating them, in the next section.