0% found this document useful (0 votes)
39 views18 pages

Discrete Math for 3rd Sem CSE/IT

The document provides an overview of topics in propositional logic including syntax, semantics, propositions, logical connectives and their truth tables, precedence of logical operators, logical equivalence, propositional satisfiability, predicates, quantifiers and rules of inference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views18 pages

Discrete Math for 3rd Sem CSE/IT

The document provides an overview of topics in propositional logic including syntax, semantics, propositions, logical connectives and their truth tables, precedence of logical operators, logical equivalence, propositional satisfiability, predicates, quantifiers and rules of inference.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PARUL UNIVERSITY - FACULTY OF ENGINEERING & TECHNOLOGY

Department of Applied Science & Humanities


3rd Semester B. Tech (CSE, IT)
Discrete Mathematics (203191206)
Unit-3 Propositional Logic

Introduction:
The rules of logic give precise meaning to mathematical statements. These rules are used to
distinguish between valid and invalid mathematical arguments. Which helps to understand and to
construct correct mathematical arguments. Besides the importance of logic in understanding
mathematical reasoning, logic has numerous applications to computer science. These rules are used
in the design of computer circuits, the construction of computer programs, the verification of the
correctness of programs, and in many other ways. Furthermore, software systems have been
developed for constructing some, but not all, types of proofs automatically

Overview:
➢ Syntax, semantics, propositions
➢ Basic connectives and truth tables
• Negation • Conjunction • Disjunction
• Exclusive or • Implication • Biconditional
➢ Precedence of logical operators
➢ Converse, contrapositive, and inverse of an implication
➢ Logic and bit operations
➢ Logical equivalence: the laws of logic, logical implication
➢ Propositional satisfiability
➢ Predicates
➢ Quantifiers
• Universal quantifier • The existential quantifier
• The uniqueness quantifier • Negating quantified expressions
➢ Rules of inference

Weightage: 18%

Teaching Hours: 11
SYNTAX, SEMANTICS, PROPOSITIONS
The structure of statements in a computer language is said to be a syntax.
In computer science, the term semantics refers to the meaning of language constructs, as opposed to
their form.
A proposition is a declarative sentence (that is, a sentence that declares a fact) that is either true or
false, but not both.
For example, all the following declarative sentences are propositions.
1. Washington, D.C., is the capital of the United States of America.
2. Toronto is the capital of Canada.
3. 1 + 1 = 2.
4. 2 + 2 = 3.
Propositions 1 and 3 are true, whereas 2 and 4 are false.
The following are not propositions.
1. What time is it?
2. Read this carefully.
3. x + 1 = 2.
4. x + y = z.
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 that each of sentences 3 and 4 can be
turned into a proposition if we assign values to the variables.
Variables that represent propositions are known as propositional variables (or statement variables)
The conventional letters used for propositional variables are 𝑝, 𝑞, 𝑟, 𝑠, …
The truth value of a proposition is true, denoted by T, if it is a true proposition, and the truth value of
a proposition is false, denoted by F, if it is a false proposition.
The area of logic that deals with propositions is called the propositional calculus or propositional
logic.
Many mathematical statements are constructed by combining one or more propositions. New
propositions, called compound propositions, are formed from existing propositions using logical
operators.
BASIC CONNECTIVES AND TRUTH TABLES

The logical operators that are used to form new propositions from two or more existing propositions.
These logical operators are also called connectives.
Negation
Definition:
Let 𝑝 be a proposition. The 𝒏𝒆𝒈𝒂𝒕𝒊𝒐𝒏 𝒐𝒇 𝑝, denoted by¬𝑝 (also denoted by 𝑝), is the statement
“It is not the case that p.”
The proposition ¬p is read “𝑛𝑜𝑡 𝑝.” The truth value of the negation of 𝑝, ¬p, is the opposite of the
truth value of 𝑝.
For example, consider the proposition “𝑀𝑖𝑐ℎ𝑎𝑒𝑙’𝑠 𝑃𝐶 𝑟𝑢𝑛𝑠 𝐿𝑖𝑛𝑢𝑥”.
The negation is “𝐼𝑡 𝑖𝑠 𝑛𝑜𝑡 𝑡ℎ𝑒 𝑐𝑎𝑠𝑒 𝑡ℎ𝑎𝑡 𝑀𝑖𝑐ℎ𝑎𝑒𝑙’𝑠 𝑃𝐶 𝑟𝑢𝑛𝑠 𝐿𝑖𝑛𝑢𝑥.”
This negation can be more simply expressed as “𝑀𝑖𝑐ℎ𝑎𝑒𝑙’𝑠 𝑃𝐶 𝑑𝑜𝑒𝑠 𝑛𝑜𝑡 𝑟𝑢𝑛 𝐿𝑖𝑛𝑢𝑥.”
The table on right 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 p for this row.
Remark:
The negation of a proposition can also be considered as the result of the operation of the negation
operator on a proposition. The negation operator constructs a new proposition from a single existing
proposition.

Conjunction
Definition:
Let p and q be propositions. The 𝒄𝒐𝒏𝒋𝒖𝒏𝒄𝒕𝒊𝒐𝒏 of p and q,
denoted by p ∧ q, is the proposition
“p and q.” The conjunction p ∧ q is true when both p and q
are true and is false otherwise.
The table on right displays the truth table for the
𝒄𝒐𝒏𝒋𝒖𝒏𝒄𝒕𝒊𝒐𝒏 of p and q.

Note that in logic the word “𝑏𝑢𝑡” sometimes is used instead of “𝑎𝑛𝑑” in a conjunction. For example,
the statement “𝑇ℎ𝑒 𝑠𝑢𝑛 𝑖𝑠 𝑠ℎ𝑖𝑛𝑖𝑛𝑔, 𝑏𝑢𝑡 𝑖𝑡 𝑖𝑠 𝑟𝑎𝑖𝑛𝑖𝑛𝑔” is another way of saying
“𝑇ℎ𝑒 𝑠𝑢𝑛 𝑖𝑠 𝑠ℎ𝑖𝑛𝑖𝑛𝑔 𝑎𝑛𝑑 𝑖𝑡 𝑖𝑠 𝑟𝑎𝑖𝑛𝑖𝑛𝑔.”
For example, 𝑝 is the proposition “𝑅𝑒𝑏𝑒𝑐𝑐𝑎’𝑠 𝑃𝐶 ℎ𝑎𝑠
𝑚𝑜𝑟𝑒 𝑡ℎ𝑎𝑛 16 𝐺𝐵 𝑓𝑟𝑒𝑒 ℎ𝑎𝑟𝑑 𝑑𝑖𝑠𝑘 𝑠𝑝𝑎𝑐𝑒” and 𝑞 is the proposition “𝑇ℎ𝑒 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑜𝑟 𝑖𝑛 𝑅𝑒𝑏𝑒𝑐𝑐𝑎’𝑠
𝑃𝐶 𝑟𝑢𝑛𝑠 𝑓𝑎𝑠𝑡𝑒𝑟 𝑡ℎ𝑎𝑛 1 𝐺𝐻𝑧.”
The conjunction of these propositions, 𝑝 ∧ 𝑞, is the proposition “𝑅𝑒𝑏𝑒𝑐𝑐𝑎’𝑠 𝑃𝐶 ℎ𝑎𝑠 𝑚𝑜𝑟𝑒 𝑡ℎ𝑎𝑛
16 𝐺𝐵 𝑓𝑟𝑒𝑒 ℎ𝑎𝑟𝑑 𝑑𝑖𝑠𝑘 𝑠𝑝𝑎𝑐𝑒, 𝑎𝑛𝑑 𝑡ℎ𝑒 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑜𝑟 𝑖𝑛 𝑅𝑒𝑏𝑒𝑐𝑐𝑎’𝑠 𝑃𝐶 𝑟𝑢𝑛𝑠 𝑓𝑎𝑠𝑡𝑒𝑟 𝑡ℎ𝑎𝑛 1 𝐺𝐻𝑧.”
This conjunction can be expressed more simply as “𝑅𝑒𝑏𝑒𝑐𝑐𝑎’𝑠 𝑃𝐶 ℎ𝑎𝑠 𝑚𝑜𝑟𝑒 𝑡ℎ𝑎𝑛 16 𝐺𝐵
𝑓𝑟𝑒𝑒 ℎ𝑎𝑟𝑑 𝑑𝑖𝑠𝑘 𝑠𝑝𝑎𝑐𝑒, 𝑎𝑛𝑑 𝑖𝑡𝑠 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑜𝑟 𝑟𝑢𝑛𝑠 𝑓𝑎𝑠𝑡𝑒𝑟 𝑡ℎ𝑎𝑛 1 𝐺𝐻𝑧.”
For this conjunction to be true, both conditions given must be true. It is false, when one or both of
these conditions are false.
Disjunction
Definition:
Let p and q be propositions. The 𝒅𝒊𝒔𝒋𝒖𝒏𝒄𝒕𝒊𝒐𝒏 of p and q,
denoted by p ∨ q, is the proposition
“p or q.” The disjunction p ∨ q is false when both p and q
are false and is true otherwise.
The table on right displays the truth table for the
𝒅𝒊𝒔𝒋𝒖𝒏𝒄𝒕𝒊𝒐𝒏 of p and q.

Remark:
• The use of the connective or in a disjunction corresponds to one of the two ways the word 𝑜𝑟 is
used in English, namely, as an inclusive or. A disjunction is true when at least one of the two
propositions is true. For instance, the inclusive or is being used in the statement
“𝑆𝑡𝑢𝑑𝑒𝑛𝑡𝑠 𝑤ℎ𝑜 ℎ𝑎𝑣𝑒 𝑡𝑎𝑘𝑒𝑛 𝑐𝑎𝑙𝑐𝑢𝑙𝑢𝑠 𝑜𝑟 𝑐𝑜𝑚𝑝𝑢𝑡𝑒𝑟 𝑠𝑐𝑖𝑒𝑛𝑐𝑒 𝑐𝑎𝑛 𝑡𝑎𝑘𝑒 𝑡ℎ𝑖𝑠 𝑐𝑙𝑎𝑠𝑠. ”
Here, the proposition means 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.
For example, 𝑝 is the proposition “ 𝑅𝑒𝑏𝑒𝑐𝑐𝑎’𝑠 𝑃𝐶 ℎ𝑎𝑠 𝑚𝑜𝑟𝑒 𝑡ℎ𝑎𝑛 16 𝐺𝐵 𝑓𝑟𝑒𝑒 ℎ𝑎𝑟𝑑 𝑑𝑖𝑠𝑘
𝑠𝑝𝑎𝑐𝑒” and 𝑞 is the proposition “𝑇ℎ𝑒 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑜𝑟 𝑖𝑛 𝑅𝑒𝑏𝑒𝑐𝑐𝑎’𝑠 𝑃𝐶 𝑟𝑢𝑛𝑠 𝑓𝑎𝑠𝑡𝑒𝑟 𝑡ℎ𝑎𝑛 1 𝐺𝐻𝑧.”
The disjunction of p and q, p ∨ q, is the proposition
“𝑅𝑒𝑏𝑒𝑐𝑐𝑎’𝑠 𝑃𝐶 ℎ𝑎𝑠 𝑎𝑡 𝑙𝑒𝑎𝑠𝑡 16 𝐺𝐵 𝑓𝑟𝑒𝑒 ℎ𝑎𝑟𝑑 𝑑𝑖𝑠𝑘 𝑠𝑝𝑎𝑐𝑒, 𝑜𝑟 𝑡ℎ𝑒 𝑝𝑟𝑜𝑐𝑒𝑠𝑠𝑜𝑟 𝑖𝑛 𝑅𝑒𝑏𝑒𝑐𝑐𝑎’𝑠
𝑃𝐶 𝑟𝑢𝑛𝑠 𝑓𝑎𝑠𝑡𝑒𝑟 𝑡ℎ𝑎𝑛 1 𝐺𝐻𝑧. ”
This proposition is true when Rebecca’s PC has at least 16 GB free hard disk space, when the PC’s
processor runs faster than 1 GHz, and when both conditions are true. It is false when both of these
conditions are false, that is, when Rebecca’s PC has less than 16 GB free hard disk space and the
processor in her PC runs at 1 GHz or slower.
Note: The use of the connective or in a disjunction corresponds to one of the two ways the word or is
used in English, namely, in an inclusive way. Thus, a disjunction is true when at least one of the two
propositions in it is true. Sometimes, we use 𝑜𝑟 in an exclusive sense. When the exclusive or is used
to connect the propositions p and q, the proposition “𝒑 𝒐𝒓 𝒒 (𝒃𝒖𝒕 𝒏𝒐𝒕 𝒃𝒐𝒕𝒉)” is obtained. This
proposition is true when p is true and q is false, and when p is false and q is true. It is false when both
p and q are false and when both are true.
Exclusive OR
Definition
Let p and q be propositions. The 𝒆𝒙𝒄𝒍𝒖𝒔𝒊𝒗𝒆 𝒐𝒓 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.
The table on right displays the truth table for the
𝒆𝒙𝒄𝒍𝒖𝒔𝒊𝒗𝒆 𝒐𝒓 of p and q

Conditional Statement (Implication)


Definition
Let p and q be propositions. The
𝒄𝒐𝒏𝒅𝒊𝒕𝒊𝒐𝒏𝒂𝒍 𝒔𝒕𝒂𝒕𝒆𝒎𝒆𝒏𝒕 p → q is the proposition
“𝑖𝑓 𝑝, 𝑡ℎ𝑒𝑛 𝑞.” The conditional statement p → q is false
when p is true and q is false, and true otherwise.
The table on right displays the truth table for the
𝒄𝒐𝒏𝒅𝒊𝒕𝒊𝒐𝒏𝒂𝒍 𝒔𝒕𝒂𝒕𝒆𝒎𝒆𝒏𝒕 𝑝 → 𝑞.
In the conditional statement p → q, p is called the hypothesis (or antecedent or premise) and q is called
the conclusion (or consequence).
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 implication.
Note that the statement p → q is true when both p and q are true and when p is false (no matter what
truth value q has).
Because conditional statements play such an essential role in mathematical reasoning, a variety of
terminology is used to express p → q. You will encounter most if not all of the following ways to
express this conditional statement:
“𝑖𝑓 𝑝, 𝑡ℎ𝑒𝑛 𝑞” “𝑝 𝑖𝑚𝑝𝑙𝑖𝑒𝑠 𝑞”
“𝑖𝑓 𝑝, 𝑞” “𝑝 𝑜𝑛𝑙𝑦 𝑖𝑓 𝑞”
“𝑝 𝑖𝑠 𝑠𝑢𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡 𝑓𝑜𝑟 𝑞” “𝑎 𝑠𝑢𝑓𝑓𝑖𝑐𝑖𝑒𝑛𝑡 𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 𝑓𝑜𝑟 𝑞 𝑖𝑠 𝑝”
“𝑞 𝑖𝑓 𝑝” “𝑞 𝑤ℎ𝑒𝑛𝑒𝑣𝑒𝑟 𝑝”
“𝑞 𝑤ℎ𝑒𝑛 𝑝” “𝑞 𝑖𝑠 𝑛𝑒𝑐𝑒𝑠𝑠𝑎𝑟𝑦 𝑓𝑜𝑟 𝑝”
“𝑎 𝑛𝑒𝑐𝑒𝑠𝑠𝑎𝑟𝑦 𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 𝑓𝑜𝑟 𝑝 𝑖𝑠 𝑞” “𝑞 𝑓𝑜𝑙𝑙𝑜𝑤𝑠 𝑓𝑟𝑜𝑚 𝑝”
“𝑞 𝑢𝑛𝑙𝑒𝑠𝑠 ¬𝑝”
Biconditional Statement
Definition
Let p and q be propositions. The biconditional statement
𝑝 ↔ 𝑞 is the proposition “𝑝 𝑖𝑓 𝑎𝑛𝑑 𝑜𝑛𝑙𝑦 𝑖𝑓 𝑞. ” The
biconditional statement 𝑝 ↔ 𝑞 is true when p and q have
the same truth values, and is false otherwise. Biconditional
statements are also called bi-implications.
The table on right displays the truth table for the
biconditional statement 𝑝 ↔ 𝑞
For example, let p be the statement “ 𝑌𝑜𝑢 𝑐𝑎𝑛 𝑡𝑎𝑘𝑒 𝑡ℎ𝑒 𝑓𝑙𝑖𝑔ℎ𝑡 ,” and let q be the statement
“𝑌𝑜𝑢 𝑏𝑢𝑦 𝑎 𝑡𝑖𝑐𝑘𝑒𝑡.”
Then p ↔ q is the statement “𝑌𝑜𝑢 𝑐𝑎𝑛 𝑡𝑎𝑘𝑒 𝑡ℎ𝑒 𝑓𝑙𝑖𝑔ℎ𝑡 𝑖𝑓 𝑎𝑛𝑑 𝑜𝑛𝑙𝑦 𝑖𝑓 𝑦𝑜𝑢 𝑏𝑢𝑦 𝑎 𝑡𝑖𝑐𝑘𝑒𝑡.”
This statement is true if p and q are either both true or both false, that is, if you buy a ticket and can
take the flight or if you do not buy a ticket and you cannot take the flight. It is false when p and q have
opposite truth values, that is, when you do not buy a ticket, but you can take the flight and when you
buy a ticket but you cannot take the flight.
Exercise:
(i) Let p and q be the propositions
𝑝 ∶ I bought a lottery ticket this week.
𝑞 ∶ I won the million dollar jackpot.
Express each of these propositions as an English sentence.
a) ¬𝑝 b) 𝑝 ∨ 𝑞 c) 𝑝 → 𝑞
d) 𝑝 ∧ 𝑞 e) 𝑝 ↔ 𝑞 f ) ¬𝑝 → ¬𝑞
g) ¬𝑝 ∧ ¬𝑞 h) ¬𝑝 ∨ (𝑝 ∧ 𝑞)
(ii) Let p and q be the propositions
p : It is below freezing. q : It is snowing.
Write these propositions using p and q and logical connectives. (including negations).
a) It is below freezing and snowing.
b) It is below freezing but not snowing.
c) It is not below freezing and it is not snowing.
d) It is either snowing or below freezing (or both).
e) If it is below freezing, it is also snowing.
f ) Either it is below freezing or it is snowing, but it is not snowing if it is below freezing.
g) That it is below freezing is necessary and sufficient. i) for it to be snowing.
PRECEDENCE OF LOGICAL OPERATORS

Generally parentheses are used to specify the order in which logical operators in a compound
proposition are to be applied.
For instance, (p ∨ q) ∧ (¬r) is the conjunction of p ∨ q and ¬r.
However, to reduce the number of parentheses, note 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 and q, namely¬(p ∧ q).
Another general rule of precedence is that the conjunction operator takes
precedence over the disjunction operator, so that p ∧ q ∨ r means (p ∧ q) ∨ r
rather than p ∧ (q ∨ r).
The conditional and biconditional operators → and ↔ have lower precedence
than the conjunction and disjunction operators, ∧ and ∨. Consequently, p ∨ q
→ r is the same as (p ∨ q) → r.
The table on right displays the precedence levels of the logical operators,
¬,∧,∨, →, 𝑎𝑛𝑑 ↔.

Problem.1. Construct the truth table of the compound proposition


(𝑝 ∨ ¬𝑞) → (𝑝 ∧ 𝑞).

Exercise:
Construct a truth table for each of these compound propositions.
(a) (𝑝 → 𝑞) ↔ (¬𝑞 → ¬𝑝) b ) (𝑝 → 𝑞) → (𝑞 → 𝑝) c) 𝑝 ⊕ (𝑝 ∨ 𝑞)
CONVERSE, CONTRAPOSITIVE, AND INVERSE

Consider a conditional statement p → q.


The proposition 𝑞 → 𝑝 is called the converse of p → q. The contrapositive of p → q is the
proposition ¬q →¬p.
The proposition ¬𝑞 → ¬𝑝 is called the contrapositive of p → q
The proposition ¬p →¬q is called the inverse of p → q.
Of these three conditional statements formed from p → q, only the contrapositive always has the same
truth value as p → q.
Problem.1.
What are the contrapositive, the converse, and the inverse of the conditional statement
“𝑇ℎ𝑒 ℎ𝑜𝑚𝑒 𝑡𝑒𝑎𝑚 𝑤𝑖𝑛𝑠 𝑤ℎ𝑒𝑛𝑒𝑣𝑒𝑟 𝑖𝑡 𝑖𝑠 𝑟𝑎𝑖𝑛𝑖𝑛𝑔? ”
Solution:
Because “q whenever p” is one of the ways to express the conditional statement p → q, the original
statement can be rewritten as
“𝐼𝑓 𝑖𝑡 𝑖𝑠 𝑟𝑎𝑖𝑛𝑖𝑛𝑔, 𝑡ℎ𝑒𝑛 𝑡ℎ𝑒 ℎ𝑜𝑚𝑒 𝑡𝑒𝑎𝑚 𝑤𝑖𝑛𝑠. ”
Let𝑝 be the statement "𝑖𝑡 𝑖𝑠 𝑟𝑎𝑖𝑛𝑖𝑛𝑔" and 𝑞 be the statement "𝑡ℎ𝑒 ℎ𝑜𝑚𝑒 𝑡𝑒𝑎𝑚 𝑤𝑖𝑛𝑠". Hence, the
following.
Conditional statement: 𝑝 → 𝑞 “𝐼𝑓 𝑖𝑡 𝑖𝑠 𝑟𝑎𝑖𝑛𝑖𝑛𝑔, 𝑡ℎ𝑒𝑛 𝑡ℎ𝑒 ℎ𝑜𝑚𝑒 𝑡𝑒𝑎𝑚 𝑤𝑖𝑛𝑠. ”
Contrapositive: ¬𝑞 → ¬𝑝 “𝐼𝑓 𝑡ℎ𝑒 ℎ𝑜𝑚𝑒 𝑡𝑒𝑎𝑚 𝑑𝑜𝑒𝑠 𝑛𝑜𝑡 𝑤𝑖𝑛, 𝑡ℎ𝑒𝑛 𝑖𝑡 𝑖𝑠 𝑛𝑜𝑡 𝑟𝑎𝑖𝑛𝑖𝑛𝑔. ”
Converse: 𝑞 → 𝑝 “𝐼𝑓 𝑡ℎ𝑒 ℎ𝑜𝑚𝑒 𝑡𝑒𝑎𝑚 𝑤𝑖𝑛𝑠, 𝑡ℎ𝑒𝑛 𝑖𝑡 𝑖𝑠 𝑟𝑎𝑖𝑛𝑖𝑛𝑔. ”
Inverse: ¬𝑝 → ¬𝑞 “𝐼𝑓 𝑖𝑡 𝑖𝑠 𝑛𝑜𝑡 𝑟𝑎𝑖𝑛𝑖𝑛𝑔, 𝑡ℎ𝑒𝑛 𝑡ℎ𝑒 ℎ𝑜𝑚𝑒 𝑡𝑒𝑎𝑚 𝑑𝑜𝑒𝑠 𝑛𝑜𝑡 𝑤𝑖𝑛. ”
LOGIC AND BIT OPERATIONS

Computers represent information using bits.A bit is a symbol with two possible values, namely, 0
(zero) and 1 (one). This meaning of the word bit comes from binary digit, because zeros and ones are
the digits used in binary representations of numbers.
A bit can be used to represent a truth value, because there are two truth values, namely, true and
false.
1 represents T (true), 0 represents F (false).
A variable is called a Boolean variable if its value is either true or false. Consequently, a Boolean
variable can be represented using a bit.
Computer bit operations correspond to the logical connectives. By replacing true by a one and false
by a zero in the truth tables for the operators ∧, ∨, and ⊕, the truth tables for the corresponding bit
operations are obtained.
We will also use the notation OR, AND, and XOR for the operators ∨,∧, and ⊕, as is done in various
programming languages.
Truth table for bit operators is as following.

Definition
A 𝒃𝒊𝒕 𝒔𝒕𝒓𝒊𝒏𝒈 is a sequence of zero or more bits. The 𝒍𝒆𝒏𝒈𝒕𝒉 𝒐𝒇 this 𝒔𝒕𝒓𝒊𝒏𝒈 is the number of bits
in the string.
For example 101010011 is a bit string of length nine
The bitwise OR, bitwise AND, and bitwise XOR of two strings of the same length can be defined to
be the strings that have as their bits the OR, AND, and XOR of the corresponding bits in the two
strings, respectively.
The symbols ∨,∧, 𝑎𝑛𝑑 ⊕ are used to represent the bitwise OR, bitwise AND, and bitwise XOR
operations, respectively.
Problem.1. Find the bitwise OR, bitwise AND, and bitwise XOR of the bit strings 01 1011 0110 and
11 0001 1101.
Solution.
01 1011 0110
11 0001 1101
11 1011 1111 bitwise OR
01 0001 0100 bitwise AND
10 1010 1011 bitwise XOR

Exercise:
1. Find the bitwise OR, bitwise AND, and bitwise XOR of each of these pairs of bit strings.
a) 101 1110, 010 0001
b) 1111 0000, 1010 1010
LOGICAL EQUIVALENCE: THE LAWS OF LOGIC, LOGICAL IMPLICATION

Definition:
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 is neither a tautology nor a contradiction is called a contingency.
For example, since 𝑝 ∨ ¬𝑝 is always true, it is a tautology. And as 𝑝 ∧¬𝑝 is always false, it is a
contradiction.

Definition:
The compound propositions p and q are called 𝑙𝑜𝑔𝑖𝑐𝑎𝑙𝑙𝑦 𝑒𝑞𝑢𝑖𝑣𝑎𝑙𝑒𝑛𝑡 if 𝑝 ↔ 𝑞 is a tautology.
The notation 𝑝 ≡ 𝑞 denotes that p and q are logically equivalent.
In other words, compound propositions that have the same truth values in all possible cases are
called logically equivalent.
Remark:
• The symbol ≡ is not a logical connective, and p ≡ q is not a compound proposition but rather is
the statement that 𝑝 ↔ 𝑞 is a tautology.
• The symbol ⇔ is sometimes used instead of ≡ to denote logical equivalence.
• One way to determine whether two compound propositions are equivalent is to use a truth table.
In particular, the compound propositions p and q are equivalent if and only if the columns giving
their truth values agree.
• Some standard logical equivalences are given in the following table.
Problem.1.
Show that ¬(𝑝 ∨ 𝑞) ≡ ¬𝑝 ∧ ¬𝑞 are logically equivalent.
Solution.
𝑝 𝑞 (𝑝 ∨ 𝑞) ¬(𝑝 ∨ 𝑞) ¬𝑝 ¬𝑞 ¬𝑝 ∧ ¬𝑞
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
The truth tables for these compound propositions are displayed in the table. Because the truth values
of the compound propositions ¬(p ∨ q) and ¬p ∧¬q agree for all possible combinations of the
truth values of p and q, it follows that¬(p ∨ q) ↔ (¬p ∧¬q) is a tautology.
Hence, these compound propositions are logically equivalent.
Problem.2.
Show that 𝑝 → 𝑞 and ¬𝑝 ∨ 𝑞 are logically equivalent.
Solution.
𝑝 𝑞 𝑝 → 𝑞 ¬𝑝 ¬𝑝 ∨ 𝑞
T T T F T
T F F F F
F T T T T
F F T T T
Since the truth values of ¬𝑝 ∨ 𝑞 and 𝑝 → 𝑞 agree, they are logically equivalent.
Problem.3.
Show that ¬(𝑝 ∨ (¬𝑝 ∧ 𝑞)) and ¬𝑝 ∧ ¬𝑞 are logically equivalent by developing a series of
logical equivalences.
Solution.
¬(𝑝 ∨ (¬𝑝 ∧ 𝑞)) ≡ ¬𝑝 ∧ ¬(¬𝑝 ∧ 𝑞) by the second De Morgan law
≡ ¬𝑝 ∧ [¬(¬𝑝) ∨ ¬𝑞] by the first De Morgan law
≡ ¬𝑝 ∧ (𝑝 ∨ ¬𝑞) by the double negation law
≡ (¬𝑝 ∧ 𝑝) ∨ (¬𝑝 ∧ ¬𝑞) by the second distributive law
≡ 𝑭 ∨ (¬𝑝 ∧ ¬𝑞) because ¬𝑝 ∧ 𝑝 ≡ 𝑭
≡ (¬𝑝 ∧ ¬𝑞) ∨ 𝑭 by the commutative law for disjunction
≡ ¬𝑝 ∧ ¬𝑞 by the identity law for F

Consequently ¬(p ∨ (¬p ∧ q)) and ¬p ∧¬q are logically equivalent.


Problem.4. Show that (𝑝 ∧ 𝑞) → (𝑝 ∨ 𝑞) is a tautology.
Solution.
(𝑝 ∧ 𝑞) → (𝑝 ∨ 𝑞) ≡ ¬(𝑝 ∧ 𝑞) ∨ (𝑝 ∨ 𝑞) Because 𝑝 → 𝑞 𝑎𝑛𝑑 ¬𝑝 ∨ 𝑞 are equivalent
≡ (¬𝑝 ∨ ¬𝑞) ∨ (𝑝 ∨ 𝑞) by the first De Morgan law
≡ (¬𝑝 ∨ 𝑝) ∨ (¬𝑞 ∨ 𝑞) by the associative and commutative laws for
disjunction
≡ 𝑻 ∨ 𝑻 ¬𝑝 ∨ 𝑝 ≡ T and the commutative law for
disjunction
≡ 𝑻 by the domination law
Consequently (𝑝 ∧ 𝑞) → (𝑝 ∨ 𝑞) is a tautology.

Exercise:
1. Prove the distributive law of disjunction over conjunction using truth table.
2. Show that p ↔ q and (p ∧ q) ∨ (¬p ∧¬q) are logically equivalent.
3. Show that p → q and ¬q →¬p are logically equivalent.

PROPOSITIONAL SATISFIABILITY
Definition:
A compound proposition is satisfiable if there is an assignment of truth values to its variables that
makes it true.
When no such assignments exists, that is, when the compound proposition is false for all assignments
of truth values to its variables, the compound proposition is unsatisfiable.
The particular assignment of truth values that makes a compound proposition true is called a
solution of this particular satisfiability problem.
Remark:
• A compound proposition is unsatisfiable if and only if its negation is a tautology.
[Link] whether each of the compound propositions is satisfiable.
(𝑝 ↔ 𝑞) ∧ (¬𝑝 ↔ 𝑞)
Solution
𝑝 𝑞 (𝑝 ↔ 𝑞) ¬𝑝 (¬𝑝 ↔ 𝑞) (𝑝 ↔ 𝑞) ∧ (¬𝑝
↔ 𝑞)
T T T F F F
T F F F T F
F T F T T T
F F T T F F
Since, (𝑝 ↔ 𝑞) ∧ (¬𝑝 ↔ 𝑞) is true when 𝑝 is false and 𝑞 is true, it is satisfiable.
Exercise:
Determine whether each of the compound propositions is satisfiable.
(a) (𝑝 ∨ ¬𝑞) ∧ (𝑞 ∨ ¬𝑟) ∧ (𝑟 ∨ ¬𝑝)
(b) (𝑝 ∨ ¬𝑞) ∧ (𝑞 ∨ ¬𝑟) ∧ (𝑟 ∨ ¬𝑝)
PREDICATES
Definition:
Consider a statement that cannot be verified to be true or false until the values of the variables are
not specified. Such statements can be divided in two parts, one which contains the variables, known
as subject and the other which refers to a property that the subject of the statement can have, is
known as the predicate.
For example, if the statement “x is greater than 3” is denoted by P(x), then P denotes the predicate
“is greater than 3” and x is the variable.
The statement P(x) is also said to be the value of the propositional function P at x. Once a value has
been assigned to the variable x, the statement P(x) becomes a proposition and has a truth value.
Problem.1. Let P(x) denote the statement “x > 3.” What are the truth values of P(4) and P(2)?
Solution. P(4): 4>3 which is true.
P(2): 2>3 which is false
Exercise:
1. Let Q(x, y) denote the statement “x = y + 3.” What are the truth values of the propositions Q(1, 2)
and Q(3, 0)?
QUANTIFIERS
When the variables in a propositional function are assigned values, the resulting statement becomes a
proposition with a certain truth value. Quantification expresses the extent to which a predicate is true
over a range of elements.
In English, the words all, some, many, none, and few are used in quantifications.
Two types of quantification are discussed here: universal quantification, which tells us that a
predicate is true for every element under consideration, and existential quantification, which tells us
that there is one or more element under consideration for which the predicate is true. The area of
logic that deals with predicates and quantifiers is called the predicate calculus.
The Universal Quantifier
Many mathematical statements assert that a property is true for all values of a variable in a particular
domain, called the domain of discourse (or the universe of discourse), and often just referred to as
the domain.
Such a statement is expressed using universal quantification. The universal quantification of P(x) for
a particular domain is the proposition that asserts that P(x) is true for all values of x in this domain.
Note that the domain specifies the possible values of the variable x. The meaning of the universal
quantification of P(x) changes when we change the domain. The domain must always be specified
when a universal quantifier is used; without it, the universal quantification of a statement is not
defined.
Definition:
The universal quantification of P(x) is the statement
“𝑃(𝑥) 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑣𝑎𝑙𝑢𝑒𝑠 𝑜𝑓 𝑥 𝑖𝑛 𝑡ℎ𝑒 𝑑𝑜𝑚𝑎𝑖𝑛. ”
The notation ∀𝑥 𝑃(𝑥) denotes the universal quantification of P(x).
Here ∀ is called the universal quantifier.
We read ∀𝑥𝑃(𝑥) as “𝑓𝑜𝑟 𝑎𝑙𝑙 𝑥 𝑃(𝑥)” or “𝑓𝑜𝑟 𝑒𝑣𝑒𝑟𝑦 𝑥𝑃(𝑥).”
An element for which P(x) is false is called a counter example of ∀𝑥 𝑃(𝑥).

Remark: Generally, an implicit assumption is made that all domains of discourse for quantifiers are
nonempty. If the domain is empty, then ∀𝑥 𝑃(𝑥) is true for any propositional function 𝑃(𝑥) because
there are no elements x in the domain for which 𝑃(𝑥) is false.

Problem.1. Let 𝑃(𝑥) be the statement “𝑥 + 1 > 𝑥.” What is the truth value of the quantification
∀𝑥𝑃(𝑥), where the domain consists of all real numbers?
Solution: Because 𝑃(𝑥) is true for all real numbers x, the quantification ∀𝑥𝑃(𝑥) is true.
Problem.2. Let 𝑄(𝑥) be the statement “𝑥 < 2.” What is the truth value of the quantification
∀𝑥 𝑄(𝑥), where the domain consists of all real numbers?
Solution: 𝑄(𝑥) is not true for every real number x, because, for instance, 𝑄(3) is false. That is, 𝑥 =
3 is a counterexample for the statement ∀𝑥 𝑄(𝑥). Thus ∀𝑥 𝑄(𝑥) is false.

Exercise:
• What is the truth value of ∀𝑥𝑃(𝑥), where 𝑃(𝑥) is the statement “𝑥 2 < 10” and the domain
consists of the positive integers not exceeding 4?
• What is the truth value of ∀x(x2 ≥ x) if the domain consists of all real numbers? What is the truth
value of this statement if the domain consists of all integers?
The Existential Quantifier
Many mathematical statements assert that there is an element with a certain property. Such
statements are expressed using existential quantification. With existential quantification, we form a
proposition that is true if and only if P(x) is true for at least one value of x in the domain.

Definition:
The existential quantification of P(x) is the proposition
“𝑇ℎ𝑒𝑟𝑒 𝑒𝑥𝑖𝑠𝑡𝑠 𝑎𝑛 𝑒𝑙𝑒𝑚𝑒𝑛𝑡 𝑥 𝑖𝑛 𝑡ℎ𝑒 𝑑𝑜𝑚𝑎𝑖𝑛 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝑃(𝑥). ”
We use the notation ∃𝑥 𝑃(𝑥) for the existential quantification of 𝑃(𝑥).
Here ∃ is called the existential quantifier.

Note:
• A domain must always be specified when a statement ∃𝑥 𝑃(𝑥) is used.
• Furthermore, the meaning of ∃𝑥 𝑃(𝑥) changes when the domain changes. Without specifying the
domain, the statement ∃𝑥 𝑃(𝑥) has no meaning.
• Besides the phrase “there exists,” we can also express existential quantification in many other
ways, such as by using the words “for some,” “for at least one,” or “there is.” The existential
quantification ∃𝑥 𝑃(𝑥) is read as
“𝑇ℎ𝑒𝑟𝑒 𝑖𝑠 𝑎𝑛 𝑥 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝑃(𝑥),”
“𝑇ℎ𝑒𝑟𝑒 𝑖𝑠 𝑎𝑡 𝑙𝑒𝑎𝑠𝑡 𝑜𝑛𝑒 𝑥 𝑠𝑢𝑐ℎ 𝑡ℎ𝑎𝑡 𝑃(𝑥),”
or
“𝐹𝑜𝑟 𝑠𝑜𝑚𝑒 𝑥𝑃(𝑥).”
• ∃𝑥 𝑃(𝑥) is false if and only if 𝑃(𝑥) is false for every element of the domain.

Remark: Generally, an implicit assumption is made that all domains of discourse for quantifiers are
nonempty. If the domain is empty, then ∃𝑥 𝑄(𝑥) is false whenever 𝑄(𝑥) is a propositional function
because when the domain is empty, there can be no element x in the domain for which 𝑄(𝑥) is true.

Precedence of Quantifiers
The quantifiers ∀ and ∃ have higher precedence than all logical operators from propositional
calculus.
For example, ∀𝑥 𝑃(𝑥) ∨ 𝑄(𝑥) is the disjunction of ∀𝑥𝑃(𝑥) and 𝑄(𝑥). In other words, it means
(∀𝑥𝑃(𝑥)) ∨ 𝑄(𝑥) rather than ∀𝑥(𝑃(𝑥) ∨ 𝑄(𝑥)).

Problem.1. Let P(x) denote the statement “𝑥 > 3.” What is the truth value of the quantification
∃𝑥 𝑃(𝑥), where the domain consists of all real numbers?
Solution: Because “𝑥 > 3” is sometimes true—for instance, when 𝑥 = 4—the existential
quantification of P(x), which is ∃𝑥𝑃(𝑥), is true.

Problem.2. Let Q(x) denote the statement “x = x + 1.”What is the truth value of the quantification
∃𝑥 𝑄(𝑥), where the domain consists of all real numbers?
Solution: Since 𝑄(𝑥) is false for every real number x, the existential quantification of 𝑄(𝑥), which is
∃𝑥 𝑄(𝑥), is false.

Exercise:
What is the truth value of ∃𝑥 𝑃(𝑥), where 𝑃(𝑥) is the statement “𝑥 2 > 10” and the universe of
discourse consists of the positive integers not exceeding 4?
The Uniqueness Quantifier
Definition:
The uniqueness quantifier, denoted by ∃! or ∃1 .
The notation ∃! 𝑥 𝑃(𝑥) [or ∃1 𝑥 𝑃(𝑥)] states “There exists a unique 𝑥 such that 𝑃(𝑥) is true.”
For instance, ∃! 𝑥(𝑥 − 1 = 0), where the domain is the set of real numbers, states that there is a
unique real number x such that 𝑥 − 1 = 0. This is a true statement, as 𝑥 = 1 is the unique real
number such that 𝑥 − 1 = 0.
Negating Quantified Expressions
P(x) is the statement “x has taken a course in calculus” and the domain consists of the students in
your class ∀𝑥𝑃(𝑥) denotes the statement
"𝐸𝑣𝑒𝑟𝑦 𝑠𝑡𝑢𝑑𝑒𝑛𝑡 𝑖𝑛 𝑦𝑜𝑢𝑟 𝑐𝑙𝑎𝑠𝑠 ℎ𝑎𝑠 𝑡𝑎𝑘𝑒𝑛 𝑎 𝑐𝑜𝑢𝑟𝑠𝑒 𝑖𝑛 𝑐𝑎𝑙𝑐𝑢𝑙𝑢𝑠. ”
The negation of this statement is
"𝐼𝑡 𝑖𝑠 𝑛𝑜𝑡 𝑡ℎ𝑒 𝑐𝑎𝑠𝑒 𝑡ℎ𝑎𝑡 𝑒𝑣𝑒𝑟𝑦 𝑠𝑡𝑢𝑑𝑒𝑛𝑡 𝑖𝑛 𝑦𝑜𝑢𝑟 𝑐𝑙𝑎𝑠𝑠 ℎ𝑎𝑠 𝑡𝑎𝑘𝑒𝑛 𝑎 𝑐𝑜𝑢𝑟𝑠𝑒 𝑖𝑛 𝑐𝑎𝑙𝑐𝑢𝑙𝑢𝑠. "
This is equivalent to
"𝑇ℎ𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑠𝑡𝑢𝑑𝑒𝑛𝑡 𝑖𝑛 𝑦𝑜𝑢𝑟 𝑐𝑙𝑎𝑠𝑠 𝑤ℎ𝑜 ℎ𝑎𝑠 𝑛𝑜𝑡 𝑡𝑎𝑘𝑒𝑛 𝑎 𝑐𝑜𝑢𝑟𝑠𝑒 𝑖𝑛 𝑐𝑎𝑙𝑐𝑢𝑙𝑢𝑠. ”
And this is simply the existential quantification of the negation of the original propositional function,
namely,
∃𝑥 ¬𝑃(𝑥).
Which gives the following logical equivalence:
¬∀𝑥𝑃(𝑥) ≡ ∃𝑥 ¬𝑃(𝑥).
Similarly,
¬∃𝑥𝑄(𝑥) ≡ ∀𝑥 ¬𝑄(𝑥).
These are known as De Morgan’s laws of Quantifiers.

Problem.1. What are the negations of the statements ∀𝑥(𝑥 2 > 𝑥) and ∃𝑥(𝑥 2 = 2)?
Solution: The negation of ∀𝑥(𝑥 2 > 𝑥) is the statement ¬∀𝑥(𝑥 2 > 𝑥), which is equivalent to ∃𝑥¬
(𝑥 2 > 𝑥).
This can be rewritten as ∃𝑥(𝑥 2 ≤ 𝑥).
The negation of ∃𝑥(𝑥 2 = 2) is the statement ¬∃𝑥(𝑥 2 = 2), which is equivalent to ∀𝑥¬(𝑥 2 = 2).
This can be rewritten as ∀𝑥(𝑥 2 ≠ 2).
The truth values of these statements depend on the domain.

Problem.2.
Express the statement “Every student in this class has studied calculus” using predicates and
quantifiers.
Solution:
Let 𝑆(𝑥) represent the statement that “person x is in this class”;
𝐶(𝑥) represent the statement that “x has studied calculus.”
Then the given statement can be expressed as “For every person x, if person x is a student in this
class then x has studied calculus.” Which can be written as :
∀𝑥(𝑆(𝑥) → 𝐶(𝑥))
Exercise:
• Express the statements “Some student in this class has visited Mexico” and “Every student in
this class has visited either Canada or Mexico” using predicates and quantifiers.

RULES OF INFERENCE
Proofs in mathematics are valid arguments that establish the truth of mathematical statements. By an
argument, we mean a sequence of statements that end with a conclusion. By valid, we mean that the
conclusion, or final statement of the argument, must follow from the truth of the preceding
statements, or premises, of the argument.
That is, an argument is valid if and only if it is impossible for all the premises to be true and the
conclusion to be false. To deduce new statements from statements we already have, we use rules of
inference which are templates for constructing valid arguments. Rules of inference are our basic
tools for establishing the truth of statements.

Definition:
An 𝒂𝒓𝒈𝒖𝒎𝒆𝒏𝒕 in propositional logic is a sequence of propositions.
All other than the final proposition in the argument are called 𝒑𝒓𝒆𝒎𝒊𝒔𝒆𝒔 and the final proposition is
called the 𝒄𝒐𝒏𝒄𝒍𝒖𝒔𝒊𝒐𝒏.
An argument is 𝒗𝒂𝒍𝒊𝒅 if the truth of all its premises implies that the conclusion is true.
An 𝒂𝒓𝒈𝒖𝒎𝒆𝒏𝒕 𝒇𝒐𝒓𝒎 in propositional logic is a sequence of compound propositions involving
propositional variables.
An argument form is 𝒗𝒂𝒍𝒊𝒅 no matter which particular propositions are substituted for the
propositional variables in its premises, the conclusion is true if the premises are all true.
The following table gives the rules of inference.
Problem.1. State which rule of inference is the basis of the following argument:
“It is below freezing now. Therefore, it is either below freezing or raining now.”
Solution: Let p be the proposition “It is below freezing now” and q the proposition “It is raining
now.” Then this argument is of the form

This is an argument that uses the addition rule.

Problem.2.
State which rule of inference is the basis of the following argument: “It is below freezing and raining
now. Therefore, it is below freezing now.”
Solution:
Let p be the proposition “It is below freezing now,” and let q be the proposition “It is raining now.”
This argument is of the form

This argument uses the simplification rule.

Problem.3.
State which rule of inference is used in the argument:
If it rains today, then we will not have a barbecue today. If we do not have a barbecue today, then we
will have a barbecue tomorrow. Therefore, if it rains today, then we will have a barbecue tomorrow.
Solution: Let p be the proposition “It is raining today,” let q be the proposition “We will not have a
barbecue today,” and let r be the proposition “We will have a barbecue tomorrow.” Then this
argument is of the form

Hence, this argument is a hypothetical syllogism.

Problem.4.
Show that the premises “If you send me an e-mail message, then I will finish writing the program,”
“If you do not send me an e-mail message, then I will go to sleep early,” and “If I go to sleep early,
then I will wake up feeling refreshed” lead to the conclusion “If I do not finish writing the program,
then I will wake up feeling refreshed.”
Solution:
Let p be the proposition “You send me an e-mail message,” q the proposition “I will finish writing
the program,” r the proposition “I will go to sleep early,” and s the proposition “I will wake up
feeling refreshed.” Then the premises are 𝑝 → 𝑞, ¬𝑝 → 𝑟, 𝑎𝑛𝑑 𝑟 → 𝑠. The desired conclusion is
¬𝑞 → 𝑠.We need to give a valid argument with premises 𝑝 → 𝑞, ¬𝑝 → 𝑟, and 𝑟 → 𝑠 and
conclusion ¬𝑞 → 𝑠.
This argument form shows that the premises lead to the desired conclusion.

You might also like