-
Propositional Logic
1. Introduction
In this unit we present an introduction to propositional logic, a branch of science that is fundamental in the study of mathematics and computer science. The origin of logic dates back to the 3rd century BC and the Greek philosopher Aristotle who developed the earliest form of logical theory through rules for deductive reasoning. Modern mathematical logic is generally recognised as having started with the work of German mathematician Gottfried Leibniz in the 17th century. In the 19th century two English mathematicians, George Boole and Augustus De Morgan, are credited with extending the work of Leibniz and introducing symbolic logic. Other notable contributors to the development of propositional logic include the mathematicians, Gottlob Frege in Germany and Charles Pierce in the USA.
The unit begins with a brief overview of some of the terminology that features in propositional logic and the main logical operators (connectives) that are used in the construction of propositions are discussed in detail. Two special types of proposition known as tautologies and contradictions that are respectively always true or false are then described. The concept of logical equivalence is presented before we look at translating propositions from English to their corresponding symbolic form and vice-versa. The idea of a truth table, introduced earlier during the discussion on connectives, is then presented in further detail and we demonstrate how these tables can be used to prove properties such as logical equivalence. We then discuss how logical equivalence can be used to simplify propositions, identify tautologies and contradictions and prove identities. Next we look at how to determine whether a mathematical argument is valid or invalid based on how well the premises support the conclusion. To close the unit we briefly look at the role of logic in computing, including simplifying expressions in computer programming and system specification.
-
2. Propositions and connectives
In mathematics a proposition, or statement, is a declarative sentence which is either true or false but not both. In these notes the terms are used interchangeably.
We refer to “true” (T) and “false” (F) as the truth-values of the proposition.
Example 1
The following are all propositions as they can be true or false:
(i). “$3 + 1 = 4$.” It is true and its truth-value is T.
(ii). “$7$ is an even number.” It is false and its truth-value is F.
(iii). “London is in Spain.” It is false and its truth-value is F.
(iv). “Glasgow is in Scotland.” It is true and its truth-value is T.
(v). "$2 × 0 = 0$.” It is true and its truth-value is T.
(vi). "$2 × 0 = 2$.” It is false and its truth-value is F.
The following are not propositions:
(vii). “$x + y > 6$ where $x$ and $y$ are integers.” Without knowing the values of $x$ and $y$ we are unable to ascertain its truth value. The sentence will be true for some choices of $x$ and $y$, and false for other choices. For example, if $x = 3$ and $y = 4$ the sentence is true, but if $x = 3$ and $y = 2$ it is false.
(viii). “He is a computing student.” Whether it is true or false depends on the person. It will be true for some people and false for others.
(ix). “What time is it?” This is a question, not a proposition. It is neither true nor false.
(x). “Shut the door.” This is a command, not a proposition. It is neither true nor false.
End of Example 1It is therefore possible for a sentence to be grammatically correct, and make perfect sense, but if we are unable to say whether it true or false it is not a proposition. All genuine propositions have a truth value.
Propositions (i) to (vi) above are examples of simple (atomic) propositions whose truth values are relatively straightforward to determine. More complex sentences, or compound propositions, are made up from simple propositions using logical connectives, also called logical operators. For example, we could combine the simple propositions in (i) and (iii), say, using the connective “and” to give the compound proposition,
“$3 + 1 = 4$ and London is in Spain”.
It is usual to choose letters such as $p, q, r, s$, etc. to represent propositions so that in the above we could define
$p$ to be the proposition, “$3 + 1 = 4$” and
$q$ to be the proposition, “London is in Spain”.
Then the compound proposition can be written as, “$p$ and $q$”.
The truth value of a compound proposition depends on the truth values of its constituent (simple) propositions.
As we have previously noted compound propositions are formed by combining simple propositions by means of logical connectives. The most commonly used connectives in logic and their symbolic representations are listed in the following table.
Connective English wording Symbol Negation NOT $\sim \;\; \neg$ Conjunction AND $\wedge$ Disjunction OR $\vee$ Conditional IF ... THEN $\rightarrow$ Biconditional IF AND ONLY IF $\leftrightarrow$ Exclusive Or EITHER ... OR,
BUT NOT BOTH$\oplus$ We now look at these connectives in more detail and use truth tables to summarise the relationship between the truth value of a compound proposition, that involves a connective, and the truth values of its component propositions
📹 Logic 101 (#3): Finding Simple Sentences
📹 Logic 101 (#4): Representing Simple Sentences
2.1. Negation
The simplest of all logical operations is “not”, also known as negation. The negation symbol “$\sim$” (called “tilde”) is an example of a unary logical operator (the term “unary” indicates that the operator acts on a single proposition).
- Let $p$ be an arbitrary proposition then its negation is $\sim p$ and is read as “not $p$”. Alternative, but equivalent, interpretations of $\sim p$ include:
- “It is not the case that $p$”
- “It is not true that $p$”.
As a simple proposition can only take the truth values T or F, the truth table for “not” only involves two possibilities. To create the table we write $p$ and $\sim p$ in the first row and then list the two possible combinations of T and F in the remaining rows.
The truth table for negation is therefore,
$p$ $\sim p$ T F F T If $p$ is true, then $\sim p$ is false, and if $p$ is false, then $\sim p$ is true.
Example 2
(i). The proposition, $p$ : “ $4 > 9$ ” has truth value F.
The proposition, $\sim p :$ not $( p )$
not $(4 > 9)$
“$4$ is not greater than $9$”, i.e.
“$4 \le 9$ ” has truth value T.
(ii). Let $p$ represent, “Maths for Computing is easy”.
- We can read $\sim p$ as:
- “Maths for Computing is not easy”, or
- “It is not the case that Maths for Computing is easy”, or
- “It is not true that Maths for Computing is easy”.
The double negation rule says that taking a proposition, negating it and then negating the negation recovers the original proposition, i.e. $\sim (\sim p) = p $.
📹 Propositional Logic: Double Negation
End of Example 22.2. Conjunction
If $p$ and $q$ are propositions the compound proposition, “$p$ and $q$” is called the conjunction of $p$ and $q$. The operands $p$ and $q$ are respectively called the left and right conjuncts.
A conjunction is denoted symbolically as $p \wedge q$ and is defined to be true only when $p$ and $q$ are both true. It is false otherwise.
The conjunction symbol “ $\wedge$ ” is an example of a binary logical operator. The term “binary” indicates that the operator acts on a pair of propositions.
To construct the truth table we note that any proposition can only take two truth values, either T or F. A compound proposition, such as $p \wedge q$, involving two propositions will therefore give rise to four possible combinations of T and F, and four rows in the corresponding truth table.
The truth table for $p \wedge q$ is:
$p$ $q$ $p \wedge q$ T T T T F F F T F F F F The table shows that the conjunction, of $p$ and $q$ is true only when $p$ and $q$ are both true.
Note that conjunction is commutative so that $p \wedge q$ has the same meaning as $q \wedge p$, and their truth tables are identical.
Example 3
- Define the following simple propositions:
- $p : 4 > 0$
- $q : 6 > 2$
- $r : 7 > 9$
- $s : 8 < 3$
- We then have:
- $p \wedge q$ is true since $p$ is true and $q$ is true.
- $p \wedge r$ is false since $p$ is true and $r$ is false
- $r \wedge q$ is false since $r$ is false and $q$ is true.
- $r \wedge s$ is false since $r$ is false and $s$ is false
📹 Logic 101 (#33): Conjunction
End of Example 32.2.1. Alternative conjunctions
In logic a variety of words have the same meaning as the conjunction “and”. For example, using “but”, or “however”, or “yet”, or “although” enables us to emphasise a possibly surprising outcome that will not be emphasised in the version of the proposition that uses “and” as the conjunction.
Example 4
- Consider the compound propositions:
- “John passed the maths exam, but he failed the physics exam”,
- “John passed the maths exam, however he failed the physics exam”,
- “John passed the maths exam, yet he failed the physics exam”,
- “Although John passed the maths exam, he failed the physics exam”.
All of these appear to suggest that it is perhaps surprising that John failed the physics exam, given that he passed the maths exam.
- However, they all have the same logical meaning as:
- “John passed the maths exam and he failed the physics exam”.
End of Example 42.3. Disjunction
If $p$ and $q$ are propositions the compound proposition, “$p$ or $q$” is called the disjunction of $p$ and $q$. The operands $p$ and $q$ are respectively called the left and right disjuncts.
- A disjunction is denoted symbolically as $p \vee q$ and defined to be:
- true if $p$ is true, or $q$ is true, or both $p$ and $q$ are true.
- false only if $p$ and $q$ are both false.
In logic “or” always means the inclusive-or as it allows for the possibility that both $p$ and $q$ are true. We must use the exclusive-or (see Section 2.6) if we wish to exclude this possibility.
The truth table for $p \vee q$ is:
$p$ $q$ $p \vee q$ T T T T F T F T T F F F The table shows that the disjunction, of $p$ and $q$ is true if at least one of $p$ or $q$ is true.
Note that disjunction is commutative so that $p \vee q$ has the same meaning as $q \vee p$ , and their truth tables are identical.
Example 5
- Define the following simple propositions:
- $p : 4 > 0$
- $q : 6 > 2$
- $r : 7 > 9$
- $s : 8 < 3$
- We then have:
- $p \vee q$ is true since both $p$ and $q$ are true
- $p \vee r$ is true since $p$ is true.
- $r \vee q$ is true since $q$ is true.
- $r \vee s$ is false since both $r$ and $s$ are false.
📹 Logic 101 (#35): Disjunction
End of Example 52.4. Conditional (Implication)
- If $p$ and $q$ are two propositions the compound proposition “if $p$ then $q$” is referred to as a conditional or an implication. It is denoted symbolically as $p \to q$, where $\to$ is the conditional operator, and can be read in several different (equivalent) ways:
- “if $p$, then $q$”
- “$p$ implies $q$”,
- “$p$ only if $q$”,
- “$q$ if $p$”,
- “$p$ is a sufficient condition for $q$”,
- “$q$ is a necessary condition for $p$”,
- “$q$ whenever $p$”,
- “$p$ therefore $q$”.
In the expression $p \to q$, $p$ is called the hypothesis (antecedent or premise) of the implication and $q$ is the conclusion (or consequent). Hence, the hypothesis is the part of the proposition that follows “if” and the conclusion is the part that follows “then”.
The only way that $p \to q$ can be false is if the first proposition $( p )$ is true and the second proposition $( q )$ is false.
The truth table for $p \to q$ is:
$p$ $q$ $p \to q$ T T T T F F F T T F F T 📹 Propositional Logic: Conditionals
📹 Truth Tables for Conditional Statements (watch up to 2:42.)
📹 Logic 101 (#9): Conditional (If-Then) Statements
Implication is perhaps not as intuitively obvious as the previous compound propositions but the following example may help clarify matters.
Example 6
Suppose your lecturer tells you that:
“If you complete the Maple exercises, then you will pass the exam.”
- We shall consider this to be a promise on the part of the lecturer. Let us now investigate the four possible outcomes.
- Suppose you complete the Maple exercises and you pass the exam then the promise has been kept and the lecturer’s statement is true.
- Suppose you complete the Maple exercises and you do not pass the exam then the promise has been broken and the lecturer’s statement is false.
- Suppose you do not complete the Maple exercises. Note that the lecturer did not say what will happen if you do not complete the Maple exercises. His/Her statement only refers to the outcome if you complete the exercises. Whether or not you pass the exam the lecturer has not broken his/her promise. There are two cases:
- If you do not pass the exam, the promise has not been broken.
- If you pass the exam, the promise has not been broken.
So, the lecturer’s statement will be true in all but one case, i.e. when you complete the Maple exercises and you do NOT pass the exam.
End of Example 6Example 7
Identify the hypothesis and the conclusion in the following propositions:
(i). “If a number is prime, then it has no positive integer divisors other than $1$ and itself”, $p \to q$.
Hypothesis: “a number is prime”, $(p)$.
Conclusion: “it has no positive integer divisors other than $1$ and itself”, $(q)$.
(ii). “If two lines intersect at right angles, then the lines are perpendicular”, $p \to q$.
Hypothesis: “two lines intersect at right angles”, $(p)$.
Conclusion: “the lines are perpendicular”, $(q)$.
End of Example 7Example 8
- Define the following simple propositions:
- $p : 4 > 0$
- $q : 3 = 3$
- $r : 7 > 9$
- $s : 8 < 3$.
- We then have:
- $p \to q$ (“If $4 > 0$, then $3 = 3$”) is true since both $p$ and $q$ are true.
- $p \to r$ (“If $4 > 0$, then $7 > 9$”) is false since $p$ is true and $r$ is false.
- $r \to q$ (“If $7 > 9$, then $3 = 3$”) is true since $r$ is false and $q$ is true.
- $r \to s$ (“If $7 > 9$, then $8 < 3$”) is true since $r$ is false and $s$ is false.
End of Example 8Example 9
As noted earlier there are different ways in which we can express an implication. Here we look at the use of the word “unless” as it appears in conditional statements.
- Consider the conditional proposition,
- “If it is not raining, then I will go walking.”
- In symbolic form define,
- $p$ : “I will go walking”
- $q$ : “It is raining”.
The conditional proposition becomes, $\sim q \to p$.
- This statement is equivalent to,
- $p$ unless $q$.
- which translates to give,
- “I will go walking unless it is raining.”
Hence, “$p$ unless $q$” is equivalent to “if not $q$ then $p$”.
📹 Propositional Logic: A unless B
End of Example 9Example 10
“If Angela does not go to the football match, then John does not go to the football match.”
can be written as
“John will not go to the football match unless Angela goes to the football match.”
End of Example 102.4.1. Other conditionals
There are several important forms related to the conditional and three of these, the converse, inverse and contrapositive are discussed below.
(a). Converse
The proposition $q \to p$ is the converse of the proposition $p \to q$ and has truth table:
$p$ $q$ $q \to p$ T T T T F T F T F F F T Note that $p \to q$ and its converse $q \to p$ are not the same and their truth tables are different. Compare the second and third rows in each table.
Example 11
For each of the following write down the conditional proposition $p \to q$, and its converse $q \to p$. Determine the truth value of each compound proposition.
- (i). Define the following propositions:
- $p : x = 6$.
- $q : x^2 = 36$.
CONDITIONAL: If $x = 6$, then $x^2 = 36$, $p → q$, TRUE
CONVERSE:If $x^2 = 36$, then $x = 6, q \to p$, FALSE as we could have $x = -6$.
- (ii). Define the following propositions:
- $p$ : Ann is from Glasgow.
- $q$ : Ann is from Scotland.
CONDITIONAL: If Ann is from Glasgow, then Ann is from Scotland, $p \to q$. TRUE
CONVERSE:If Ann is from Scotland, then Ann is from Glasgow, $q \to p$.
FALSE as Ann could be from Scotland but not from Glasgow. She may be from Edinburgh.
- (iii). Define the following propositions:
- $p$ : a polygon has exactly three sides.
- $q$ : a polygon is a triangle.
CONDITIONAL: If a polygon has exactly three sides, then it is a triangle, $p \to q$, TRUE.
CONVERSE:If a polygon is a triangle, then it has exactly three sides, $q \to p$, TRUE.
These examples have shown that the truth of an implication does not imply the truth of its converse.
📹 Truth Table for the Converse (watch between 4:00 and 5:05) )
End of Example 11(b). Inverse
The proposition $(\sim p) \to (\sim q)$ is the inverse of the proposition $p \to q$.
The inverse of a conditional statement is formed by negating the hypothesis and the conclusion of the original statement. The truth table for the inverse is,
$p$ $q$ $\sim p$ $\sim q$ $(\sim p) \to (\sim q)$ T T F F T T F F T T F T T F F F F T T T If we compare the truth tables for the inverse and converse we observe that the final highlighted columns, headed $(\sim p) \to (\sim q)$ and $q → p$ respectively, are exactly the same.
Two compound propositions are said to be logically equivalent if they have the same truth values for all possible combinations of their atomic propositions and hence the same truth tables. We shall use the symbol “ $\equiv$ ” to indicate logical equivalence.
The inverse and converse propositions are therefore logically equivalent and we write $(\sim p) \to (\sim q) \equiv q \to p$. Logical equivalence will discussed further in Section 4.
Example 12
For each of the following write down the conditional proposition $p \to q$, and its inverse $(\sim p) \to (\sim q)$ . Determine the truth value of each compound proposition.
- (i). Define the following propositions:
- $p : x = 6$
- $q : x^2 = 36$.
CONDITIONAL: If $x = 6$, then $x^2 = 36,\;\; p \to q$. TRUE
INVERSE: If $x \neq 6$ then $x^2 \neq 36$, $(\sim p) \to (\sim q)$, FALSE as we could have $x = -6$.
- (ii). Define the following propositions:
- $p$ : Ann is from Glasgow.
- $q$ : Ann is from Scotland.
CONDITIONAL: If Ann is from Glasgow, then Ann is from Scotland, $p \to q$. TRUE
INVERSE: If Ann is not from Glasgow, then Ann is not from Scotland, $(\sim p) \to (\sim q)$.
FALSE as it is possible that Ann is not from Glasgow but she is still from Scotland. She may be from Edinburgh.
- (iii). Define the following propositions:
- $p$ : a polygon has exactly three sides.
- $q$ : a polygon is a triangle.
CONDITIONAL: If a polygon has exactly three sides, then it is a triangle, $p \to q$, TRUE.
INVERSE: If a polygon does not have exactly three sides, then it is not a triangle, $(\sim p) \to (\sim q)$, TRUE.
These examples have shown that the truth of an implication does not imply the truth of its inverse.
📹 Truth Table for the Inverse (watch between 2:42 and 4:00)
End of Example 12(c). Contrapositive
The proposition $(\sim q) \to (\sim p)$ is the contrapositive of the proposition $p \to q$.
The contrapositive of a conditional statement is formed by determining the converse of the inverse proposition.
A conditional proposition and its contrapositive are logically equivalent, so that $p \to q$ and $(\sim q) \to (\sim p)$ have the same final column in their truth tables. Compare the highlighted columns in their tables.
$p$ $q$ $\sim p$ $\sim q$ $(\sim q) \to (\sim p)$ T T F F T T F F T F F T T F T F F T T T Example 13
For each of the following write down the conditional proposition $p \to q$, and its contrapositive $(\sim q) \to (\sim p)$. Determine the truth value of each compound proposition.
- (i). Define the following propositions:
- $p : x = 6$
- $q : x^2 = 36$.
CONDITIONAL: If $x = 6$, then $x^2 = 36, p \to q$. TRUE
CONTRAPOSITIVE: If $x^2 \neq 36$, then $x \neq 6, (\sim q) \to (\sim p)$, TRUE.
- (ii). Define the following propositions:
- $p$ : Ann is from Glasgow.
- $q$ : Ann is from Scotland.
CONDITIONAL: If Ann is from Glasgow, then Ann is from Scotland, $p \to q$. TRUE
CONTRAPOSITIVE: If Ann is not from Scotland, then Ann is not from Glasgow, $(\sim q) \to (\sim p)$. TRUE
- (iii). Define the following propositions:
- $p$ : “a polygon has exactly three sides.”
- $q$ : “a polygon is a triangle.”
CONDITIONAL: If a polygon has exactly three sides, then it is a triangle, $p \to q$, TRUE.
CONTRAPOSITIVE: If a polygon is not a triangle, then it does not have exactly three sides, $(\sim q) \to (\sim p)$, TRUE.
These examples have shown that the truth of an implication does imply the truth of its contrapositive.
📹 Truth Table for the Contrapositive (watch from 5:05 onwards)
📹 Logic 101 (#18): Contrapositive
End of Example 132.5. Biconditional
If $p$ and $q$ are two propositions, then the compound proposition “$p$ if and only if $q$” is called the biconditional.
The biconditional is denoted symbolically as $p \leftrightarrow q$, where the double-headed arrow, $\leftrightarrow$ is the biconditional operator.
- We can read $p \leftrightarrow q$ in several different (equivalent) ways including:
- “$p$ if and only if $q$”
- “$p$ is a necessary and sufficient condition for $q$”
- “$q$ is a necessary and sufficient condition for $p$”
- “if $p$ then $q$ and if $q$ then $p$”
- “if $q$ then $p$ and if $p$ then $q$”.
Note that “if and only if” is often abbreviated to “iff” and we write, “$p$ iff $q$”.
We can think of the biconditional as a “two-way implication” so that $p \leftrightarrow q$ can be written as the conjunction of two conditionals (implications) $(p \to q) \wedge (q \to p)$.
The truth table for $p \leftrightarrow q$, as we shall see below, is obtained by constructing the truth table for the proposition $(p \to q) \wedge (q \to p)$ and is:
$p$ $q$ $p \leftrightarrow q$ T T T T F F F T F F F T For $p \leftrightarrow q$ to be true both $p$ and $q$ must have the same truth values. Otherwise it is false.
We can substitute the proposition $p$ for $q$ and substitute the proposition $q$ for $p$ without changing the truth values of $p \leftrightarrow q$. Hence, $p \leftrightarrow q$ and $q \leftrightarrow p$ have the same truth tables and are therefore logically equivalent.
The truth table for the proposition $(p \to q) \wedge (q \to p)$, see below, has an identical final (rightmost) column to the table for $p \leftrightarrow q$ and so the two propositions are logically equivalent.
$p$ $q$ $p \to q$ $q \to p$ $(p \to q) \wedge (q \to p)$ T T T T T T F F T F F T T F F F F T T T To explain the biconditional in more detail, by means of worked examples, we consider the conditional $p \to q$ and its converse $q \to p$ and analyse their respective truth values, with reference to the above table.
Example 14
CONDITIONAL: If a polygon has exactly three sides, then it is a triangle, $p \to q$, TRUE
CONVERSE: If a polygon is a triangle, then it has exactly three sides, $q \to p$, TRUE
BICONDITIONAL: A polygon is a triangle if and only if it has exactly three sides, $p \leftrightarrow q$, equivalently $(p \to q) \wedge (q \to p)$, TRUE.
End of Example 14Example 15
CONDITIONAL: If two lines intersect at right angles, then the lines are perpendicular, $p \to q$, TRUE
CONVERSE: If two lines are perpendicular, then the lines intersect at right angles, $q \to p$, TRUE
BICONDITIONAL: Two lines are perpendicular if and only if they intersect at right angles, $p \leftrightarrow q$, equivalently $(p \to q) \wedge (q \to p)$, TRUE.
End of Example 15Example 16
CONDITIONAL: If a number is prime, then it has no positive integer divisors other than 1 and itself, $p \to q$, TRUE
CONVERSE: If a number has no positive integer divisors other than $1$ and itself, then it is prime, $q \to p$, TRUE
BICONDITIONAL: A number is prime if and only if it has no positive integer divisors other than $1$ and itself, $p \leftrightarrow q$, equivalently $(p \to q) \wedge (q \to p)$, TRUE.
End of Example 16Example 17
- (i). Consider the propositions,
- $p : 4 < 0$
- $q : 5 < 2$
The implications $p \to q$ and $q \to p$ are both true because $p$ and $q$ are both false. Hence, $(p \to q) \wedge (q \to p)$ is true so that $p \leftrightarrow q$ is true.
- (ii). Consider the propositions,
- $p : 4 > 0$
- $q : 5 > 2$
The implications $p \to q$ and $q \to p$ are both true because $p$ and $q$ are both true. Hence, $(p \to q) \wedge (q \to p)$ is true so that $p \leftrightarrow q$ is true.
📹 Logic 101 (#10): Biconditional (IF AND ONLY IF)
📹 Propositional Logic: A if and only if B
End of Example 172.6. Exclusive Or
The proposition that either $p$ or $q$ is true, but not both, is called the exclusive-or (exclusive disjunction).
In mathematics and computing the word “or” is always taken as meaning the inclusive-or unless otherwise stated. The exclusive-or is rarely used but does have some applications, in computer programming for example.
The exclusive-or is denoted symbolically as $p \oplus q$ and is defined to be true only when exactly one of $p$ or $q$ is true. It is false otherwise.
The truth table for $p \oplus q$ is:
$p$ $q$ $p \oplus q$ T T F T F T F T T F F F Example 18
- We shall prove later, using truth tables, that $p \oplus q$ and $(p\; \wedge \sim q) \vee (\sim p \wedge q)$ are logically equivalent. In the meantime consider the following.
- $p$ : I shall play golf.
- $q$ : I shall play tennis.
$p \oplus q$ :Either I shall play golf or I shall play tennis, but not both.
$(p \;\wedge \sim q) \vee (\sim p \wedge q)$ : I shall play golf and I shall not play tennis or I shalll play tennis and I shall not play golf.
These two statements mean the same.
End of Example 18Example 19
- Define the following simple propositions:
- $p : 4 > 0$
- $q : 6 > 2$
- $r : 7 > 9$
- $s : 8 < 3$.
- We then have the following:
- $p \oplus q$ is false since $p$ is true and $q$ is true.
- $p \oplus r$ is true since $p$ is true and $r$ is false.
- $r \oplus q$ is true since $r$ is false and $q$ is true.
- $r \oplus s$ is false since $r$ is false and $s$ is false.
📹 Logic 101 (#14): Exclusive OR
End of Example 192.7. Truth tables – summary
The table below summarises the truth tables for the logical connectives described above.
$p$ $q$ $\sim p$ $p \wedge q$ $p \vee q$ $p \to q$ $p \leftrightarrow q$ $p \oplus q$ T T F T T T T F T F F F T F F T F T T F T T F T F F T F F T T F 2.8. Precedence of logical connectives
We know that when performing arithmetic calculations there is an established order of precedence to ensure the evaluation is carried out in the correct order. The BODMAS rule provides an easy way of remembering the order of operations in the absence of brackets.
A similar principle applies in logic and requires that compound propositions be evaluated in a specific order using the order of precedence given in the following table.
Operator Precedence $\sim$ 1 $\wedge$ 2 $\vee$ 3 $\to$ 4 $\leftrightarrow$ 5 As in arithmetic, the use of parentheses simplifies matters and to a large extent removes the risk of misinterpreting a statement. We shall use parentheses throughout to avoid any confusion.
Example 20
Write the following proposition using parentheses, $p\; \wedge \sim q \vee r \to s$.
Solution
- The operator with the highest precedence is negation, $\sim$, and so we group it with its operand and write $(\sim q)$.
- The next highest precedence is $\wedge$ and we write, $p \wedge (\sim q)$ .
- The next highest precedence is $\vee$ and we write, $(p \wedge (\sim q)) \vee r$.
- The next highest precedence is $\to$ and we write, $((p \wedge (\sim q)) \vee r) \to s$ .
End of Example 20 -
3. Tautologies, Contradictions and Contingencies
We now consider special types of compound propositions, i.e. ones that are always true and ones that are always false.
3.1. Tautology
A tautology is a compound proposition that is always true no matter what the truth values of its simple propositions. The final column of the corresponding truth table will consist of all T’s.
Example 21
- Define the proposition $p$ and its negation as follows:
- $p$ : it is raining
- $\sim p$ : it is not raining.
The truth table for $p \vee (\sim p)$ is
$p$ $\sim p$ $p \vee (\sim p)$ T F T F T T Since there are all T’s in the final column $p \vee (\sim p)$ is a tautology.
This result should be obvious as at any given time it is either raining or it is not raining.
End of Example 213.2. Contradiction
A contradiction, or contradictory statement, is never true, under any circumstances. The final column of the corresponding truth table will consist of all F’s.
Example 22
Define the proposition $p$ as in the previous example.
The truth table for $p \wedge (\sim p)$ is
$p$ $\sim p$ $p \wedge (\sim p)$ T F F F T F Since there are all F’s in the final column $p \wedge (\sim p)$ is a contradiction.
Once again the result should be obvious as it cannot be raining and not raining at the same time.
End of Example 223.3. Contingency
A proposition that is neither a tautology nor a contradiction is called a contingency. The final column of the truth table will include both T’s and F’s. For example, $p \wedge q$ .
3.4. Satisfiable
A proposition is satisfiable if the final column of its truth table contains true (T) at least once. For example, $p \wedge q$.
Now attempt the multiple choice exercises to be found here:
-
4. Important Logical Equivalences
The previous section presented several examples of compound propositions that are logically equivalent. When two compound propositions $p$ and $q$, each formed from a finite number of simple propositions $a_1, a_2, \dots , a_n$, are logically equivalent we write $p \equiv q$. Furthermore, two propositions are logically equivalent if and only if they have identical truth tables which requires that $p$ and $q$ have the same truth values for all possible combinations of the $a_1, a_2, \dots , a_n$. We shall look at using truth tables to prove logical equivalence in more detail in Section 6.
The following tables summarise some of the more important logical equivalences where the $p$’s, $q$’s and $r$’s can represent simple or compound propositions.
Here F is a proposition that is always false and T is one that is always true.
Logical Equivalence Name $p \vee T \equiv T$,$p \wedge F \equiv F$ Domination Laws $p \wedge T \equiv p$, $p \vee F \equiv p$ Identity Laws $p \wedge p \equiv p$,$p \vee p \equiv p$ Idempotent Laws $p \; \vee \sim p \equiv T$,$p \; \wedge \sim p \equiv F$ Negation Laws $\sim(\sim p) \equiv p$ Double Negation Law $p \vee q \equiv q \vee p$ Commutative Law for disjunction $p \wedge q \equiv q \wedge p$ Commutative Law for conjunction $(p \vee q) \vee r \equiv p \vee (q \vee r)$ Associative Law for disjunction $(p \wedge q) \wedge r \equiv p \wedge (q \wedge r)$ Associative Law for conjunction $p \vee (q \wedge r) \equiv (p \vee q) \wedge (p \vee r)$
$p \wedge (q \vee r) \equiv (p \wedge q) \vee (p \wedge r)$Distributive Laws $p \wedge (p \vee q) \equiv p$
$p \vee (p \wedge q) \equiv p$Absorption Laws $\sim(p \wedge q) \equiv \;\sim p \; \vee \sim q$
$\sim(p \vee q) \equiv\; \sim p \; \wedge \sim q$De Morgan's Laws Logical Equivalences Involving Conditionals, Biconditionals & Exclusive-Or $p \to q \equiv \; \sim p \vee q$ $p \to q \equiv \; \sim q \to \; \sim p$ $q \to p \equiv \;\sim p \to \;\sim q$ $\sim p \to q \equiv p \vee q$ $\sim (p \to \; \sim q) \equiv p \wedge q$ $\sim (p \to q) \equiv p \; \wedge \sim q$ $p \to (q \wedge r) \equiv (p \to q) \wedge (p \to r)$ $p \to (q \vee r) \equiv (p \to q) \vee (p \to r)$ $(p \vee q) \to r \equiv (p \to r) \wedge (q \to r)$ $(p \wedge q) \to r \equiv (p \to r) \vee (q \to r)$ $p \leftrightarrow q \equiv (q \leftrightarrow p)$ $p \leftrightarrow q \equiv (p \to q) \wedge (q \to p)$ $p \leftrightarrow q \equiv (p \wedge q) \vee (\sim p \; \wedge \sim q)$ $p \leftrightarrow q \equiv \; \sim p \leftrightarrow \; \sim q$ $p \oplus q \equiv (p\; \wedge \sim q) \vee (\sim p \wedge q)$ $p \oplus q \equiv (p\; \vee q) \wedge \sim(p \wedge q)$ $p \oplus q \equiv \; \sim(p \leftrightarrow q)$ $p \oplus q \equiv p \leftrightarrow \; \sim q \equiv \; \sim p \leftrightarrow q$ -
5. From English to symbols and vice-versa
Previously we have seen some examples of propositions written both symbolically and as English sentences. We now look at the process of converting from English to the equivalent symbolic representation and vice versa. Further examples can be found at these locations:
📹 Propositional Logic: Translation, Part 1 (Atomic and Negated Wffs)
📹 Propositional Logic: Translation, Part 2 (Conjunctions)
📹 Propositional Logic: Translation, Part 3 (Disjunctions)
📹 Propositional Logic: Translation, Part 4 (Conditionals)
📹 Propositional Logic: Translation, Part 5 (Biconditionals)
Example 23
- Consider the following propositions:
- $p$ : “Jim goes for a swim”
- $q$ : “The sun is shining”
- $r$ : “It is cold”.
Translate the following expressions to symbolic form:
(i). “Jim goes for a swim and the sun is shining. ”
(ii). “The sun is shining but Jim does not go for a swim.”
(iii). “Jim goes for a swim if and only if it is not cold and the sun is shining.”
(iv). “If the sun is shining and it is not cold, then Jim goes for a swim.”
(v). “It is not the case that Jim goes for a swim if and only if it is cold or the sun is shining.”
(vi). “If Jim does not go for a swim, then the sun is not shining and it is cold.”
(vii). “If Jim goes for a swim, then the sun is shining but if Jim does not go for a swim then the sun is not shining.”
Solution
(i). This compound proposition is the conjunction of, “Jim goes for a swim” $( p )$ and “the sun is shining” $( q )$ .
Hence, in symbolic form we have, $p \wedge q$.
(ii). This compound proposition is the conjunction of, “the sun is shining” $( q )$ and the negation of “Jim goes for a swim” $(\sim p )$ .
Hence, in symbolic form we have, $q \wedge ( \sim p )$.
(iii). This compound proposition involves “if and only if”, so we have a biconditional.
The first proposition is “Jim goes for a swim” $( p )$.
The proposition “it is not cold and the sun is shining” is a conjunction of the negation of “it is cold” $(\sim r )$ and “the sun is shining” $( q )$, which gives $(\sim r ) \wedge q$.
Combining these we obtain, $p \leftrightarrow (\sim r \wedge q )$.
(iv). The compound proposition is an implication.
The hypothesis follows “if” and the conclusion follows “then”.
The hypothesis is a compound proposition, involving the conjunction of, “The sun is shining” $( q )$ and the negation of “It is cold”, $(\sim r )$ giving $q \wedge ( \sim r )$.
The conclusion is, “Jim goes for a swim” $( p )$.
Hence, in symbolic form we have, $[ q \wedge ( \sim r ) ] \to p$.
(v). The use of “not” negates all that follows.
The connective “if and only if” indicates a biconditional.
The first proposition is “Jim goes for a swim” $( p )$.
The compound proposition, “it is cold or the sun is shining” is the disjunction of “it is cold”, $( r )$ and “the sun is shining” $( q )$. In symbols, $r \vee q$.
Combining the above, while remembering to negate, we obtain, $\sim [ p \leftrightarrow ( r \vee q ) ]$.
(vi). The compound proposition is an implication.
The hypothesis follows “if” and the conclusion follows “then”.
The hypothesis is, “Jim does not go for a swim”, $( \sim p )$ .
The conclusion is the compound proposition, “the sun is not shining and it is cold.” which is the conjunction of “the sun is not shining”, $( \sim q )$ and “it is cold” $( r )$. In symbols, $\sim q \wedge r$.
Combining the above we obtain, $\sim p \to (\sim q \wedge r )$.
(vii). The compound proposition is the conjunction (note the use of “but”) of two conditionals. In symbols,
“If Jim goes go for a swim, then the sun is shining” is, $p \to q$ and
“If Jim does not go for a swim then the sun is not shining” is, $\sim p \to \; \sim q$.
Hence, we have $( p \to q ) \wedge ( \sim p \to \; \sim q )$.
End of Example 23Example 24
Define the following propositions:
$p$ : “The referee has blown the final whistle”
$q$ : “We know the result of the match”.
Express the following propositions in the form of English sentences:
(i). $\sim p$ (ii). $\sim q$ (iii). $p \wedge q$ (iv). $p \vee q$
(v). $p \to q$ (vi). $q \to p$ (vii). $q \leftrightarrow p$ (viii). $\sim p \wedge q$.
Solution
(i). “The referee has not blown the final whistle.”
(ii). “We do not know the result of the match.”
(iii). “The referee has blown the final whistle and we know the result of the match.”
(iv). “The referee has blown the final whistle or we know the result of the match.”
(v). “If the referee has blown the final whistle, then we know the result of the match.”
(vi). “If we know the result of the match, then the referee has blown the final whistle.”
(vii). “We know the result of the match if and only if the referee has blown the final whistle.”
(viii). “We know the result of the match but the referee has not blown the final whistle.”
Here we use “but” instead of “and” as it is surely surprising to know the result before the match has ended.
Of course we could equally well have used “and”.
End of Example 24Example 25
Write the following proposition in symbolic form:
(i). “Tom is good at maths and he is good at physics and computing”
(ii). “Tom is good at maths, or he is good at physics, or he is good at computing”
(iii). “Tom is good at maths but it is not true that Tom is good at physics or Tom is good at computing”.
Solution
Define the following propositions:
$p$ : “Tom is good at maths”
$q$ : “Tom is good at physics”
$r$ : “Tom is good at computing”.
(i). The compound proposition, “Tom is good at maths and he is good at physics and computing” is the conjunction of the three simple propositions $p, q$ and $r$. Hence, in symbols we have $p \wedge q \wedge r$, where the associativity of disjunction enables us to omit parentheses. We note here that,
$p \wedge q \wedge r \equiv ( p \wedge q ) \wedge r \equiv p \wedge ( q \wedge r )$.
As we shall see later logical equivalences can be proved using truth tables.
(ii). The compound proposition, “Tom is good at maths, or he is good at physics, or he is good at computing” is the disjunction of the three simple propositions $p, q$ and $r$. Hence, in symbols we have $p \vee q \vee r$ , where the associativity of disjunction enables us to omit parentheses. We note here that,
$p \vee q \vee r \equiv ( p \vee q ) \vee r \equiv p \vee ( q \vee r )$.
As we shall see later logical equivalences can be proved using truth tables.
(iii). We can write,
“Tom is good at physics or Tom is good at computing” symbolically as $q \vee r$.
This expression is negated by the use of the word, “not” and so we write
“It is not true that Tom is good at physics or Tom is good at computing” as $\sim( q \vee r )$.
Recall that “but” can be used as an alternative to “and”.
We can therefore write the original proposition symbolically as, $p\; \wedge [\sim (q\; \vee r)]$.
End of Example 25Example 26
Define the following propositions
$p$ : “Mary is happy”,
$q$ : “Mary sings a song”,
$r$ : “Richard is happy”.
Express the following propositions in the form of English sentences:
(i). $\sim p$
(ii). $p \to q$
(iii). $( p \vee r ) \to q$
(iv). $( p \wedge q ) \to ( \sim r )$
(v). $p \vee ( \sim p \to r )$.
(vi). $\sim r \to ( \sim p \; \wedge \sim q )$.
Solution
(i). Negate the simple proposition $p$ to give, “Mary is not happy”.
(ii). This compound proposition is an implication.
The hypothesis is, “Mary is happy”.
The conclusion is, “Mary sings a song”.
Combining these we obtain, “If Mary is happy, then she sings a song.”
(iii). This compound proposition is an implication.
The hypothesis is the disjunction, $p \vee r$, “Mary is happy or Richard is happy”.
The conclusion is $q$, “Mary sings a song”.
Hence, $( p \vee r ) \to q$ translates as,
“If Mary is happy or Richard is happy, then Mary sings a song”.
(iv). Similar to part (iii) except that the hypothesis involves a conjunction $( p \wedge q )$ and the conclusion is the negation of the simple proposition $r$. Hence, $( p \wedge q ) \to ( \sim r )$ translates as, “If Mary is happy and she sings a song, then Richard is unhappy. ”
(v). This compound proposition is a disjunction where the left disjunct is the simple proposition, “Mary is happy”.
The right disjunct is the implication, “If Mary is not happy, then Richard is happy”
Hence, $p \vee ( \sim p \to r )$ translates as,
“Either Mary is happy or if Mary is not happy then Richard is happy”
(vi). This compound proposition is an implication.
The hypothesis is, “Richard is unhappy”.
The conclusion is a conjunction where the conjuncts are both negations, i.e.
“Mary is unhappy and she does not sing a song”.
Hence, $\sim r \to ( \sim p \; \wedge \sim q )$ translates as,
“If Richard is unhappy, then Mary is unhappy and she does not sing a song”.
End of Example 26Example 27
Define the following propositions
$p$ : “Swimming is safe in the sea”,
$q$ : “Tuna are plentiful in the sea”,
$r$ : “Sharks have been seen in the area”.
Express the following propositions in the form of English sentences.
(i). $q \; \wedge \sim r $ (ii). $r \wedge q$
(iii). $r \to \; \sim p$ (iv). $\sim r \to p$
(v). $q \to ( p \leftrightarrow \; \sim r )$ (vi). $( r ∧ q ) \to \; \sim p$
(vii). $\sim r \wedge ( p \; \wedge \sim q )$ (viii). $\sim p \wedge ( \sim r \wedge q )$.
Solution
(i). “Tuna are plentiful in the sea and sharks have not been seen in the area.”
(ii). “Sharks have been seen in the area but tuna are plentiful in the sea.”
(iii). “If sharks have been seen in the area, then it is not safe to swim in the sea.”
(iv). “If sharks have not been seen in the area, then swimming in the sea is safe.”
Alternatively, note that $\sim r \to p$ is equivalent to, $p$ unless $r$ to obtain:
“Swimming in the sea is safe unless sharks have been seen in the area.”
(v). “If tuna are plentiful in the sea, then swimming is safe if and only if sharks have not been seen in the area.”
(vi). “If sharks have been seen in the area and tuna are plentiful in the sea, then swimming in the sea is not safe.”
Alternatively, note that $( r \wedge q ) \to \; \sim p$ is equivalent to,
$\sim p$ whenever $( r \wedge q )$ to obtain:
“Swimming is not safe in the sea whenever sharks have been seen in the area and tuna are plentiful in the sea.”
(vii). “Sharks have not been seen in the area and swimming in the sea is safe but tuna are not plentiful in the sea.”
(viii). “It is not safe to swim in the sea but sharks have not been seen in the area and tuna are plentiful in the sea.”
End of Example 27Example 28
Determine the negation of the following proposition:
“If it is Friday, then I am going on holiday”.
Solution
- This compound proposition involves two simple propositions:
- $p$ : “It is Friday”
- $q$ : “I am going on holiday”.
The proposition is of the form: $p \to q$ .
The negation of the proposition is: $\sim( p \to q )$.
Note that $\sim( p \to q )$ and $p \; \wedge \sim q$ are logically equivalent, ( see logical equivalence tables).
Hence, the negation of the original proposition is, $p \; \wedge \; \sim q$ which translates to,
“It is Friday and I am not going on holiday.”
End of Example 285.1. Applications of De Morgan’s Laws
De Morgan’s laws can be applied to relate conjunctions and disjunctions through negation of propositions. Before presenting some examples we list a sample of translations of negations from symbolic form to English sentence form.
- (a). $\sim( p \wedge q )$ translates to:
- “Not both $p$ and $q$”
- “It is not the case that both $p$ and $q$”
- “It is not true that both $p$ and $q$”.
- (b). $ \sim p \; \vee \sim q$ translates to:
- “Either not $p$ or not $q$”.
- (c). $\sim( p \vee q )$ translates to:
- “Neither $p$ nor $q$”
- “Not either $p$ or $q$”
- “It is not the case that either $p$ or $q$”
- “It is not true that either $p$ or $q$”
- (d). $\sim p \; \wedge \sim q$ translates to:
- “Not $p$ and not $q$”
- “Both not $p$ and not $q$”.
Example 29
Use De Morgan’s laws to determine the negation of the following propositions:
(i). “John is old and wise”
(ii). “Jane is old or wise”
(iii). “It is wet and windy”.
Solution
- (i). Define
- $p$ : “John is old”
- $q$ : “John is wise”
Proposition: $p \wedge q$.
Negating:$\sim( p \wedge q )$.
Translating:“John is not both old and wise.”
De Morgan’s Law: $\sim( p \wedge q ) \equiv \; \sim p \; \vee \sim q$.
Translating:“John is either not old or not wise.”
- (ii). Define
- $p$ : “Jane is old”
- $q$ : “Jane is wise”.
Proposition: $p \vee q$.
Negating:$\sim( p \vee q )$.
Translating:“It is not the case that Jane is either old or wise.”
De Morgan’s Law: $\sim( p \vee q ) \equiv \; \sim p \; \wedge \sim q$.
Translating:“Jane is not old and not wise.”
- (iii). Define
- $p$ : “It is wet”
- $q$ : “It is windy”.
Proposition: $p \wedge q$.
Negating:$\sim( p \wedge q )$.
Translating:“It is not both wet and windy.”
De Morgan’s Law: $\sim( p \wedge q ) \equiv \; \sim p \; \vee \sim q$.
Translating:“It is either not wet or not windy.”
End of Example 29Example 30
Determine the negation of the following:
“$x$ is even and $y$ is odd”.
Solution
- Define the following:
- $p : “ x$ is even ”
- $q : “ y$ is odd”.
Proposition: $p \wedge q$
Negating:$\sim( p \wedge q )$
Translating:“It is not true that $x$ is even and $y$ is odd”
De Morgan’s Law: $\sim( p \wedge q ) \equiv \; \sim p \; \vee \sim q$
Translating:“$x$ is not even or $y$ is not odd”
Alternatively we can write "$x$ is odd or $y$ is even".
End of Example 30Example 31
Let $x, y$ and $z$ be real numbers. Determine the negation of,
“ $x$ is negative and $y$ and $z$ are positive”.
Solution
- Define the following:
- $p :$ “ $x$ is negative ”
- $q : $“ $y$ is positive ”
- $r :$ “ $z$ is positive ”.
Then write “$x$ is negative and $y$ and $z$ are positive” in symbolic form as, $p \wedge ( q \wedge r )$.
Negating gives, $\sim[ p \wedge ( q \wedge r ) ]$
De Morgan’s Law yields, $\sim p\; \vee \sim ( q \wedge r )$
De Morgan’s Law again, $\sim p \; \vee \sim q \; \vee \sim r$
Translating: “$x$ is not negative or $y$ is not positive or $z$ is not positive”
Alternatively, we can write “ $x \geqslant 0 \;\,\text{or}\;\, y \leqslant 0 \;\, \text{or}\;\, z \leqslant 0 $ ”.
End of Example 31 -
6. Constructing truth tables
In Section 2 we introduced truth tables as a means of listing all the possible truth values of basic compound propositions. We now extend the idea to constructing tables for more complicated propositions that involve combinations of variables, connectives and parentheses. Truth tables are used to prove whether a proposition is a tautology or a contradiction and whether propositions are logically equivalent.
We have seen that given two propositions $p$ and $q$ in a two-valued logic system (T and F) there are four possible combinations (TT, TF, FT, FF) and so the truth table has $2^2 = 4$ rows. If we have three propositions $p, q$ and $r$ there will be eight possible combinations and the table will have $2^3 = 8$ rows. In general, if there are $n$ propositions the table will have $2^n$ rows.
At this link 🔗 Truth Table Generator you can enter propositional logic formulae and generate the corresponding truth tables.
📹 Logic 101 (#11): Truth Tables
📹 Logic 101 (#12): Truth Table Practice
Example 32
Prove that $p \to q$ and $\sim p \vee q$ are logically equivalent by means of a truth table.
Solution
- Write the propositional variables $p$ and $q$ as headers for the first two columns. Complete the first row of the table by writing: $\sim p, \; p \to q$ and $\sim p \vee q$ as headers for the remaining columns.
- The first column, headed $p$, will consist of two T’s followed by two F’s.
- In the second column, headed $q$, alternate T’s and F’s.
- Complete the other three columns using the rules given earlier for negation, implication and disjunction.
$p$ $q$ $\sim p$ $p \to q$ $\sim p \vee q$ T T F T T T F F F F F T T T T F F T T T The final two columns of the table give the truth values for $p \to q$ and $\sim p \vee q$.
The entries in these columns are identical so that the two propositions are logically equivalent, i.e. $p \to q \equiv \; \sim p \vee q$.
An implication can therefore be written using negation and disjunction.
- Note: The following propositions are all logically equivalent to $p \to q$.
- $\sim p \vee q$ ( shown above ),
- $\sim q \to \; \sim p$ ( Can you show this using truth tables? )
- $\sim( p \; \wedge \sim q )$ ( Can you show this using truth tables? ).
End of Example 32Example 33
Show that $p \oplus q \equiv ( p\; \wedge \sim q ) \vee ( \sim p \wedge q )$ using a truth table.
Solution
From earlier we know that the truth table for $p \oplus q$ is,
$p$ $q$ $p \oplus q$ T T F T F T F T T F F F - The table for $( p \; \wedge \sim q ) \vee ( \sim p \wedge q )$ is obtained as follows:
- Write the variables $p, q, \sim p$ and $\sim q$, and the compound propositions $p \; \wedge \sim q$ and $\sim p \wedge q$ in the top row of the table.
- In the column between $p \; \wedge \sim q$ and $\sim p \wedge q$ enter the operator $\vee$ as this will be the final column and will record the truth values for the original proposition, $( p \; \wedge \sim q ) \vee ( \sim p \wedge q )$.
- Complete the columns for $p$ and $q$ at Step 1.
- Complete the columns for $\sim p$ and $\sim q$ at Step 2.
- Complete the columns for the two conjunctions at Step 3.
- Complete the column for the disjunction at Step 4, using the columns from Step 3.
$p$ $q$ $\sim p$ $\sim q$ $p \; \wedge \sim q$ $\vee$ $\sim p \wedge q$ T T F F F F F T F F T T T F F T T F F T T F F T T F F F 1 1 2 2 3 4 3 The highlighted columns in the two truth tables are identical and so $p \oplus q$ and $( p \; \wedge \sim q ) \vee ( \sim p \wedge q )$ are logically equivalent, i.e. $p \oplus q \equiv ( p \; \wedge \sim q ) \vee ( \sim p \wedge q )$.
Note that to save on space the final column only contains the operator $\vee$ but we could equally well have set up a column on the right-hand-side for $( p \; \wedge \sim q ) \vee ( \sim p \wedge q )$ instead.
Exercise
Construct truth tables to show that $p \oplus q$ and $( p \; \vee q )\; \wedge \sim ( p \wedge q )$ are logically equivalent.
End of Example 33Example 34
Determine the truth tables for the compound propositions:
(i). $( p \to q ) \wedge ( p \to r )$
(ii). $p \to ( q \wedge r )$
(iii). Comment on your answers to parts (i) and (ii).
Solution
- (i). In this case there are three proposition variables $p,\, q$ and $r$ and so the table will have $2^3 = 8$ rows to account for all possible combinations of T and F.
- Write the propositional variables $p,\, q$ and $r$ as well as the compound propositions, $p \to q, p \to r$ and $( p \to q ) \wedge ( p \to r )$ in the top row of the table
- The first column, headed $p$, will contain four consecutive T’s followed by four consecutive F’s.
- The second column, headed $q$, will alternate pairs of T’s and pairs of F’s.
- The third column, headed $r$, will alternate T’s and F’s.
- Complete the columns for $p \to q$ and $p \to r$ using the rules for implication.
- Combine the two columns from the previous step using conjunction and write the result in the highlighted (rightmost) column to obtain the truth values for the original proposition.
$p$ $q$ $r$ $p \to q$ $p \to r$ $(p \to q) \wedge (p \to r)$ T T T T T T T T F T F F T F T F T F T F F F F F F T T T T T F T F T T T F F T T T T F F F T T T 1 1 1 2 2 3 The numbers in the final row indicate at which step the corresponding column was completed. For example, the columns for $p, q$ and $r$ are labelled with a “1” indicating they were generated at Step 1. The columns for the two implications are labelled “2” and were completed at Step 2. The final column, labelled “3”, was created at Step 3, using the two columns from Step 2.
(ii). Following a similar procedure to that described in part (i) we now complete the truth table for $p \to ( q \wedge r )$.
$p$ $q$ $r$ $q \wedge r$ $p \to (q \wedge r)$ T T T T T T T F F F T F T F F T F F F F F T T T T F T F F T F F T F T F F F F T 1 1 1 2 3 (iii). The truth values in the highlighted columns in the tables in parts (i) and (ii) are identical and so the propositions $( p \to q ) \wedge ( p \to r )$ and $p \to ( q \wedge r )$ are logically equivalent, i.e. $( p \to q ) \wedge ( p \to r ) \equiv p \to ( q \wedge r )$.
End of Example 34Example 35
Show that the proposition $( p \to q ) \leftrightarrow ( \sim p \vee q )$ is a tautology.
$p$ $q$ $\sim p$ $p \to q$ $\leftrightarrow$ $\sim p \vee q$ T T F T T T T F F F T F F T T T T T F F T T T T 1 1 2 3 4 3 The highlighted column is obtained by combining the columns to its left and right using the biconditional operator. As it consists of all T’s the proposition is a tautology.
Note: In Example 32 we showed that $p \to q$ and $\sim p \vee q$ are logically equivalent and we have now shown that $( p \to q ) \leftrightarrow ( \sim p \vee q )$ is a tautology.
In general, if two logically equivalent propositions are joined by a biconditional $( \leftrightarrow )$ the resulting proposition will be a tautology.
End of Example 35Example 36
Show that the proposition $\sim ( p \wedge q ) \leftrightarrow ( q \wedge p )$ is a contradiction.
$p$ $q$ $p \wedge q$ $\sim(p \wedge q)$ $\leftrightarrow$ $(q \wedge p)$ T T T F F T T F F T F F F T F T F F F F F T F F 1 1 2 3 4 3 The highlighted column is obtained by combining the columns to its left and right using the biconditional operator. As it consists of all F’s the proposition is a contradiction.
End of Example 36Example 37
Determine whether or not $( p \wedge q ) \vee r$ and $p \wedge ( q \vee r )$ are logically equivalent.
Solution
We construct the truth tables for each proposition and compare the final columns. Firstly, the table for $( p \wedge q ) \vee r:$
$p$ $q$ $r$ $p \wedge q$ $\vee$ $r$ T T T T T T T T F T T F T F T F T T T F F F F F F T T F T T F T F F F F F F T F T T F F F F F F 1 1 1 2 3 2 Now construct the truth table for $p \; \wedge ( q \vee r ):$
$p$ $q$ $r$ $p$ $\wedge$ $q \vee r$ T T T T T T T T F T T T T F T T T T T F F T F F F T T F F T F T F F F T F F T F F T F F F F F F 1 1 1 2 3 2 Comparing the highlighted column in each table shows that the truth values are different and so the propositions are not logically equivalent.
This example emphasises the importance of brackets as visually the only difference between the two propositions, $( p \wedge q ) \vee r$ and $p \wedge ( q \vee r )$, is the positioning of the brackets. They are however, not the same.
End of Example 37 -
Summary
In the next block we complete our work on logic.
- We start with an optional section on using the laws of logic to:
- prove compound propositions are logically equivalent,
- prove propositions are tautologies, contradictions, or neither of these,
- simplify compound propositions.
We then introduce the idea of deductive logical arguments and consider some of the most common forms of valid and invalid argument and how to identify them.
The unit closes with a brief look at examples of where logic features in the field of computing, including applications in programming and system specification.
You should now attempt the tutorial questions on GCU Learn.