






















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A set of logical equivalences and examples of their application in propositional logic. Topics such as tautologies, de morgan's laws, and the equivalences (a′)′ ↔a and a∨a ↔a. It also includes exercises and examples for understanding and practicing these concepts.
Typology: Lecture notes
1 / 94
This page cannot be seen from the preview
Don't miss anything!























































































Note: This curriculum is modeled after the text “Mathematical Structures for Computer Science” 6th Edi- tion by Judith Gersting. Exercises are taken directly from the book and many examples are too. This is not to be considered an original work. It is intended only as a resource for students in my section(s) of MATH 374 at the University of South Carolina. The writing is intended to be more conversational and explanatory that what students might encounter in published resources. This difference is intended to increase student understanding.
Suppose you are asked to compute
1 + 2 + · · · + 99 + 100.
How would you do it? One approach might be to grab the nearest calculator and being entering the expression. It might take some time though. As computer science students, you might be tempted to write a function to do this. It might look something like the following.
sum 1 to n(integer n) // compute the sum from one to the given integer n integer our sum = 0 for x in { 1 , 2 ,... , n} : our sum += x print(our sum)
But even this function will perform n calculations. As n grows, so does the amount of time it takes to compute the desired sum. Are there any other ways to compute this sum? As it happens, there is a formula we can use to compute this sum faster than actually adding everything together.
1 + · · · + n =
(n + 1)n 2
How do we know this is actually true? If you test it out for n = 1, n = 2, etc, you will find the identity works. No matter how many choices of n are tried, there are still infinitely many more choices not yet considered. Mathematical identities (and any other mathematical claims) like the one presented here require proof before they are accepted as universally true. So, how do we prove an identity like this, and what does a proof look like? What methods/techniques are there for proving statements like these? How can we determine if a “proof” is actually valid or not? We will answer these questions as the semester progresses. In order to know something like
1 + · · · + n =
(n + 1)n 2
we must prove it is actually true. Before we can learn how to prove statements, we must first learn logic and how to construct well formed arguments. That is where we begin our discussion.
To complete the truth table, we will fill in the final two columns corresponding to A ∧ B and A ∨ B. As a general rule, the conjunction of two statements is only true when the original statements are both true. Moreover, the disjunction of two statements is only false when the original statements are both false. As a result, we complete the truth table in the following way.
A B A ∧ B A ∨ B T T T T T F F T F T F T F F F F
Another important logical connective is implication, denoted with the arrow →. The statement A → B, read “A implies B”, means “if statement A, then statement B”. Here we call A the antecedent, while B is called the consequent. For example, If it is warm outside, then it is sunny would be an implication, where it is warm outside is the antecedent, while it is sunny is the consequent. As with disjuction and conjunction, we can use a truth table to visualize the truth values of A → B and B → A given the truth values of A and B. Generally, the statement A → B is only considered false if A is true and B is false.
A B A → B B → A T T T T T F F T F T T F F F T T
A connective that builds on the notion of implication is equivalence. Equivalence is denoted with an arrow pointing in both directions, A ↔ B, and is shorthand for (A → B) ∧ (B → A) (meaning A implies B and B implies A). Thus, we can build on the truth table given for both implications A → B and B → A to contain the truth value of A ↔ B.
A B A → B B → A A ↔ B T T T T T T F F T F F T T F F F F T T T
The last connective we will discuss presently is negation. Denote by A′, the negation of a statement merely flips its truth value. Thus, the truth table for A′^ is given here.
A A′ T F F T
Using these connectives, we can construct elaborate statements and determine their truth value given the truth value of the original statements, as we have done in the truth tables we have seen so far. On many occasions, we will translate English statements to this setting of formal logic. The following table provides a reference for this translation.
English Phrase Logical Connective Logical Expression and, but, also, in addition, moreover Conjunction A ∧ B or Disjunction A ∨ B If A, then B Implication A → B A implies B A, therefore B A only if B B follows from A A is a sufficient condition for B B is a necessary condition for A A if and only if B Equivalence A ↔ B A is necessary and sufficient for B not A Negation A′ It is false that A It is not true that A
Each of the first four connectives listed in the previous table are called binary connectives because they connect two statements. On the other hand, negation is an example of a unary connective since it operates on a single statement. As an example, the sentence If the rain continues, then the river will flood can be translated to A → B where A represents the statement the rain continues, while B represents the river will flood. With this, we make progress towards building a language/system for discussing formal logic. We have logical connectives ∧, ∨, →, and ↔ which connect two logical statements, and the connective ′^ negates one statement. Thus, we can begin to comprehend how more complex statements should look. For example,
(A ∨ B) → (B ∧ A)
has meaning in our system, whereas A ∨ ∧B →′
does not. An expression that is a legitimate string is called a well-formed formula (or wff for short). Thus, the first above string would be considered a wff while the second would not. As in basic arithmetic, there is an order of precedence when it comes to the operations/connectives. The order is as follows.
Thus, with this ordering, the wff A ∨ B′^ means A ∨ (B′) and not (A ∨ B)′. Furthermore, the wff A ∨ B → C means (A ∨ B) → C and not A ∨ (B → C). Even though we have this ordering, parentheses are often added to provide clarity. The main connective of a wff is the connective which is applied last in the statement. For example, in A ∨ B → C, the implication is the main connective. What about the statement
From here, construct the truth table by making a column for each statement appearing in the tree (be sure not to duplicate columns even if a statement appears multiple times in the tree). The statement corresponding to a “child” node should appear to the left of its parent in the corresponding truth table. If we fill in the true table by considering one column at a time, we get the following.
A B A′^ A ∨ B (A ∨ B) ∧ A′^ (A ∨ B) ∧ A′^ → B T T F T F T T F F T F T F T T T T T F F T F F T
Notice that the truth value of (A ∨ B) ∧ A′^ → B is true no matter the truth values of the statements A and B. We have a special term to describe such statements.
Definition 3. A tautology is a wff which is always true. We use 1 to denote the always true statement.
Definition 4. A contradiction is a wff which is always false. We use 0 to denote the always false statement.
So, we have special terms to describe when a statement is either always true or always false. We also have a term to describe when two different statements always have the same true value.
Definition 5. Statements A and B are said to be logically equivalent (or just equivalent for short) if A → B is a tautology. We denote this with the logical symbol A ⇔ B (not to be confused with the logical connective A ↔ B).
Some common example of logically equivalent statements is given in the following table.
Expression Name for Rule P ∨ Q ⇔ Q ∨ P Commutative - com P ∧ Q ⇔ Q ∧ P (P ∨ Q) ∨ R ⇔ P ∨ (Q ∨ R) Associative - assoc (P ∧ Q) ∧ R ⇔ P ∧ (Q ∧ R) (P ∨ Q)′^ ⇔ P ′^ ∧ Q′^ De Morgan’s Laws - dm (P ∧ Q)′^ ⇔ P ′^ ∨ Q′ P → Q ⇔ P ′^ ∨ Q Implication - imp P ∨ 0 ⇔ P Identity - id P ∧ 1 ⇔ P P ∨ P ′^ ⇔ 1 Complement - comp P ∧ P ′^ ⇔ 0 P ⇔ (P ′)′^ Double Negation - dn P ↔ Q ⇔ (P → Q) ∧ (Q → P ) Definition of equivalence - equ/equi P ∧ (Q ∨ R) ⇔ (P ∧ Q) ∨ (P ∧ R) Distribution - dist P ∨ (Q ∧ R) ⇔ (P ∨ Q) ∧ (P ∨ R)
We mentioned briefly that studying logic will aid in our ability to work with computer science algo- rithms, but how does that work? Here we look at an example. Suppose a block of code contains the following “if” statement.
if ((outflow > inflow) and not ((outflow > inflow) and (pressure < 1000 )))
Is it possible to write this statement in a simpler way? Assign A to the statement “outflow > inflow” and B to “pressure < 1000”. Then the statement considered in the above “if” can be symbolized as A ∧ (A ∧ B)′. To phrase our question in a logical light, can we find a “simpler” statement equivalent to A ∧ (A ∧ B)′? We can, and we will use the equivalence rules in the table above to help. DeMorgan’s Law gives us the following equivalence.
A ∧ (A ∧ B)′^ ⇔ A ∧ (A′^ ∨ B′)
The distributive law gives us another equivalence.
A ∧ (A′^ ∨ B′) ⇔ (A ∧ A′) ∨ (A ∧ B′)
We can use the complement law to simplify.
(A ∧ A′) ∨ (A ∧ B′) ⇔ 0 ∨ (A ∧ B′)
Lastly, the identity law gives the following.
0 ∨ (A ∧ B′) ⇔ A ∧ B′
What this tells us is the statement
if ((outflow > inflow) and not ((outflow > inflow) and (pressure < 1000 )))
(a) If the food is good, then the service is excellent. (b) Either the food is good or the service is excellent. (c) Either the food is good and the service is excellent, or else the price is high. (d) Neither the food is good nor the service excellent. (e) If the price is high, then the food is good and the service is excellent.
A The villain is French. B The hero is American. C The heroine is British. D The movie is good.
Translate the following compound statements into symbolic notation.
(a) The hero is American and the movie is good. (b) Although the villain is French, the movie is good. (c) If the movie is good, then either the hero is American or the heroine is British. (d) The hero is not American, but the villain is French. (e) A British heroine is a necessary condition for the movie to be good.
(a) B ∨ C′ (b) B′^ ∨ (A → C) (c) (C ∧ A′) ↔ B (d) C ∧ (A′^ ↔ B) (e) (B ∧ C′)′^ → A (f) A ∨ (B ∧ C′) (g) (A ∨ B) ∧ C′
(a) (A ∧ B)′^ ↔ B′^ ∨ A′ (b) ((A ∨ B) ∧ C′) → A′^ ∨ C
(a) (A ∧ B′) ∧ C ↔ (A ∧ C) ∧ B′ (b) (A ∨ B) ∧ (A ∨ B′) ↔ A (c) A ∨ (B ∧ A′) ↔ A ∨ B (d) (A ∧ B′)′^ ∨ B ↔ A′^ ∨ B (e) A ∧ (A ∧ B′)′^ ↔ A ∧ B
What is the point of the symbolic representation of compound statements introduced in the previous section? Why do we write out truth tables? Why do we go through the trouble of showing/proving two seemingly different statements are logically equivalent? Ultimately, we want to use these skills to construct proofs for arguments. We want to be able to show that the truth of a set of statements implies the truth of another statement. Symbolically this may look like the following.
P 1 ∧ P 2 ∧ · · · ∧ Pn → Q
Note that the main connective is the →. In this example, the Pi statements are called hypotheses while Q is called the conclusion. This idea provides us with enough background to introduce the most important definition of this section.
Definition 6. A valid argument is an implication of the form P 1 ∧ P 2 ∧ · · · ∧ Pn → Q, where the truth of the hypotheses P 1 , P 2 ,... , Pn imply the truth of the conclusion Q, i.e., the implication P 1 ∧P 2 ∧· · ·∧Pn → Q is a tautology.
The idea here is that we can develop a logical system around the ideas introduced in the previous section to
So, how does this actually work? Let’s consider the following example argument, written out in full English sentences.
George Washington was the first president of the United States. Thomas Jefferson wrote the Declara- tion of Independence. Therefore every day has 24 hours.
If we let A, B, and C represent the statements given by the first, second, and third sentences of the argument respectively, then the argument suggests that A and B together imply C is true. Symbolically, this is A ∧ B → C. To determine if the given argument is valid, we need to check if A ∧ B → C is a tautology. Feel free to write out the entire truth table to check, but we will just consider one row. For example, consider the row where A and B are true, but C is false. Since A and B are true, A ∧ B is true. But, since A ∧ B is true, but C is false, the entire statement, A ∧ B → C is false. Thus, A ∧ B → C is not a tautology, so the argument is not valid. Consider another example.
The second class of rules we have for deriving wffs from others in the proof sequence are called inference rules. These rules are more powerful and allow us to draw conclusions from previous wffs as opposed to only writing equivalent statements. Some of the most basic inference rules are given in the following table.
Hypotheses Conclusion/Inference Name for Rule P , P → Q Q Modus Ponens - mp Q′, P → Q P ′^ Modus Tollens - mt P , Q P ∧ Q Conjunction - conj P ∧ Q P , Q Simplification - simp P P ∨ Q Addition - add
We will see more inference rules soon. Notice that the Washington/Adams argument from earlier is an example of Modus Ponens. So, now we have the tools to construct a proof sequence to show this argument is valid (recall that the symbolization of this argument was (A → B) ∧ A → B).
Notice that in the reasoning, we include the line numbers the inference rule applies to. Here is another example of an argument we can prove using the equivalence and inference rules already presented. We will consider the following argument.
A ∧ (B → C) ∧ ((A ∧ B) → (D ∨ C′)) ∧ B → D
This argument definitely appears more complex than the ones we have seen already. The process for constructing a proof sequence is the same though. First, we start by listing all the hypotheses.
Ultimately, we are trying to logically deduce D, but how exactly do we go about that? There can be many correct ways to construct a proof sequence. You just need to find one. Many tricks to constructing proof comes through practice and being exposed to different examples. This can be difficult to execute, but just keep trying. Eventually it will start making more sense. From here, we can try looking at the statements we already have and seeing if anything fits any of the rules we have. Right away you might see that lines 2 and 4 together fit the modus ponens rule again. We can make another line in our proof sequence utilizing this observation.
From here, we can conjoin lines 1 and 4 and make use of another modus ponens.
Notice that in line 5, we have that C is true. So, we know C′^ must be false. But, line 7 gives us that D ∨ C′ is true, which must mean that D is true (since we just mentioned C′^ was false). So, we can kind of see how to logically navigate to our desired conclusion of D. Here are two different ways we could complete the proof sequence (remember that in many situations, there are multiple correct proof sequences for the same argument).
Option 1:
Option 2:
Notice that the second option uses more steps, but this in no way makes the second option worse than the first way to complete the proof sequence. While we would like to find the “nicest” way to construct a proof sequence, ultimately we are only interested in completing the proof. Over the next couple chapters, we will discover may methods for proving statements. Some are more useful than others in certain situations. We will introduce one such method now, called the deduction method. The deduction method allows us to assume another hypothesis when the desired conclusion is itself an implication. More formally, if we are trying to construct a proof sequence for the argument
P 1 ∧ P 2 ∧ · · · ∧ Pn → Q
then our proof sequence begins by using n lines to list the n hypotheses, namely P 1 , P 2 ,... , Pn. If Q is itself an implication (suppose Q represents the statement R → S), then we can also assume R is true and record it as another hypothesis. The reason for this is a little clever. Remember that an argument is valid if the conclusion follows from the hypotheses, so in this example, we want to show R → S is true. Recall that R → S is false only when R is true and S is false (this comes from the truth table for implication). If R is false, R → S is automatically true, so there is nothing special to prove (in other words, in the case
Right away we see that we can apply modus ponens to lines one and three. Before getting too far ahead of ourselves, we should look at our conclusion and determine where we are trying to go. We want to show F is true. F only appears the second hypothesis, and since it is a disjunction, we need to show H′^ is false. In other words, we want to show H is true. Notice that H also appears in line 1 as the consequent of the implication. But we already said we can apply modus ponens to show H is true. So, we have outlined a proof sequence. We just need to write it all down. Here are the remaining steps.
This is a convenient time to introduce a new inference rule. The inference rule hypothetical syllogism (abbreviated hs) says that if A → B and B → C, then we can deduce that A → C. Here is another proof sequence for the last argument which makes use of this new inference rule.
For exercises 1 and 2, convert the verbal argument to symbols. Which inference rule is illustrated by the argument given?
In exercises 3 and 4, decide what conclusion, if any, can be reached from the given hypotheses and justify your answer.
(A → (B ∨ C)) ∧ B′^ ∧ C′^ → A′
A′^ ∧ B ∧ (B → (A ∨ C)) → C
In Exercises 7 through 9, use propositional logic to prove that the argument is valid. You are permitted to use the third “additional rules” table provided on Blackboard only for question 9.
y < 0. Thus, we have the predicate statement (∃y)Q(y), and it only remains to specify the domain of y. The original English statement gives us the domain of R (all real numbers). Both of the predicates we have seen so far have taken one variable as a parameter. This does not always have to be the case. For example P (x, y) could denote the predicate x − y = 0. Note also that the variables used don’t really matter. In this case, P (x, y) means the same thing as P (a, b) or P (y, z). The variables act only as placeholders (in the same way variables do in other mathematical settings). On the other hand, P (x, x) means something different than P (x, y) as this time the two parameters are the same. The predicates P (a, b), P (x, y), and P (y, z) all meant the same thing because the two parameters were different. In the predicate P (x, x), the parameters are now the same, removing the freedom to have different values in different coordinates. We defined propositional wffs in the last section, and here we define predicate wffs. As with propo- sitional wffs, it is difficult to enumerate all the rules these statements must follow to be considered wffs, but we provide some examples of predicate wffs.
Notice the use of additional brackets in the last example. Like with other mathematical expressions, brack- ets and parentheses are used to group parts of the expression together. In propositional logic statements, we saw parentheses used to trump the order of operations. We also have that here, but more commonly, parenthesis will be used to help define the scope of a quantifier. Recall we always place a quantifier- variable pair in parentheses. When no parentheses/brackets immediately follow the quantifier-variable pair, the quantifier only applies to the predicate immediately following it. For example, in the expression (∃x)S(x) ∨ (∀y)T (y), the existential quantifier on x only applies to the predicate S(x) and the universal quantifier on y only applies to the predicate T (y). On the other hand, if grouping symbols follow a quan- tifier, the quantifier applies to the entire statement inside the grouping symbol. Thus, in the last example, the universal quantifier on x applies to the entire implication P (x) → Q(x). Another important concept for predicate wffs is the notion of free variables. A free variable is a variable occurring outside the scope of all quantifiers. In the first example, notice the use of variables x and y, but there is no quantifier in the statement. These are free variables. Consider this example.
(∀x)[Q(x, y) → (∃y)R(x, y)]
The scope of the universal quantifier on x is the entire statement Q(x, y) → (∃y)R(x, y), while the scope of the existential quantifier on y is the predicate R(x, y). Notice how the predicate Q(x, y) contains the variable y but there is no quantifier to govern the existence of this y. In this case, the y appearing in Q(x, y) is free. We mentioned earlier how the truth value of a predicate statement can depend on the domain of variables assigned. More concretely, the truth value of a predicate wff actually depends on a couple more things. Together, these aspects are called an interpretation of a predicate wff. An interpretation contains the following three assignments.
Consider the following predicate wff as an example.
(∃x)S(x) ∧ (∀y)T (y)
Consider the following interpretations for this wff.
We introduced earlier translating English statements into predicate wffs. This should come with a warning that this can be tricky (making this translation for propositional wffs was relatively straightforward
Notice that in all three statements, the only difference is the placement of “only”. We translate each to a predicate wff, but if you look at our table of English words that correspond to different connectives, none of them appear in our sentences. It can be helpful to rewrite the sentence so some of these words appear, but be careful not to change the meaning. Take note of the vast difference between the following sentences (where the first statement here is equivalent to the first above, etc.).
Now we could define predicates and domains of variables to turn all three statements into their correspond- ing implications, but we omit that here (I encourage you to do it as an exercise on your own). We continue this section with a couple basic equivalence/inference rules for predicate statements (in preparation for the predicate logic coming in the next section). Recall De Morgan’s laws from propositional logic. These define how negation distributes over disjunction and conjunction (the connective flips between the two). As you might have guessed, the same “flipping” happens for negation of quantifiers. Suppose we have the predicate A(x). Then
[(∀x)A(x)]′^ ⇔ (∃x)A(x)′^ [(∃x)A(x)]′^ ⇔ (∀x)A(x)′