Chap1-Propositional Logic
Chap1-Propositional Logic
The truth
Discrete Structures I value of a proposition is true, denoted by T , if it is a true proposition, and the truth
Propositional Logic value of a proposition is false, denoted by F , if it is a false proposition.
Departement of Computer Science – IT College – University of Bahrain The area of logic that deals with propositions is called the propositional calculus or
Dr. Amine Mahjoub, Dr. Mohamed Mazin – 2022-2023 – Semester 1 propositional logic.
We now turn our attention to methods for producing new propositions from those
that we already have. Many mathematical statements are constructed by combining
1 Introduction one or more propositions. New propositions, called compound propositions, are
formed from existing propositions using logical operators.
The rules of logic give precise meaning to mathematical statements. These rules Definition 2. Let p be a proposition. The negation of p, denoted by ¬p (also denoted
are used to distinguish between valid and invalid mathematical arguments. by p̄), is the statement : ”It is not the case that p”.
Besides the importance of logic in understanding mathematical reasoning, logic has The proposition ¬p is read ”not p” The truth value of the negation of p, ¬p, is the
numerous applications to computer science. These rules are used in the design of opposite of the truth value of p.
computer circuits, the construction of computer programs, the verification of the
Examples : Find the negation of the following propositions and express them in
correctness of programs, and in many other ways. Furthermore, software systems
simple English.
have been developed for constructing some, but not all, types of proofs automatically.
1. p =”Michael’s PC runs Linux” :
Solution : The negation is ”It is not the case that Michael’s PC runs Linux”.
2 Propositional Logic This negation can be more simply expressed as ”Michael’s PC does not run
Linux”.
Definition 1. A proposition is a declarative sentence (that is, a sentence that de- ¬p = ”Michael’s PC does not run Linux”.
clares a fact) that is either true or false, but not both. 2. q = ”Vandana’s smartphone has at least 32 GB of memory”
Solution : ”It is not the case that Vandana’s smartphone has at least 32 GB of
Example 1 : All the following declarative sentences are propositions. memory” or
1. Washington, D.C., is the capital of the United States of America. simply ”Vandana’s smartphone does not have at least 32 GB of memory, or
2. Toronto is the capital of Canada. more simple
q = ”Vandana’s smartphone has less than 32 GB of memory”.
3. 1 + 1 = 2
3. r = ”At least 10 inches of rain fell today in Manama”
4. 2 + 2 = 3 ¬r = ”Less than 10 inches of rain fell today in Manama”.
Propositions 1 and 3 are true, whereas 2 and 4 are false. The negation of a proposition can also be considered the result of the operation of
Example 2 : Consider the following sentences : the negation operator (¬) on a proposition. The negation operator constructs a new
1. What time is it ? proposition from a single existing proposition.
2. Read this carefully.
Table 1 displays the truth table for the negation of a proposition p. This table has a
3. x + 1 = 2. row for each of the two possible truth values of a proposition p. Each row shows the
4. x + y = z. truth value of ¬p corresponding to the truth value of p for this row.
Sentences 1 and 2 are not propositions because they are not declarative sentences.
Sentences 3 and 4 are not propositions because they are neither true nor false. Note We will now introduce the logical operators that are used to form new proposi-
that each of sentences 3 and 4 can be turned into a proposition if we assign values tions from two or more existing propositions. These logical operators are also called
to the variables. connectives
We use letters to denote propositional variables (or statement variables), that is, Definition 3. Let p and q be propositions. The conjunction of p and q, denoted by
variables that represent propositions, just as letters are used to denote numerical p ∧ q, is the proposition ”p and q” . The conjunction p ∧ q is true when both p and q
variables. are true and is false otherwise
1
p ¬p p q p∨q
T F T T T
F T T F T
F T T
Table 1 – Truth table for the negation of a proposition
F F F
Table 2 displays the truth table of p ∧ q. This table has a row for each of the four Table 3 – The Truth Table for the Disjunction of Two Propositions.
possible combinations of truth values of p and q. The four rows correspond to the
pairs of truth values T T , T F , F T , and F F , where the first truth value in the pair is
the truth value of p and the second truth value is the truth value of q. The disjunction of these propositions, p ∨ q, is the proposition ”Today is Friday or
it is raining today”. This proposition is true on any day that is either a Fridays or a
rainy day (including rainy Friday).It is false only on days that are not Fridays when
p q p∧q
it is also does not rain.
T T T
T F F The use of the connective or in a disjunction corresponds to one of the two ways
F T F the word or is used in English, namely, as an inclusive or. A disjunction is true when
F F F at least one of the two propositions is true. For instance, the inclusive or is being
used in the statement ”Students who have taken calculus or computer science can
Table 2 – The Truth Table for the Conjunction of Two Propositions. take this class”. Here, we mean that students who have taken both calculus and
computer science can take the class, as well as the students who have taken only one
of the two subjects.
Note that in logic the word ”but” sometimes is used instead of ”and” in a conjunc-
tion. For example, the statement ”The sun is shining, but it is raining” is another However, when a menu at a restaurant states, ”Soup or salad comes with an entrée”
way of saying ”The sun is shining and it is raining.” (In natural language, there is the restaurant almost always means that customers can have either soup or salad,
a subtle difference in meaning between ”and” and ”but” ; we will not be concerned but not both. Hence, this is an exclusive, rather than an inclusive, or.
with this nuance here.)
Example : Find the conjunction of the propositions p and q where p is the Definition 5. Let p and q be propositions. The exclusive or of p and q, denoted by
proposition ”Today is friday” and q is the proposition ”It is raining today”. p ⊕ q, is the proposition that is true when exactly one of p and q is true and is false
otherwise.
The conjunction of these propositions, p ∧ q, is the proposition ”Today is Friday and
it is raining today”. This proposition is true on rainy Fridays and is false on any day The truth table for the exclusive or of two propositions is displayed in Table 4.
that is not a Friday and on Fridays when it does not rain.
p q p⊕q
Definition 4. Let p and q be propositions. The disjunction of p and q, denoted by T T F
p ∨ q, is the proposition ”p or q” . The conjunction p ∨ q is false when both p and q
are false and is true otherwise T F T
F T T
F F F
Table 3 displays the truth table for p ∨ q.
Example : Find the disjunction of the propositions p and q where p is the Table 4 – The Truth Table for the Exclusive or of Two Propositions.
proposition ”Today is Friday” and q is the proposition ”It is raining today”.
2
Exercises : p q p→q
T T T
Question 1. Which of these sentences are propositions ? What are the truth values T F F
of those that are propositions ?
F T T
1. Boston is the capital of Massachusetts. F F T
2. Miami is the capital of Florida.
Table 5 – The Truth Table for the Conditional Statement.
3. 2 + 3 = 5.
4. 5 + 7 = 10.
5. x + 2 = 11. The statement p → q is called a conditional statement because p → q asserts that
q is true on the condition that p holds. A conditional statement is also called an
6. Answer this question.
implication. The truth table for the conditional statement p → q is shown in Table
7. Do not pass go. 5 . Note that the statement p → q is true when both p and q are true and when p is
8. What time is it ? false (no matter what truth value q has).
9. There are no black flies in Maine. Because conditional statements play such an essential role in mathematical reaso-
10. 4 + x = 5. ning, a variety of terminology is used to express p → q. You will encounter most if
11. The moon is made of green cheese. not all of the following ways to express this conditional statement. These different
ways are displayed in the table 6.
12. 2n ≥ 100.
”if p, then q” ”p implies q”
Question 2. What is the negation of each of these propositions ?
”if p, q” ”p only if q”
1. Mei has an MP3 player. ”p is sufficient for q” ”a sufficient condition for q is p”
2. There is no pollution in New Jersey. ”q if p” ”q whenever p”
3. 2 + 1 = 3 ”q when p” ”q is necessary for p”
4. The summer in Maine is hot and sunny. ”a necessary condition for p is q” ”q follows from p”
5. Jennifer and Teja are friends. ”q unless ¬p”
3
”Maria will find a good job.” Express the statement p → q as a statement in p q p↔q
English : By definition p → q is expressed : ”If Maria learns discrete mathematics, T T T
then she will find a good job.”.
T F F
But, there are many other ways to express this conditional statement in English.
Among the most natural of these are : F T F
”Maria will find a good job when she learns discrete mathematics.” F F T
”For Maria to get a good job, it is sufficient for her to learn discrete mathematics.”
”Maria will find a good job unless she does not learn discrete mathematics.” Table 7 – The Truth Table for the biconditional statement.
Remark :
Note that the way we have defined conditional statements is more general than the Example :
meaning attached to such statements in the English language. Let p be the statement ”You can take the flight”,and let q be the statement ”You
Example : the proposition ”If today is Friday, then 2 + 3 = 6” is true for every day buy a ticket”. Then p ↔ q is the statement : ”You can take the flight if and only if
except for Friday. you buy a ticket”.
4
is built up. The truth values of the compound proposition for each combination of Operator Precedence
truth values of the propositional variables in it is found in the final column of the ¬ 1
table.
∧ 2
Example :
Construct the truth table of the compound proposition (p ∨ ¬q) → (p ∧ q). ∨ 3
Because this truth table involves two propositional variables p and q, there are four → 4
rows in this truth table, one for each of the pairs of truth values T T , T F , F T , and ↔ 5
F F . The first two columns are used for the truth values of p and q, respectively. In
the third column we find the truth value of ¬q, needed to find the truth value of Table 9 – Precedence of Logical Operators.
p ∨ ¬q, found in the fourth column. The fifth column gives the truth value of p ∧ q.
Finally, the truth value of (p∨¬q) → (p∧q) is found in the last column. The resulting
truth table is shown in Table 8.
them.
p q ¬q p ∨ ¬q p∧q (p ∨ ¬q) → (p ∧ q) Given a sentence in English, the process consists to decompose the whole sentence in
a set of elementary part such that each part (elementary sentence) declares (contains)
T T F T T T only one fact.
T F T T F F Then, represent each part by a propositional variable and choose the wright (appro-
F T F F F T priate) logical operators between them to compose the whole meaning of the sentence.
F F T T F F Examples :
1. Consider the sentences : ”it is below freezing and snowing”, ”it is below freezing
Table 8 – The Truth Table of (p ∨ ¬q) → (p ∧ q). but not snowing”. Let consider the propositional variables : p =”it is below
freezing” and q =”it is raining”. So we can wright : p ∧ q, p ∧ ¬q.
2. How can this English sentence be translated into a logical expression ? ”You
can access the Internet from campus only if you are a computer science major
Precedence of Logical Operators We can construct compound propositions or you are not a freshman.” we let a, c, and f represent ”You can access the
using the negation operator and the logical operators defined so far. We will gene- Internet from campus”, ”You are a computer science major”, and ”You are a
rally use parentheses to specify the order in which logical operators in a compound freshman” respectively.
proposition are to be applied. For instance, (p ∨ q) ∧ (¬r) is the conjunction of p ∨ q a → c ∨ ¬f .
and ¬r. However, to reduce the number of parentheses, we specify that the negation
operator is applied before all other logical operators. This means that ¬p ∧ q is the
conjunction of¬p and q, namely, (¬p) ∧ q, not the negation of the conjunction of p 5 Propositional Equivalences
and q, namely ¬(p ∧ q).
Table 9 displays the precedence levels of the logical operators : ¬, ∧, ∨, →, and ↔. Definition 9. A compound proposition that is always true, no matter what the truth
values of the propositional variables that occur in it, is called a tautology.A compound
proposition that is always false is called a contradiction. A compound proposition that
4 Translating English Sentences is neither a tautology nor a contradiction is called a contingency.
Example :
There are many reasons to translate English sentences into expressions involving
propositional variables and logical connectives. In particular, English (and every other Definition 10. The compound propositions p and q are called logically equivalent if
human language) is often ambiguous. Translating sentences into compound state- p ↔ q is a tautology. The notation p ≡ q denotes that p and q are logically equivalent.
ments (and other types of logical expressions, which we will introduce later in this
chapter) removes the ambiguity. Once we have translated sentences from English into Examples :
logical expressions we can analyze these logical expressions to determine their truth Using truth table, show that :
values, we can manipulate them, and we can use rules of inference to reason about 1. ¬(p ∨ q) and (¬p ∧ ¬q) are logically equivalent.
5
p ¬p p ∨ ¬p p ∧ ¬p 6 Constructing New Logical Equivalences
T F T F
The established logical equivalences, can be used to construct additional logical
F T T F
equivalences. The reason for this is that a proposition in a compound proposition
can be replaced by a compound proposition that is logically equivalent to it without
Table 10 – Example Tautology, Contradiction
changing the truth value of the original compound proposition.
Examples : Without using a truth table,
2. p → qand ¬p ∨ q are equivalent. 1. Show that ¬(p → q) and p ∧ ¬q are logically equivalent.
3. p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are equivalent. 2. Show that (p ∧ q) → (p ∨ q) is a tautology.
4. p → q and ¬q → ¬p are equivalent. 3. Show that ¬(p ∨ (¬p ∧ q)) ≡ (¬p ∧ ¬q)
Consider the sentence ”if it snows today, then i will ski tomorrow”. This sentence is 4. Show that (p ∧ q) → p is tautology
equivalent to ”it does not ski today or i will ski tomorrow”.
5. Show that ¬p → (p → q) is tautology
Exercise : Give the OR form of the different conditional statements proposed in the
exercise 1.
7 Exercises
Theorem 1 (DeMorgan Law’s).
Exercise 1 :
¬(p ∧ q) ≡ ¬p ∨ ¬q
Consider the following propositions :
¬(p ∨ q) ≡ ¬p ∧ ¬q d = :”You drop the cup”
b = :”The cup will break”
Proof : t = :”The cup will fall over the blanket
Show, using truth table : c = :”The cat will run away with blanket
1. ¬(p ∧ q) and ¬p ∨ ¬q are equivalent. Answer the following :
2. ¬(p ∨ q) and ¬p ∧ ¬q are equivalent. Question 1. Give the statement ¬b −→ ¬d ∧ ¬c in English using whenever.
Examples : Question 2. Give the inverse in symbolic form for the statement :
Use De Morgan’s laws to express the negations of ”Miguel has a cellphone and he A necessary condition for you drop the cup and the cup will not break is the cat will
has a laptop computer” and ”Heather will go to the concert or Steve will go to the not run a way with blanket and the cup will fall over the blanket.
concert”.
Question 3. Give the converse in English for the following statement c ∨ ¬t −→ b
Let p be ”Miguel has a cellphone” and q be ”Miguel has a laptop computer”. Then Question 4. Give the symbolic for : ”the cup will break unless it will fall over the
”Miguel has a cellphone and he has a laptop computer” can be represented by p ∧ q. blanket and the cat will not run aways with blanket”.
By the first of De Morgan’s laws, ¬(p ∧ q) is equivalent to ¬p ∨ ¬q. Consequently,
Question 5. Give the English using unless : d ∧ b −→ ¬t ∨ c
we can express the negation of our original statement as ”Miguel does not have a
cellphone or he does not have a laptop computer.” Question 6. Give the negation in symbolic form for the following statement using
(and,or , and) only.
Let r be ”Heather will go to the concert” and s be ”Steve will go to the concert”. Then the cat run a way with blanket or you do not drop the cup is sufficient for the the
”Heather will go to the concert or Steve will go to the concert” can be represented cup will not break.
by r ∨ s. By the second of De Morgan’s laws, ¬(r ∨ s) is equivalent to ¬r ∧ ¬s.
Question 7. Give the negation in English : ¬b −→ t ∧ ¬c
Consequently, we can express the negation of our original statement as ”Heather will
not go to the concert and Steve will not go to the concert”. Question 8. Give in English using only if : (¬d ∨ ¬b) ∨ ¬t.
6
Question 9. Write the symbolic Or form : you do not drop the cup unless neither Question 2. State each of these conditional statements is a tautology or not
the cup will break nor it will fall over the blanket. 1. (¬p ∧ (p ∨ q)) → q
Question 10. Write in English the contrapositive for : 2. (p ∧ q) → r ↔ (p → r) ∧ (q → r)
the cat will not run a way with blanket or you will not drop it is necessary for the
the cup will not break and it will not fall over the blanket Exercise 4 :
Exercise 2 : Question 1. The father said :”The baby will cry unless you give him food or play
with him”. The mother said : your wrong the right statement is ”You neither play
Let p, q, r, s denote the following statements : with baby nor give him food or the baby will cry”.
p : Jack ate the apple.
q : Jack ate the candy. Is the father statement the same as the mother or not ?
r : Jack is hungry.
s : Jack is wise. Question 2. Ahmed has two sons Adel and Kareem. Ahmed said to his sons ”the
Answer the following cat will neither chase nor eat the mouse unless the mouse will squeak”. Adel told
his mother, my father said ”A necessary condition for the cat either chase or eat the
Question 1. Write in English using follows form for : p ∧ ¬q −→ s ∨ r. mouse is he will not squeak”. However Kareem told his mother, my father said ”the
Question 2. Write the symbolic for : Jack neither hungery nor wise if he ate neither mouse will squeak is sufficient for the cat to neither eat nor chase the cat”.
the apple nor the candy.
Find out who told his mother the correct statement the father said.
Question 3. Rewrite part (2) using unless.
Question 4. Write the inverse in English using A sufficient condition for : r ∧ q −→ Exercise 5 :
¬s.
Question 1. Show that (p∧q) → r and (p → r)∧(q → r) are not logically equivalent.
Question 5. Write the converse in symbolic of : Jack did not eat the candy unless
he is either hungry or not wise . Question 2. Show whether the following are logically equivalent or not.
p −→ r ∨ q and p ∧ q −→ r
Question 6. Write the negation in English. Do not use ”it is not the case” :A
necessary condition for jack did not eat both the candy and the apple is he is not Question 3. Prove using logical equivalence (law) that (p ∧ q) ∧ (p → r) → (q ∨ r)
hungry or not wise . is a tautology.
Question 7. Write the contrapositive using implies : p ∧ q −→ r ∧ ¬s. Question 4. Show that p −→ q ←→ ¬q −→ ¬p is a tautology
Question 8. Write the or form in English : Jack ate the candy but did not eat the Question 5. Show by truth a assignment that ¬p ∧ ¬q ←→ r ⊕ ¬s is not equivalent
apple unless he is wise and not hungry . to
[(¬r ∨ s) ∧ (r ∨ ¬s) ∨ (¬p ∧ ¬q)] ∧ [p ∨ q −→ (r ∨ ¬s) ∧ ¬(r ∧ ¬s)]
Question 9. Give the symbolic for :Jack ate both the apple and the candy whenever
he is not hungry but wise .
Exercise 3 :