Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Discrete Structures CMSC 2123 1.1 Propositional Logic Definition 0 Example 1.1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Discrete Structures Lecture 1

CMSC 2123 1.1 Propositional Logic

DEFINITION 0 A proposition is a declarative sentence that is either true or false but not
both.

EXAMPLE 1.1 The following is a declarative sentence.


Washington D.C. is the capital of the United States of America.
True.

EXAMPLE 1.2 The following is a declarative sentence.


Toronto is the capital of Canada.
False

EXAMPLE 1.3 The following is a declarative sentence.


One plus one equals two. 1 + 1 = 2.
True

EXAMPLE 1.4 The following is a declarative sentence.


Two plus two equals three. 2 + 2 = 3.
False

EXAMPLE 2.1 The following is not a declarative sentence because the sentence is not a
statement of a fact. The sentence is a question.
What time is it?

EXAMPLE 2.2 The following is not a declarative sentence because the sentence is not a
statement of a fact. The sentence is a command.
Read this carefully.

EXAMPLE 2.3 The following is not a declarative sentence because the sentence cannot be
shown to be either true or false.
𝑥𝑥 + 1 = 2

EXAMPLE 2.4 The following is not a declarative sentence because the sentence cannot be
shown to be either true or false.
𝑥𝑥 + 𝑦𝑦 = 𝑧𝑧

1
Discrete Structures Lecture 1
CMSC 2123 1.1 Propositional Logic

DEFINITION 1 Let p be a proposition. The negation of p, denoted by ¬𝑝𝑝 (also denoted by


𝑝𝑝), is the statement “It is not the case that p.”

The proposition ¬𝑝𝑝 is read “not p.” The truth value of the negation of p, ¬𝑝𝑝,
is the opposite of the truth value of p.

EXAMPLE 3 Find the negation of the proposition

“Michael’s PC runs Linux.”

and express this in simple English.

Solution: The negation is:

“It is not the case that Michael’s PC runs Linux.”

This negation can be more simply expressed by

“Michael’s PC does not run Linux.”

EXAMPLE 3.1 Find the negation of the proposition

“Today is Friday.”

and express this in simple English.

Solution: The negation is:

“It is not the case that today is Friday.”

This negation can be more simply expressed by

“Today is not Friday.”

2
Discrete Structures Lecture 1
CMSC 2123 1.1 Propositional Logic

EXAMPLE 4 Find the negation of the proposition

“Vandana’s smartphone has at least 32GB of memory.”

and express this in simple English.

Solution: The negation is:

“It is not the case that Vandana’s smartphone has at least 32GB of
memory.”

This negation can also be expressed by

“Vandana’s smartphone does not have at least 32GB of memory.”

or even more simply as


“Vandana’s smartphone has less than 32GB of memory.”

EXAMPLE 4.1 Find the negation of the proposition

“At least 10 inches of rain fell today in Miami.”

and express this in simple English.

Solution: The negation is:

“It is not the case that at least 10 inches of rain fell today in Miami.”

This negation can be more simply expressed by

“Less than 10 inches of rain fell today in Miami.”

REMARK Table 1 displays the truth table for the negation of a proposition p. This table
has a row for each of the two possible truth values of a proposition p. Each
row shows the truth value of ¬𝒑𝒑 corresponding to the truth value of 𝒑𝒑 for
this row.

TABLE 1 The Truth Table for the


Negation of a Proposition
𝒑𝒑 ¬𝒑𝒑
T F
F T

3
Discrete Structures Lecture 1
CMSC 2123 1.1 Propositional Logic

REMARK • The negation of a proposition can also be considered the result of the
operation of the negation operator on a proposition.
• The negation operator constructs a new proposition from a single
existing proposition.
• We will now introduce the logical operators that are used to form new
propositions from two or more existing propositions.
• The logical operators are also called connectives.

DEFINITION 2 Let p and q be propositions. The conjunction of p and q, denoted by 𝑝𝑝 ∧ 𝑞𝑞, is


the proposition “p and q.” The conjunction 𝑝𝑝 ∧ 𝑞𝑞 is true when both p and q
are true and is false otherwise.

TABLE 2 The Truth Table for the Conjunction of


Two Propositions
𝒑𝒑 𝒒𝒒 𝒑𝒑 ∧ 𝒒𝒒
T T T
T F F
F T F
F F F

EXAMPLE 5 Find the conjunction of the propositions p and q where p is the proposition
“Today is Friday” and q is the proposition “It is raining today.”
Solution: The conjunction of these propositions, 𝑝𝑝 ∧ 𝑞𝑞, is the proposition

“Today is Friday and it is raining today.”

This proposition is true on rainy Fridays and is false on any day that is not a
Friday and on Fridays when it does not rain.

DEFINITION 3 Let p and q be propositions. The disjunction of p and q, denoted by 𝑝𝑝 ∨ 𝑞𝑞, is


the proposition “p or q.” The disjunction 𝑝𝑝 ∨ 𝑞𝑞 is false when both p and q
are false and is true otherwise.

TABLE 3 The Truth Table for the Disjunction of


Two Propositions
𝒑𝒑 𝒒𝒒 𝒑𝒑 ∨ 𝒒𝒒
T T T
T F T
F T T
F F F

4
Discrete Structures Lecture 1
CMSC 2123 1.1 Propositional Logic

EXAMPLE 6 Find the disjunction of the propositions p and q where p is the proposition
“Today is Friday” and q is the proposition “It is raining today.”
Solution: The disjunction of these propositions, 𝑝𝑝 ∨ 𝑞𝑞, is the proposition

“Today is Friday or it is raining today.”

This proposition is true on any day that is either a Friday or a rainy day
(including rainy Fridays). It is only false on days that are not Fridays when it
also does not rain.

DEFINITION 4 Let p and q be propositions. The exclusive or of p and q, denoted by 𝑝𝑝⨁𝑞𝑞, is


the proposition that is true when exactly one of p and q is true and is false
otherwise.

TABLE 4 The Truth Table for the Exclusive OR of


Two Propositions
𝒑𝒑 𝒒𝒒 𝒑𝒑⨁𝒒𝒒
T T F
T F T
F T T
F F F

Conditional Statements
DEFINITION 5 Let p and q be propositions. The conditional statement, 𝑝𝑝 → 𝑞𝑞, is the
proposition “if p, then q.” The conditional statement 𝑝𝑝 → 𝑞𝑞 is false when p
is true and q is false, and true otherwise. In the conditional statement 𝑝𝑝 →
𝑞𝑞, p is called the hypothesis (or antecedent or premise) and q is called the
conclusion (or consequence).

TABLE 5 The Truth Table for the Conditional


Statement of Two Propositions
𝒑𝒑 𝒒𝒒 𝒑𝒑 → 𝒒𝒒
T T T
T F F
F T T
F F T

• The statement 𝑝𝑝 → 𝑞𝑞 is called a conditional statement because 𝑝𝑝 → 𝑞𝑞 asserts that q is true


on the condition that p holds. A conditional statement is also called an implication.

5
Discrete Structures Lecture 1
CMSC 2123 1.1 Propositional Logic

“if p, then q” “p implies q”


“if p, q” “p only if q”
“p is sufficient for q” “a sufficient condition for q is p”
“q if p” “q whenever p”
“q when p” “q is necessary for p”
“a necessary condition for p is q” “q follows from p”
“q unless ¬ 𝑝𝑝”
Figure 1. Alternative phrases for
𝒑𝒑 → 𝒒𝒒

EXAMPLE 7 Let p be the statement “Maria learns discrete mathematics” and q the
statement “Maria will find a good job.” Express the statement 𝑝𝑝 → 𝑞𝑞 as a
statement in English.
Solution: From the definition of conditional statements, we see that when p
is the statement Maria learns discrete mathematics” and q is the statement
“Maria will find a good job,” 𝑝𝑝 → 𝑞𝑞 represents the statement

“If Maria learns discrete mathematics, then she will find a good job.”

Alternatively:
“Maria will find a good job when she learns discrete mathematics.”

“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.”

EXAMPLE 8 What is the value of the variable x after the statement

if 2 + 2 = 4 then 𝑥𝑥 ≔ 𝑥𝑥 + 1

if 𝑥𝑥 = 0 before this statement is encountered? (The symbol ≔ stands for


assignment. The statement 𝑥𝑥 ≔ 𝑥𝑥 + 1 means the assignment of the value
𝑥𝑥 + 1 to 𝑥𝑥.)
Solution: Because 2 + 2 = 4 is true, the assignment statement 𝑥𝑥 ≔ 𝑥𝑥 + 1 is
executed. Hence 𝑥𝑥 has the value 0 + 1 = 1 after this statement is
encountered.

6
Discrete Structures Lecture 1
CMSC 2123 1.1 Propositional Logic

CONVERSE, CONTRAPOSITIVE, AND INVERSE

Implication 𝑝𝑝 → 𝑞𝑞 if p, then q
Converse of 𝑝𝑝 → 𝑞𝑞 𝑞𝑞 → 𝑝𝑝 if q, then p
Contrapositive 𝒑𝒑 → 𝒒𝒒 ¬𝒒𝒒 → ¬𝒑𝒑 if not q, then not p
Inverse 𝑝𝑝 → 𝑞𝑞 ¬𝑝𝑝 → ¬𝑞𝑞 if not p, then not q

• Only the contrapositive ¬𝒒𝒒 → ¬𝒑𝒑, has the same truth values as the implication 𝑝𝑝 → 𝑞𝑞.
• When two compound propositions have the same truth values they are called equivalent.
Equivalence is denoted by the operator ≡.

EXAMPLE 9 What are the contrapositive, the converse, and the inverse of the conditional
statement

“The home team wins whenever it is raining.”?


Solution: Because “𝑞𝑞 whenever 𝑝𝑝” is one of the ways to express the
conditional statement 𝑝𝑝 → 𝑞𝑞, the original can be rewritten as

“If it is raining, then the home team wins.”

contrapositive ¬𝑞𝑞 → ¬𝑝𝑝 “If the home team does not win, then it is not
raining.”
converse 𝑞𝑞 → 𝑝𝑝 “If the home team wins, then it is raining.”
inverse ¬𝑝𝑝 → ¬𝑞𝑞 “If it is not raining, then the home team does
not win.”
Note: Only the contrapositive is equivalent to the original statement.

DEFINITION 6 Let p and q be propositions. The biconditional statement, 𝑝𝑝 ↔ 𝑞𝑞, is the


proposition “p if and only if q.” The biconditional statement 𝑝𝑝 ↔ 𝑞𝑞 is true
when 𝑝𝑝 and 𝑞𝑞 have the same truth values, and is false otherwise.
Biconditional statements are also called bi-implications.

TABLE 6 The Truth Table for the Biconditional


𝒑𝒑 ↔ 𝒒𝒒.
𝒑𝒑 𝒒𝒒 𝒑𝒑 ↔ 𝒒𝒒
T T T
T F F
F T F
F F T

7
Discrete Structures Lecture 1
CMSC 2123 1.1 Propositional Logic

The truth table for 𝑝𝑝 ↔ 𝑞𝑞 is shown in Table 6. Note that the statement 𝑝𝑝 ↔ 𝑞𝑞 is true when both
the conditional statements 𝑝𝑝 → 𝑞𝑞 and 𝑞𝑞 → 𝑝𝑝 are true and is false otherwise. That is why we use
the words “if and only if” to express this logical connective and why it is symbolically written by
combining the symbols → and ←. There are other common ways to express 𝑝𝑝 ↔ 𝑞𝑞:

“p is necessary and sufficient for q”


“if p then q, and conversely”
“p iff q.”

The last way of expressing the biconditional statement 𝑝𝑝 ↔ 𝑞𝑞 uses the abbreviation “iff” for “if
and only if.” Note that 𝑝𝑝 ↔ 𝑞𝑞 has exactly the same truth value as (𝑝𝑝 → 𝑞𝑞) ∧ (𝑞𝑞 → 𝑝𝑝).

EXAMPLE 10 Let p be the statement “You can take the flight” and q be the statement “You
buy a ticket.” Express the biconditional 𝑝𝑝 ↔ 𝑞𝑞 as an English sentence.
Solution: “You can take the flight if and only if you buy a ticket.”

Truth Tables of Compound Propositions


EXAMPLE 11 Construct the truth table of the compound proposition
(𝑝𝑝 ∨ ¬𝑞𝑞) → (𝑝𝑝 ∧ 𝑞𝑞)
Solution:
1. Rows: The number of rows in the truth table is equal to 2|𝑣𝑣| , where
|𝑣𝑣| is the number of propositional variables. In this case, there are
two propositional variables, p and q. Hence, there are 22 = 4 rows.
2. Columns. There are as many columns as there are compound
propositions, propositional variables, and negated propositional
variables.
3. Construction. Complete the columns from left to right moving from
the simple to the complex.

TABLE 7 The Truth Table of (𝒑𝒑 ∨ ¬𝒒𝒒) → (𝒑𝒑 ∧ 𝒒𝒒)


𝒑𝒑 𝒒𝒒 ¬𝒒𝒒 𝒑𝒑 ∨ ¬𝒒𝒒 𝒑𝒑 ∧ 𝒒𝒒 (𝒑𝒑 ∨ ¬𝒒𝒒) → (𝒑𝒑 ∧ 𝒒𝒒)
T T F T T T
T F T T F F
F T F F F T
F F T T F F

8
Discrete Structures Lecture 1
CMSC 2123 1.1 Propositional Logic

Precedence of Logical Operators


TABLE 8 Precedence of Logical Operators
Operator Precedence Precedence
¬ 1 Highest
∧ 2
∨ 3
→ 4
↔ 5 Lowest

Translating English Sentences


EXAMPLE 12 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 or you are not a freshman.”

Solution: Define the following propositions:


Proposition English statement
𝑎𝑎 “You can access the Internet from campus.”
𝑐𝑐 “You are a computer science major.”
𝑓𝑓 “You are a freshman”
“only if” maps to →
𝑎𝑎 → (𝑐𝑐 ∨ ¬𝑓𝑓)

EXAMPLE 13 Translate the following sentence into a logical expression.

“You cannot ride the roller coaster if you are under 4 feet tall unless you
are older than 16 years old.”

Solution: Define the following propositions:


Proposition English statement
𝑞𝑞 “You can ride the roller coaster.”
𝑟𝑟 “You are under 4 feet tall.”
s “You are older than 16 years old.”
(𝑟𝑟 ∧ ¬𝑠𝑠) → ¬𝑞𝑞

Logic and Bit Operations

Truth Value Bit


T 1
F 0

9
Discrete Structures Lecture 1
CMSC 2123 1.1 Propositional Logic

REMARK A bit is the contraction of binary digit, a zero (0) or a one (1).

DEFINITION 7 A bit string is a sequence of zero or more bits. The length of the string is the
number of bits in the string.

EXAMPLE 12 101010011 is a bit string of length nine.

EXAMPLE 13 Find the bitwise OR, bitwise AND, and bitwise XOR, of the bit strings 01
1011 0110 and 11 0001 1101.
Solution:

0 1 1 0 1 1 0 1 1 0
1 1 0 0 0 1 1 1 0 1
OR 1 1 1 0 1 1 1 1 1 1

0 1 1 0 1 1 0 1 1 0
1 1 0 0 0 1 1 1 0 1
AND 0 1 0 0 0 1 0 1 0 0

0 1 1 0 1 1 0 1 1 0
1 1 0 0 0 1 1 1 0 1
XOR 1 0 1 0 1 0 1 0 1 0

10

You might also like