0% found this document useful (0 votes)
7 views86 pages

Logic

The document outlines a course on Discrete Mathematics at KIIT, focusing on themes such as mathematical reasoning, combinatorial analysis, and discrete structures. It emphasizes the importance of logic in mathematics and computer science, detailing concepts like propositions, connectives, and conditional statements. The course aims to equip students with logical thinking and problem-solving skills applicable to real-world scenarios.

Uploaded by

dsah5898
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)
7 views86 pages

Logic

The document outlines a course on Discrete Mathematics at KIIT, focusing on themes such as mathematical reasoning, combinatorial analysis, and discrete structures. It emphasizes the importance of logic in mathematics and computer science, detailing concepts like propositions, connectives, and conditional statements. The course aims to equip students with logical thinking and problem-solving skills applicable to real-world scenarios.

Uploaded by

dsah5898
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
You are on page 1/ 86

Discrete Mathematics (DMS)

School of Applied Sciences


Kalinga Institute of Industrial Technology(KIIT)
Deemed to be University, Bhubaneswar
Odisha, India

1/50
Outline

1 Introduction

2 Logic

2/50
Introduction
Logic

About Discrete Mathematics

Discrete mathematics may be taken as real world mathematics. It


encourages students to examine problems on topic like reasoning,
counting, combinatory, etc. to explore the real world which are
interesting and challenging.
It teaches mathematical reasoning and proof techniques.
Students should learn a particular set of mathematical facts and how
to apply them.
In particular such a course teaches students how to think logically
and mathematically. To achieve these goals, mathematical reasoning
and the different kinds of problems are solved.

3/50
Prepared by Dr Vishal Pradhan KIIT Bhubaneswar
Contd...

Five important themes in this course are: Mathematical reasoning,


Combinatorial analysis, Discrete structures, Algorithmic thinking,
and Modeling.
A successful discrete mathematics course should carefully blend and
balance all five themes.
In this course we study first three themes.

4/50
Course contents

I Logic (Chapter 1)
I Sets, Relations and Functions (Chapter 2)
I Recurrence relations and their solutions (Chapter 5)
I Algebraic structures (Other book)
1

1
Text book: Kenneth H. Rosen, Discrete Mathematics and its
Applications, 7th Edition, McGraw Hill Education, 2011
Introduction
Logic

Introduction to Logic

Logic is a set or a system of principles or rules. The rules of logic give


precise meaning to mathematical statements. These rules are used to
distinguish between valid and invalid mathematical arguments and
specify the meaning of mathematical statements.

6/50
Prepared by Dr Vishal Pradhan KIIT Bhubaneswar
Contd...

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. To understand mathematics,
we must understand what makes up a correct mathematical
argument, that is, a proof. Everyone knows that proofs are important
throughout mathematics, but many people find it surprising how
important proofs are in computer science. In fact, proofs are used to
verify that computer programs produce the correct output for all
possible input values, to show that algorithms always produce the
correct result, to establish the security of a system, and to create
artificial intelligence. Furthermore, automated reasoning systems have
been created to allow computers to construct their own proofs.
First we will explain what makes up a correct mathematical argument
and then introduce tools to construct these arguments.

7/50
Proposition

Definition
A proposition is a declarative sentence that is either true or false, but
not both.

Example (Example 1)
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.
Proposition contd...

Example (Example 2)
Consider the following sentences.
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 some values to the variables x, y and z.

9/50
Proposition contd...

We use letters to denote propositional variables (or statement


variables). The conventional letters used for propositional variables
are
p, q, r, s, . . .
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.
Example
Let us consider a proposition “KIIT is an esteemed institution in
Odisha”.
It can be written in terms of variable as

p: KIIT is an esteemed institution in Odisha

Truth value of the proposition is true.

10/50
Proposition contd...

Definition (Atomic propositions)


Propositions that cannot be expressed in terms of simpler propositions
are called atomic propositions.

Definition (Compound propositions)


Propositions that are constructed by combining two or more atomic
propositions by using logical operators are called compound
propositions.

Thus, compound propositions are formed from existing propositions


using logical operators.
Note: To study the truth values of a compound statement we
represent all the possible cases in a table called truth table.

11/50
Negation

Definition (Negation)
Let p be a proposition. The negation of p, denoted by ∼ p, is the
statement It is not the case that p.

The proposition “∼ p” is also read as “not p. The truth value of ∼ p,


is the opposite of the truth value of p.
The Truth Table for the Negation of a Proposition is given below:

p ∼p
T F
F T

12/50
Negation contd...

Example (Negation)
Find the negation of the proposition p : Michaels PC runs Linux.

I The negation is “∼ p : It is not the case that Michaels PC runs


Linux.
I This negation can be more simply expressed as “∼ p : Michaels PC
does not run Linux.

Example (Negation)
Find the negation of the proposition q : Jennifer and Teja are friends..

I The negation is “∼ q : It is not the case that Jennifer and Teja are
friends.
I This negation can be more simply expressed as “∼ q : Jennifer and
Teja are not friends.
Negation contd...

Example (Negation)
Find the negation of the proposition Vandanas smartphone has at
least 32GB of memory and express this in simple English.

I The negation is “It is not the case that Vandanas smartphone has
at least 32GB of memory.
I This negation can also be expressed as “Vandanas smartphone does
not have at least 32GB of memory.
I or even more simply as “Vandanas smartphone has less than 32GB
of memory.

14/50
Connectives

Connectives:
We will now introduce the logical operators that are used to form new
propositions from two or more existing propositions. These logical
operators are also called connectives.

Conjunction:
Let p and q be propositions. The conjunction 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 Truth Table for the conjunction p ∧ q is given below:

p q p∧q
T T T
T F F
F T F
F F F

15/50
Connectives contd...

Example
Find the conjunction of the propositions p and q where p is the
proposition Rebeccas PC has more than 16 GB free hard disk space
and q is the proposition The processor in Rebeccas PC runs faster
than 1 GHz.

I The conjunction of these propositions is the proposition Rebeccas


PC has more than 16 GB free hard disk space, and the processor in
Rebeccas PC runs faster than 1 GHz.
I This conjunction can be expressed more simply as Rebeccas PC has
more than 16 GB free hard disk space, and its processor runs faster
than 1 GHz.
For this conjunction to be true, both conditions given must be true.
It is false, when one or both of these conditions are false.

Note: In logic the word but sometimes is used instead of and in a


conjunction. For example, the statement The sun is shining, but it is
raining is another way of saying The sun is shining and it is raining.
Connectives contd...

Disjunction:
Let p and q be propositions. The disjunction 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 Truth Table for the disjunction p ∨ q is given below:

p q p∨q
T T T
T F T
F T T
F F F

17/50
Connectives contd...

Example
Translate the statement Students who have taken calculus or
introductory computer science can take this class in a statement in
propositional logic using the propositions p: A student who has taken
calculus can take this class and q: A student who has taken
introductory computer science can take this class.

I We assume that this statement means that students who have


taken both calculus and Introductory computer science can take the
class, as well as the students who have taken only one of the two
subjects. Hence, this statement can be expressed as p ∨ q, the
disjunction of p and q.

18/50
Connectives contd...

There are two types of or are used in English, inclusive or and


exclusive or. The use of the connective or in a disjunction corresponds
to inclusive or. For instance, the inclusive or is being used in the
previous example.
On the other hand, we are using the exclusive or when we say
Students who have taken calculus or computer science, but not both,
can enroll in this class. Here, we mean that students who have taken
both calculus and a computer science course cannot take the class.
Only those who have taken exactly one of the two courses can take
the class. In everyday conversation when we say p or q we mean p is
true or q is true, but not both p and q are true. For example, the door
is open or the door is closed. Similarly, when a menu at a restaurant
states, Soup or salad comes with an entre, the restaurant almost
always means that customers can have either soup or salad, but not
both. Hence, this is an exclusive, rather than an inclusive or.
In this course we refer to inclusive or whenever we use or.
Connectives contd...

Exclusive or:
Let p and q be propositions. The exclusive or of p and q, denoted by
p ⊕ q, is the proposition that is true when exactly one of p and q is
true and is false otherwise.

p q p⊕q
T T F
T F T
F T T
F F F

20/50
Connectives contd...

Example
Express the statement I will use all my savings to travel to Europe or
to buy an electric car in propositional logic using the statement p: I
will use all my savings to travel to Europe and the statement q: I will
use all my savings to buy an electric car.

I To translate this statement, we first note that the or in this


statement must be an exclusive or because this person can either use
all his or her savings to travel to Europe or use all these savings to buy
an electric car, but cannot both go to Europe and buy an electric car.
(This is clear because either option requires all his savings.) Hence,
this statement can be expressed as p ⊕ q.

21/50
Conditional Statement

Definition
Let p and q be propositions. The conditional statement p → q is the
proposition if p then q.

The conditional statement p → q is false when p is true and q is false,


and true otherwise.
In the conditional statement p → q, p is called the hypothesis and q is
called the conclusion.

Truth table:

p q p→q
T T T
T F F
F T T
F F T

22/50
Conditional statement contd...

Example (Conditional statement)


Let p be the statement “Maria learns discrete mathematics” and q the
statement “Maria will find a good job”. Express the statement p → q
as a statement in English.

I Given that “p: Maria learns discrete mathematics” and “q: Maria
will find a good job”.
From the definition of conditional statements, we see that p → q
represents the statement “If Maria learns discrete mathematics then
she will find a good job.”
I There are many other ways to express this conditional statement
in English. Among the most natural of these are:
•“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.
Conditional statement contd...

Example (Truth value determine)


The way we have defined conditional statements is more general than
the meaning attached to such statements in the English language.
I For instance, the conditional statement “If it is sunny, then we will
go to the beach” is true unless it is indeed sunny, but we do not go to
the beach.
I The statement “If Shelly has a smartphone, then 2 + 3 = 5” is true
from the definition of a conditional statement, because its conclusion
is true.
Conditional statement contd...

Because conditional statements play such an essential role in


mathematical reasoning, a variety of terminology is used to express
p → q.
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 ∼ p q provided that p

25/50
Converse, Inverse and Contrapositive

We can form some new conditional statements starting with a


conditional statement p → q. In particular, there are three related
conditional statements that occur so often that they have special
names.

I The proposition q → p is called the converse of p → q.


I The proposition ∼ p →∼ q is called the inverse of p → q.
I The proposition ∼ q →∼ p is called the contrapositive of p → q.
Converse, Inverse and Contrapositive contd...

Example
What are the contrapositive, the converse, and the inverse of the
conditional statement “The home team wins whenever it is raining”.

Because “q whenever p is one of the ways to express the conditional


statement p → q, the original statement can be rewritten as “if it is
raining, then the home team wins.

I Contrapositive statement is “If the home team does not win, then
it is not raining.”
I Converse statement is “If the home team wins, then it is raining.”
I Inverse statement is “If it is not raining, then the home team does
not win.”
Note: We will see that of these three conditional statements formed
from p → q, only the contrapositive always has the same truth value
as p → q.

27/50
Converse, Inverse and Contrapositive contd...

Truth Table:
p q p→q q→p ∼p ∼q ∼ p →∼ q ∼ q →∼ p
T T T T F F T T
T F F T F T T F
F T T F T F F T
F F T T T T T T

28/50
Biconditional statement

Definition (Biconditional statement)


Let p and q be propositions. The biconditional statement p ↔ q is the
proposition “p if and only if q.”

The biconditional statement p ↔ q is true when p and q have the


same truth values, and is false otherwise.

Truth table:

p q p↔q
T T T
T F F
F T F
F F T
Biconditional statement contd...

Example
Let p be the statement “You can take the flight,” and let q be the
statement “You buy a ticket.” Then biconditional statement p ↔ q is
the statement “You can take the flight if and only if you buy a ticket.”

There are some other common ways to express p ↔ q:


“p is necessary and sufficient for q”;
“if p then q, and conversely”;
“p if and only if q”;
“p exactly when q.”
Rules of Precedence
We will generally use parenthesis to write a compound statement.
But sometimes it is not used. In that case we need to know the order
of precedence of logical operators otherwise it will be confusing.

Operators Precedence
∼ 1
∧ 2
∨, ⊕ 3
→ 4
↔ 5

Example
∼p∧q ⇒ (∼ p) ∧ q
p∧q∨r ⇒ (p ∧ q) ∨ r
p→q∨r ⇒ p → (q ∨ r)
∼p⊕q →r∧s ⇒ ((∼ p) ⊕ q) → (r ∧ s)
Applications of Propositional Logic

Statements in mathematics and the sciences and in natural language


often are imprecise or ambiguous. To make such statements precise,
they can be translated into the language of logic.

Logic is used in the specification of software and hardware, because


these specifications need to be precise before development begins.

Propositional logic and its rules can be used to design computer


circuits, to construct computer programs, to verify the
correctness of programs, and to build expert systems.

Logic can be used to analyze and solve many familiar puzzles.

32/50
Applications contd...

Translating English Sentences:


English and every other human languages are often ambiguous and
translating sentences into compound statements removes the
ambiguity. Moreover, once we have translated sentences from English
into logical expressions, we can analyze these logical expressions to
determine their truth values and we can manipulate them.

33/50
Applications contd...

System Specifications:
Translating sentences in natural language into logical expressions is
an essential part of specifying both hardware and software systems.

System and software engineers take requirements in natural language


and produce precise and unambiguous specifications that can be used
as the basis for system development.

System specifications should be consistent, that is, they


should not contain conflicting requirements that could be
used to derive a contradiction.
Applications contd...

Example
Determine whether these system specifications are consistent:
“The diagnostic message is stored in the buffer or it is retransmitted.”
“The diagnostic message is not stored in the buffer.”
“If the diagnostic message is stored in the buffer, then it is
retransmitted.”

To determine whether these specifications are consistent, we first


express them using logical expressions. Let p : The diagnostic message
is stored in the buffer and let q : The diagnostic message is
retransmitted. The specifications can then be written as p ∨ q, ∼ p,
and p → q. An assignment of truth values that makes all three
specifications true must have p false to make ∼ p true. Because we
want p ∨ q to be true but p must be false, q must be true. Because
p → q is true when p is false and q is true, we conclude that these
specifications are consistent, because they are all true when p is false
and q is true. We could come to the same conclusion by use of a truth
table to examine the four possible assignments of truth values to p
and q.
35/50
Applications contd...

Example
Alternative: To determine whether the above mentioned
specifications are consistent or not, we first express them using logical
expressions. Let p : The diagnostic message is stored in the buffer and
let q : The diagnostic message is retransmitted. The specifications can
then be written as p ∨ q, ∼ p, and p → q. We have to find an
assignment of truth values that makes all three specifications true. It
can be viewed by constructing the truth table.

p q ∼p p∨q p→q
T T F T T
T F F T F
F T T T T
F F T F T

It is seen that all the specifications are true when p is false and q is
true. So, the system specifications are consistent.
Applications contd...

Example
In continuation with the previous example, if another specification
“The diagnostic message is not retransmitted” is added, then check
the consistency.

By the reasoning in previous example, the three specifications from


that example are true only in the case when p is false and q is true.
However, this new specification is ∼ q, which is false when q is true.
Consequently, these four specifications are inconsistent.

37/50
Applications contd...

Boolean Searches:
Logical connectives are used extensively in searches of large
collections of information, such as indexes of Web pages. Because
these searches employ techniques from propositional logic, they are
called Boolean searches. In Boolean searches, the connective AND is
used to match records that contain both of two search terms, the
connective OR is used to match one or both of two search terms, and
the connective NOT (sometimes written as AND NOT) is used to
exclude a particular search term. Careful planning of how logical
connectives are used is often required when Boolean searches are used
to locate information of potential interest.

38/50
Applications contd...

Logic Circuits:
Propositional logic can be applied to the design of computer
hardware. A logic circuit (or digital circuit) receives input signals
p1 , p2 , . . . pn each a bit [either 0 (off) or 1 (on)], and produces output
signals s1 , s2 , . . . sn each a bit. In this section we will restrict our
attention to logic circuits with a single output signal; in general,
digital circuits may have multiple outputs. Complicated digital
circuits can be constructed from three basic circuits, called gates, as
shown in the below figure.

39/50
Applications contd...

We use combinations of these three basic gates build more


complicated circuits. One such example is shown in the below figure.

40/50
Applications contd...
Logic Puzzles:
Puzzles that can be solved using logical reasoning are known as logic
puzzles. Solving logic puzzles is an excellent way to practice working
with the rules of logic. Also, computer programs designed to carry
out logical reasoning often use well-known logic puzzles to illustrate
their capabilities. Many people enjoy solving logic puzzles, published
in periodicals, books, and on the Web, as a recreational activity.
Example
A father tells his two children, a boy and a girl, to play in their
backyard without getting dirty. However, while playing, both children
get mud on their foreheads. When the children stop playing, the
father says “At least one of you has a muddy forehead,” and then
asks the children to answer “Yes” or “No” to the question: “Do you
know whether you have a muddy forehead?” The father asks this
question twice. What will the children answer each time this question
is asked, assuming that a child can see whether his or her sibling has
a muddy forehead, but cannot see his or her own forehead? Assume
that both children are honest and that the children answer each
question simultaneously.
41/50
Applications contd...

Example (Answer)
Let p be the statement that the son has a muddy forehead and let q
be the statement that the daughter has a muddy forehead. When the
father says that at least one of the two children has a muddy
forehead, he is stating that the disjunction p ∨ q is true. Both children
will answer “No” the first time the question is asked because each sees
mud on the other child’s forehead. That is, the son knows that q is
true, but does not know whether p is true, and the daughter knows
that p is true, but does not know whether q is true.
After the son has answered “No” to the first question, the daughter
can determine that q must be true. This follows because when the
first question is asked, the son knows that p ∨ q is true, but cannot
determine whether p is true. Using this information, the daughter can
conclude that q must be true, for if q were false, the son could have
reasoned that because p ∨ q is true, then p must be true, and he would
have answered “Yes” to the first question. The son can reason in a
similar way to determine that p must be true. It follows that both
children answer “Yes” the second time the question is asked.
Tautology, contradiction and contingency

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.

Example
We can construct examples of tautologies and contradictions using
just one propositional variable. Consider the truth tables of p∨ ∼ p
and p∧ ∼ p.

p ∼p p∨ ∼ p p∧ ∼ p
T F T F
F T T F

Because p∨ ∼ p is always true, it is a tautology. Because p∧ ∼ p is


always false, it is a contradiction.
43/50
Logical Equivalences

When two compound propositions always have the same truth values,
regardless of the truth values of its propositional variables, we call
them equivalent.
Definition
The compound propositions p and q are called logically equivalent if
p ↔ q is a tautology.

The notation p ≡ q denotes that p and q are logically equivalent.


Sometimes it is denoted by p ⇔ q

An easiest way to determine logical equivalence between two


compound propositions is to use truth table.

Hence a conditional statement and its contrapositive are equivalent.

44/50
Logical equivalences contd...

Example
Show that p → q ≡∼ p ∨ q.

p q ∼p p→q ∼p∨q
T T F T T
T F F F F
F T T T T
F F T T T

Here we see that the columns for p → q and ∼ p ∨ q are identical, i.e.,
they agree for all possible combinations of the truth values of p and q.
Hence two given compound propositions are logically equivalent.
Logical equivalences contd...

De Morgan’s Law
For any two propositions p and q,

∼ (p ∧ q) ≡ (∼ p∨ ∼ q) and ∼ (p ∨ q) ≡ (∼ p∧ ∼ q)

These two laws can be verified by using their truth tables.


Logical equivalences contd...
In the following equivalences, T denotes the compound proposition
that is always true and F denotes the compound proposition that is
always false.

47/50
Logical equivalences contd...

(a) Conditional equivalences (b) Biconditional equivalences

Logical equivalences in the above three tables can be used to


construct additional logical equivalences. See Example 6-8 from your
text book (Section 1.2).

48/50
Well-Formed Formulae (WFF)

Well-Formed Formulae (WFF)


I Every atomic proposition is well-formed formulae.
I If p and q are well-formed formulae, then (∼ p), (p ∧ q), (p ∨ q),
(p → q), and (p ↔ q) are well-formed formulae.

Example
The proposition (p ∧ q) ∨ r is a wff whereas p ∧ q ∨ r is not wff.
p ∼ ∧q and pq∨ are not wff.

49/50
Functionally complete set of connectives

Definition
A set of connectives is called functionally complete if every compound
proposition can be expressed as a logically equivalent proposition
involving only these connectives.

Example
The set {∼, ∧}, {∼, ∨}, {∼, ∧, ∨} are functionally complete.
Propositional Satisfiability
Definition
A compound proposition is satisfiable if there is an assignment of
truth values to its variables that makes it true (i.e., when it is a
tautology or a contingency).
When no such assignments exists, i.e., when the compound
proposition is false for all assignments of truth values to its variables,
the compound proposition is unsatisfiable.

When we find an assignment of truth values that makes a compound


proposition true, we call that particular assignment as a solution of a
satisfiable problem.

Negation of a unsatisfiable compound proposition is a tautology and


negation of a tautology is unsatisfiable.

Many problems, in diverse areas such as robotics, software testing,


computer-aided design,machine vision, integrated circuit design,
computer networking, and genetics, can be modeled in terms of
propositional satisfiability. Most of these applications are beyond the
scope of this book. One example is given in book–Model Sudoku
puzzles. 51/50
Propositional Satisfiability contd...

Example
Determine whether each of the following compound proposition is
satisfiable.
1 (p∨ ∼ q) ∧ (q∨ ∼ r) ∧ (r∨ ∼ p)
2 (p ∨ q ∨ r) ∧ (∼ p∨ ∼ q∨ ∼ r)

1. Note that (p∨ ∼ q) ∧ (q∨ ∼ r) ∧ (r∨ ∼ p) is true when the three


variable p, q, and r have the same truth value. Hence, it is satisfiable
as there is at least one assignment of truth values for p, q, and r that
makes it true.
2. Note that (p ∨ q ∨ r) ∧ (∼ p∨ ∼ q∨ ∼ r) is true when at least one of
p, q, and r is true and at least one is false. Hence,
(p ∨ q ∨ r) ∧ (∼ p∨ ∼ q∨ ∼ r) is satisfiable, as there is at least one
assignment of truth values for p, q, and r that makes it true.
Predicates
Grammatical perspective
Predicate is the part of a sentence or clause containing a verb and
stating something about the subject.

Statement: Ankit is a student of KIIT


Subject: Ankit
Predicate: is a student of KIIT
Propositional logic cannot adequately express the meaning of all
statements in mathematics and in natural language. For example we
consider,
Example
p: All students of ECS at KIIT are studious.
q: Tushar is a student of ECS at KIIT.

r: Tushar is studious.

There are no rules of propositional logic which allow us to conclude


the truth value of the statement r by using p and q. However,
logically we can conclude that if p and q are true, then r will be true.
53/50
Predicates contd...

Thus, we introduce the notion of predicate logic to express the


meaning of a wide range of statements in mathematics and computer
science in ways that permit us to reason and explore relationships
between objects.
Statements involving variables, such as “x > 3,” “x = y + 3,”
“x + y = z,” “computer x is under attack by an intruder,” “computer
x is functioning properly,” and “x is brilliant” etc. are often found in
mathematical assertions, in computer programs, and in system
specifications. These statements are neither true nor false until unless
the values of the variables are specified.
Predicates contd...

We can denote the statement “x is greater than 3” by P (x), where 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.

Definition
A predicate is a statement that contains variables and they may be
true or false depending on the values of these variables.

Definition
The domain of a predicate is the collection of all possible values that
the variable may take.
Predicates contd...

Example
Consider the predicate P (x) : “x2 > 10”, where the domain is Z. Find
the truth value of P (2) and P (−5).

Here the proposition P (2) : “4 > 10” is false and the proposition
P (−5) : “25 > 10” is true.

56/50
Quantifiers

Quantifier is a determiner or pronoun indicative of quantity. When


the variables in a propositional function are assigned values, the
resulting statement becomes a proposition with a certain truth value.
However, there is another important way, called quantification, to
create a proposition from a propositional function. 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 quantification. Here, we mainly focus on two types of
quantification: 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.
Universal Quantifiers

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),
often just referred to as the domain. Such a statement is expressed
using universal quantification.
Definition
The universal quantification of P (x) is the statement “P (x) for all
values of x in the domain.”

The notation ∀x P (x) denotes the universal quantification of P (x).


Here, ∀ is called the universal quantifier.
Universal Quantifiers contd...
The universal quantification ∀x P (x) is true if and only if P (x) is true
for all x in a domain and it is false if there exists some element in the
domain for which P (x) is false. An element for which P (x) is false is
called a counter-example of ∀x P (x).

Example
Let P (x) be the statement “x + 1 > x.” What is the truth value of the
quantification ∀x P (x), where the domain consists of all real numbers?

Because P (x) is true for all real numbers x, the quantification


∀x P (x) is true.

Example
Let Q(x) be the statement “x < 2.” What is the truth value of the
quantification ∀x Q(x), where the domain consists of all real numbers?

Q(x) is not true for every real number x, because, for instance, Q(3)
is false. That is, x = 3 is a counter-example for the statement
∀x Q(x). Thus ∀x Q(x) is false.
59/50
Universal Quantifiers contd...
Besides “for all” universal quantification can be expressed in many
other ways, including “for every,” “all of,” “for each,” “given any,”
“for arbitrary,” “for each” etc.

When all the elements in the domain can be listed, say, x1 , x2 , . . . , xn ,


it follows that the universal quantification ∀x P (x) is the same as the
conjunction P (x1 ) ∧ P (x2 ) ∧ P (x3 ) ∧ · · · ∧ P (xn ).

Note: If the domain of discourse is empty for universal quantification


∀x P (x), then it is always true.

Example
What is the truth value of ∀x P (x), where P (x) is the statement
“x2 < 10” and the domain consists of the positive integers not
exceeding 4?

The statement ∀x P (x) is the same as the conjunction


P (1) ∧ P (2) ∧ P (3) ∧ P (4), because the domain consists of the integers
1, 2, 3, and 4. Because P (4), which is the statement “42 < 10,” is
false, it follows that ∀x P (x) is false.
60/50
Existential Quantifiers
The Existential Quantifier: Many mathematical statements
assert that there is an element with a certain property. Such
statements are expressed using existential quantification.
Definition
The existential quantification of P (x) is the proposition “There exists
an element x in the domain such that P (x).”

We use the notation ∃x P (x) for the existential quantification of


P (x). Here ∃ is called the existential quantifier.

An existential quantification ∃x P (x) is true if and only if P (x) is


true for at least one value of x in the domain. If there exists no such
element for which P (x) is true, then it is false.
Example
Let P (x) denote the statement “x > 3.” What is the truth value of
the quantification ∃x P (x), where the domain consists of all real
numbers?

The statement “x > 3” is true sometimes. For instance, when x = 4


the existential quantification of P (x), which is ∃x P (x), is true. 61/50
Existential Quantifiers contd...
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.”

When all elements in the domain can be listed, say, x1 , x2 , . . . , xn , the


existential quantification ∃x P (x) is the same as the disjunction
P (x1 ) ∨ P (x2 ) ∨ · · · ∨ P (xn ).

Note: If the domain of discourse is empty, then the existential


quantification ∃x P (x) is false.

Example
What is the truth value of ∃x P (x), where P (x) is the statement
“x2 > 10” and the universe of discourse consists of the positive
integers not exceeding 4?

Because the domain is {1, 2, 3, 4}, the proposition ∃x P (x) is the same
as the disjunction P (1) ∨ P (2) ∨ P (3) ∨ P (4). Because P (4), which is
the statement “42 > 10,” is true, it follows that ∃x P (x) is true.

62/50
Quantifiers with Restricted Domains

An abbreviated notation is often used to restrict the domain of a


quantifier. In this notation, a condition a variable must satisfy is
included after the quantifier.
Example
What do the statements ∀x < 0 (x2 > 0), and ∃z > 0 (z 2 = 2) mean,
where the domain in each case consists of the real numbers?

The statement ∀x < 0 (x2 > 0) states that for every real number x
with x < 0, x2 > 0. That is, it states “The square of a negative real
number is positive.” This statement is the same as
∀x (x < 0 → x2 > 0).
Secondly, the statement ∃z > 0 (z 2 = 2) states that there exists a real
number z with z > 0 such that z 2 = 2. That is, it states “There is a
positive square root of 2.” This statement is equivalent to
∃z (z > 0 ∧ z 2 = 2).

63/50
Binding Variables

When a quantifier is used on the variable x, we say that this


occurrence of the variable is bound. An occurrence of a variable that
is not bound by a quantifier or set equal to a particular value is said
to be free. The part of a logical expression to which a quantifier is
applied is called the scope of this quantifier.
Example
In the statement ∃x (x · y = 1), the variable x is bound by the
existential quantification ∃x, but the variable y is free because it is
not bound by a quantifier and no value is assigned to this variable.
This illustrates that in the statement ∃x (x · y = 1), x is bound, but y
is free.

In the statement ∀x (P (x) ∧ Q(x)), the scope of the quantifier, ∀x, is


the expression P (x) ∧ Q(x) because ∀x is applied to P (x) ∧ Q(x).

64/50
Logical Equivalences Involving Quantifiers

Definition
Statements involving predicates and quantifiers are logically equivalent
if and only if they have the same truth value no matter which
predicates are substituted into these statements and which domain of
discourse is used.

We use the notation S ≡ T to indicate that two statements S and T


involving predicates and quantifiers are logically equivalent.

Example
Show that ∀x (P (x) ∧ Q(x)) ≡ ∀x P (x) ∧ ∀x Q(x) (where the same
domain is used throughout).

To show that these statements are logically equivalent, we must show


that they always take the same truth value, no matter what the
predicates P and Q are, and no matter which domain of discourse is
used. Suppose we have particular predicates P and Q, with a
common domain of discourse D.
65/50
Logical Equivalence contd...

Suppose that ∀x (P (x) ∧ Q(x)) is true. Let a ∈ D.


⇒ P (a) ∧ Q(a) is true
⇒ P (a) is true and Q(a) is true
∵ a is arbitrarily taken from the domain D
⇒ P (x) is true for all x and Q(x) is true for all x
⇒ ∀x P (x) is true and ∀x Q(x) is true
⇒ ∀x P (x) ∧ ∀x Q(x) is true

Conversely, we consider ∀x P (x) ∧ ∀x Q(x) is true and Let a ∈ D.


⇒ ∀x P (x) is true and ∀x Q(x) is true
∵ a is an element in the domain D
⇒ P (a) is true and Q(a) is true
⇒ P (a) ∧ Q(a) is true
∵ a is arbitrarily taken from the domain D
⇒ P (x) ∧ Q(x) is true for all x
⇒ ∀x (P (x) ∧ Q(x)) is true.
We can now conclude that ∀x (P (x) ∧ Q(x)) ≡ ∀x P (x) ∧ ∀x Q(x).

66/50
Negation of Quantifiers

Show that ∼ ∀x P (x) ≡ ∃x ∼ P (x).

Consider ∼ ∀x P (x) is true.


⇔ ∀x P (x) is false
⇔ there is an element x in the domain for which P (x) is false
⇔ there is an element x in the domain for which ∼ P (x) is true
⇔ ∃x ∼ P (x) is true

Similarly we can prove that

∼ ∃x P (x) ≡ ∀x ∼ P (x).

The above two rules for negations for quantifiers are called De
Morgans laws for quantifiers.
Negation of Quantifiers contd...

Example
What are the negations of the statements “There is an honest
politician” and “All Americans eat cheeseburgers”?

I Let H(x) denote “x is honest.” Then the statement “There is an


honest politician” is represented by ∃x H(x), where the domain
consists of all politicians. The negation of this statement is
∼ ∃x H(x), which is equivalent to ∀x ∼ H(x). This negation can be
expressed as “Every politician is dishonest.”

I Let C(x) denote ”x eats cheeseburgers.” Then the statement “All


Americans eat cheeseburgers” is represented by ∀x C(x), where the
domain consists of all Americans. The negation of this statement is
∼ ∀x C(x), which is equivalent to ∃x ∼ C(x). This negation can be
expressed in several different ways, including “Some American does
not eat cheeseburgers” and “There is an American who does not eat
cheeseburgers.”
Some more examples

Example
Express the statement “Every student in this class has studied
calculus” using predicates and quantifiers.

I We introduce a variable x so that our statement becomes “For


every student x in this class, x has studied calculus.” Here the domain
of discourse is the set of all students in this class. We consider the
predicate C(x), which is the statement x has studied calculus.”
Consequently, the given statement can be written as ∀x C(x).

I Alternatively, If we change the domain to consist of all people, we


will need to express our statement as “For every person x, if person x
is a student in this class then x has studied calculus.” If S(x)
represents the statement that “the person x is in this class”, we see
that our statement can be expressed as ∀x (S(x) → C(x)).

69/50
Some more examples contd...

Example
Express the statements “Some student in this class has visited
Mexico” using predicates and quantifiers.

I We can introduce a variable x, so that our statement becomes


“There is a student x in this class having the property that x has
visited Mexico.” Here the set of all students in the class is the domain
of discourse. We introduce M (x), which is the statement “x has
visited Mexico.” If the domain for x consists of the students in this
class, we can translate this first statement as ∃x M (x).

I Alternatively, if we take the domain of discourse as all people


instead of those in this class, the statement can be expressed as
“There is a person x having the properties that x is a student in this
class and x has visited Mexico.” We introduce S(x) to represent “x is
a student in this class.” Our solution becomes ∃x (S(x) ∧ M (x)).

70/50
Some more examples contd...

Example
Show that ∼ ∀x (P (x) → Q(x)) and ∃x (P (x)∧ ∼ Q(x)) are logically
equivalent.

By De Morgans law for universal quantifiers, we have

∼ ∀x (P (x) → Q(x)) ≡ ∃x ∼ (P (x) → Q(x))


≡ ∃x ∼ (∼ P (x) ∨ Q(x))
≡ ∃x (P (x)∧ ∼ Q(x))
Rules of Inference in Propositional Logic

Definition (Argument: Premises, Conclusion, Valid Argument)


An argument in propositional logic is a sequence of propositions. All
but the final proposition in the argument are called premises and the
final proposition is called the conclusion. An argument is valid if the
truth of all its premises implies that the conclusion is true.

Definition (Argument form)


An argument form in propositional logic is a sequence of compound
propositions involving propositional variables. An argument form is
valid no matter which particular propositions are substituted for the
propositional variables in its premises, the conclusion is true if the
premises are all true.

72/50
Rules of inference contd...

Example
Consider the following argument involving propositions: “If you have
a current password, then you can log onto the network.”
“You have a current password.”
Therefore, “You can log onto the network.”

Here, the first two statements “If you have a current password, then
you can log onto the network” and “You have a current password” are
the premises of the argument and final statement “You have a current
password” is the conclusion of the argument.

To write the above argument in argument form we take


p : you have a current password
q : you can log onto the network
Then, the above argument has the form
p→q
p
∴ q
73/50
Rules of inference contd...

From the definition of a valid argument form we see that the


argument form with premises p1 , p2 , . . . , pn and conclusion q is valid,
when (p1 ∧ p2 ∧ · · · ∧ pn ) → q is a tautology.

The key to showing that an argument in propositional logic is valid is


to show that its argument form is valid.
Example
In continuation to the previous example, we know that when p and q
are propositional variables, the statement ((p → q) ∧ p) → q is a
tautology. In particular, when both p → q and p are true, we know
that q must also be true. We say this form of argument is valid
because whenever all its premises are true, the conclusion must also
be true. Since the argument form is valid we can say that the
argument is valid.

74/50
Rules of Inference for Propositional Logic

To deduce new statements from statements that we already have, we


use rules of inference which are templates for constructing valid
arguments.

A relatively simple argument form which is valid is called rules of


inference. These rules of inference can be used as building blocks to
construct more complicated valid argument forms.

We will now introduce the most important rules of inference in


propositional logic which are given by the following table.

75/50
Rules of Inference contd...

Figure: Rules of inference for propositional logic


76/50
Rules of Inference contd...
Using Rules of Inference to Build Arguments: When
there are many premises, several rules of inference are often needed to
show that an argument is valid.
Example
Show that the premises “It is not sunny this afternoon and it is colder
than yesterday,” “We will go swimming only if it is sunny,” “If we do
not go swimming, then we will take a canoe trip,” and “If we take a
canoe trip, then we will be home by sunset” lead to the conclusion
“We will be home by sunset.”

Let us denote the propositions in terms of propositional variables as


p:“It is sunny this afternoon,”
q:“It is colder than yesterday,”
r:“We will go swimming,”
s:“We will take a canoe trip,” and
t:“We will be home by sunset.”
Then the premises become ∼ p ∧ q, r → p, ∼ r → s, and s → t and
the conclusion becomes t.

77/50
Rules of Inference contd...

Example (continued)
We construct an argument to show that our premises lead to the
desired conclusion as follows.
∼p∧q
∴∼ p (by Simplification rule)
r→p
∴∼ r (by Modus tollens rule)
∼r→s
∴ s (by Modus ponens rule)
s→t
∴ t (by Modus ponens rule)
Fallacies

Several common fallacies arise in incorrect arguments. These fallacies


resemble rules of inference, but are based on contingencies rather than
tautologies. These are discussed here to show the distinction between
correct and incorrect reasoning.

Fallacy of affirming the conclusion:


p→q
q
∴p
Fallacy of denying the hypothesis:
p→q
∼p
∴∼ q

79/50
Fallacies contd...

Example
Given an argument “If you do every problem in this book, then you
will learn discrete mathematics.” “You learned discrete mathematics.”
Therefore, “you did every problem in this book.” Check whether the
argument is valid?

Let p be the proposition “You did every problem in this book.” Let q
be the proposition “You learned discrete mathematics.” Then this
argument is of the form:
p→q
q
∴p
This is an example of an incorrect argument using the fallacy of
affirming the conclusion. Indeed, it is possible for you to learn
discrete mathematics in some way other than by doing every problem
in this book. (You may learn discrete mathematics by reading,
listening to lectures, doing some, but not all, the problems in this
book, and so on.)
80/50
Rules of Inference for Quantified Statements
We have discussed rules of inference for propositions. We will now
describe some important rules of inference for statements involving
quantifiers. These rules of inference are used extensively in
mathematical arguments, often without being explicitly mentioned.

Figure: Rules of inference for quantifiers

81/50
Rules of Inference contd...

Example
Show that the premises “Everyone in this discrete mathematics class
has taken a course in computer science” and “Marla is a student in
this class” imply the conclusion “Marla has taken a course in
computer science.”

Let D(x) denote “x is in this discrete mathematics class,” and let


C(x) denote “x has taken a course in computer science.” Then the
premises are ∀x (D(x) → C(x)) and D(M arla). The conclusion is
C(M arla).
The following steps can be used to establish the conclusion from the
premises.
∀x (D(x) → C(x))
∴ D(M arla) → C(M arla) (by Universal instantiation)
D(M arla)
∴ C(M arla) (by Modus ponens)

82/50
Rules of Inference contd...

Example
Show that the premises “A student in this class has not read the
book,” and “Everyone in this class passed the first exam” imply the
conclusion “Someone who passed the first exam has not read the
book.”

Let C(x) be “x is in this class,” B(x) be “x has read the book,” and
P (x) be “x passed the first exam.” The premises are
∃x (C(x)∧ ∼ B(x)) and ∀x (C(x) → P (x)). The conclusion is
∃x (P (x)∧ ∼ B(x)).
Rules of Inference contd...

Example (continued)
These steps can be used to establish the conclusion from the premises.
∃x (C(x)∧ ∼ B(x))
∴ C(a)∧ ∼ B(a) (by Existential instantiation)
∴ C(a) (by Simplification)
∀x (C(x) → P (x))
C(a) → P (a) (by Universal instantiation)
∴ P (a) (by Modus ponens)
∼ B(a)
∴ P (a)∧ ∼ B(a) (by Conjunction)
∴ ∃x (P (x)∧ ∼ B(x)) (by Existential generalization)

84/50
Rules of Inference contd...

Universal instantiation and modus ponens are used so often together.


This combination of rules is sometimes called universal modus
ponens. It is written as follows:
∀x (P (x) → Q(x))
P (a), where a is a particular element in the domain
∴ Q(a)

Another useful combination of a rule of inference from propositional


logic and a rule of inference for quantified statements is universal
modus tollens. Universal modus tollens combines universal
instantiation and modus tollens and can be expressed in the following
way:
∀x (P (x) → Q(x))
∼ Q(a), where a is a particular element in the domain
∴∼ P (a)

85/50
Rules of Inference contd...

Example
Assume that “For all positive integers n, if n is greater than 4, then
n2 is less than 2n ” is true. Use universal modus ponens to show that
1002 < 2100 .

Let P (n) denote “n > 4” and Q(n) denote “n2 < 2n .” The statement
“For all positive integers n, if n is greater than 4, then n2 is less than
2n ” can be represented by ∀n (P (n) → Q(n)), where the domain
consists of all positive integers. We are assuming that
∀n (P (n) → Q(n)) is true. Note that P (100) is true because 100 > 4.
Then by universal modus ponens
∀n (P (n) → Q(n))
P (100)
∴ Q(100)
i.e. 1002 < 2100

You might also like