0% found this document useful (0 votes)
0 views

Unit 1

Uploaded by

aquaruhoshino
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Unit 1

Uploaded by

aquaruhoshino
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 84

Unit 1

Propositional Logic
Snehal Kamalapur
Department of Computer Engineering
K K Wagh Institute of Engineering Education and Research ,
Nashik
Introduction

▪ A proposition is a declarative sentence (that is,


a sentence that declares a fact) that is either
true or false, but not both.
All the following declarative sentences are
propositions.
1. Washington, D.C., is the capital of the United
States of America.
2. Nashik is the capital of India.
3. 1 + 1 = 2.
4. 2 + 2 = 3.
Propositions 1 and 3 are true, whereas 2 and 4
are false
Example

Consider the following sentences.


1. What time is it?
2. Read this carefully.
3. x + 1 = 2.
4. x + y = z
Example

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 values to
the variables
▪ Use letters to denote propositional variables (or
statement variables), that is, variables that
represent propositions, just as letters are used
to denote numerical 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
▪ Many mathematical statements are constructed
by combining one or more propositions. New
propositions, called compound propositions, are
formed from existing propositions using logical
operators.
▪ A proposition is said to be primitive if it can not
be broken into two simpler propositions , that is
if it is not a composite
Activity I

▪ Identify following propositions are compound or


primitive
1. Nashik is in Maharashtra
2. 1 + 1 = 2
3. Where are you going?
4.Roses are Red and violets are blue
5. John is intelligent and studies every night
Answers (Activity I)

1. Nashik is in Maharashtra(Primitive)
2. 1 + 1 = 2(Primitive)
3. Where are you going?(not a proposition)
4.Roses are Red and violets are
blue(Compound)
5. John is intelligent and studies every night
(Compound)
Exercises

▪ Which of these sentences are propositions?


a) Boston is the capital of Massachusetts.
b) Miami is the capital of Florida.
c) 2 + 3 = 5.
d) 5 + 7 = 10.
e) x + 2 = 11
Basic Logical Operations

▪ Three basic logical operations are conjunction,


disjunction, and negation which correspond,
respectively, to the English words ‘and’ , ‘or’,
and ‘not’
DEFINITION - 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.

This table has a row for each of the four possible combinations
of truth values of p and q
▪ Note that 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.”
Example
▪ Find the conjunction of the propositions p and q
where p is the proposition “Riya’s PC has more
than 16 GB free hard disk space” and q is the
proposition “The processor in Riya’s PC runs
faster than 1 GHz.”
Example
▪ Find the conjunction of the propositions p and q
where p is the proposition “Riya’s PC has more
than 16 GB free hard disk space” and q is the
proposition “The processor in Riya’s PC runs
faster than 1 GHz.”
▪ Solution: The conjunction of these propositions, p
∧ q, is the proposition “Riya’s PC has more than
16 GB free hard disk space, and the processor in
Riya’s PC runs faster than 1 GHz.”
This conjunction can be expressed more simply as
“Riya’s 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
DEFINITION: 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
▪ What is the disjunction of the propositions p and
q where p and q are the same propositions as
in previous example?

▪ Solution: The disjunction of p and q, p ∨ q, is


the proposition “Riya’s PC has at least 16 GB
free hard disk space, or the processor in Riya’s
PC runs faster than 1 GHz.”
DEFINITION : Negation

▪ Let p be a proposition. The negation of p,


denoted by ¬p (also denoted by p), is the
statement “It is not the case that p.”
▪ The proposition ¬p is read “not p.” The truth
value of the negation of p, ¬p, is the opposite of
the truth value of 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 ¬p corresponding to the truth value of p for
this row
Example

▪ 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 as
“Michael’s PC does not run Linux.”
Example

▪ 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 as
“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.”
Activity

▪ Find the negation of the proposition


1) Paris is in France
2) 2+2=5
Answers

1) Paris is in France
Negation is: It is not the case that Paris is in
France
Paris is not in France
2) 2+2=5
Negation is: It is not the case that 2+2=5
2+2 ≠ 5
Exercise

▪ What is the negation of each of these


propositions?
a) Mei has an MP3 player.
b) There is no pollution in New Jersey.
c) 2 + 1 = 3.
d) The summer in Maine is hot and sunny
DEFINITION

▪ 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.

A conditional statement is also called an implication


Unit 1
Propositional Logic
Snehal Kamalapur
Department of Computer Engineering
K K Wagh Institute of Engineering Education and Research ,
Nashik

31ST AUG 2021


Conditional Statements

▪ 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 (or premise) and q is called the
conclusion (or consequence).
Example

▪ 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.
Example

▪ 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.
▪ Solution: p→ q represents the statement “If
Maria learns discrete mathematics, then she will
find a good job.”
Example

▪ 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.
▪ Solution: p→ q represents the statement “If Maria
learns discrete mathematics, then she will find a
good job.”
▪ 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.” and “Maria will find
a good job unless she does not learn discrete
mathematics.”
Conditional statement

“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”
“q follows from p” “q unless ¬p”
“a necessary condition for p is q”
▪ 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 (such as when you get a
free trip) and when you buy a ticket but you
cannot take the flight
Example( SPPU 6m)

Convert the following English statement in the


symbolic form
1 . If i am not studying maths and i go to a movie
then i am in a good mood.
2. If i am in good mood , then i will studying maths
or i will go to a movie
3.If I am not in a good mood, then I will not go to
movie or i will study maths.
Solution

r Let p: I am studying maths


q: I go to a movie
r: I am in a good mood

Symbolic representation is :
1. (~ P) ^ q → r
2. r → (p v q)
3. (~r) → ~q v p
Example

▪ Use
p: Today is Monday
q: The grass is wet
r: The dish ran away with the spoon
Write an English sentence that corresponds to
each of the following
1. ~r ^ q
2. ~q v r
3. ~( p v q)
4. P V ~r
What is the value of the variable x after the
statement
if 2 + 2 = 4 then x := x + 1
DEFINITION:BICONDITIONALS

▪ 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.
▪ Biconditional statements are also called
bi-implications.
Example

▪ Let p be the statement “You can take the flight,”


▪ Let q be the statement “You buy a ticket.”

Then p ↔ q is the statement

“You can take the flight if and only if you buy a


ticket.”
some other common ways to express p ↔ q:

“p is necessary and sufficient for q”


“if p then q, and conversely”
“p iff q.”
CONVERSE, CONTRAPOSITIVE, AND
INVERSE

▪ The proposition q → p is called the converse of


p → q.
▪ The contrapositive of p → q is the proposition
¬q → ¬p.
CONVERSE, CONTRAPOSITIVE, AND
INVERSE

▪ The proposition ¬p → ¬q is called the inverse of


p → q.
▪ 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.
Example

▪ What are the contrapositive, the converse, and


the inverse of the conditional statement

“The home team wins whenever it is raining?”


Example

▪ What are the contrapositive, the converse, and


the inverse of the conditional statement “The
home team wins whenever it is raining?”
▪ Solution: 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.”
Example

▪ What are the contrapositive, the converse, and


the inverse of the conditional statement “The
home team wins whenever it is raining?”
▪ Solution: 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.”
▪ Consequently, the contrapositive of this
conditional statement is “If the home team does
not win, then it is not raining.”
Example

▪ What are the contrapositive, the converse, and


the inverse of the conditional statement “The
home team wins whenever it is raining?”
▪ Solution: 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.”
▪ The converse is “If the home team wins, then it
is raining.”
Example

▪ What are the contrapositive, the converse, and


the inverse of the conditional statement “The
home team wins whenever it is raining?”
▪ Solution: 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.”
▪ The inverse is “If it is not raining, then the home
team does not win.” Only the contrapositive is
equivalent to the original statement.
Example

▪ What are the contrapositive, the converse, and


the inverse of the conditional statement “The
home team wins whenever it is raining?”
▪ Solution: 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.”
▪ Consequently, the contrapositive of this
conditional statement is “If the home team does
not win, then it is not raining.”
▪ The converse is “If the home team wins, then it
is raining.”
▪ The inverse is “If it is not raining, then the home
team does not win.” Only the contrapositive is
equivalent to the original statement.
Activity ( HW )
Truth Tables of Compound Propositions

▪ Construct the truth table of the compound


proposition
(p ∨ ¬q) → (p ∧ q)
Solution:
p q ¬q p ∨ ¬q p ∧ q (p ∨ ¬q) → (p ∧
q)

T T F T T T
T F T T F F
F T F F F T
F F T T F F
Truth Tables of Compound Propositions

▪ Construct the truth table of the compound


proposition
(p ∨ ¬q) → (p ∧ q)
Solution:
Activity 1

▪ Construct a truth table for each of these


compound propositions.
▪ a) p ∧ ¬p
▪ b) p ∨ ¬p
▪ c) (p ∨ ¬q) → q
▪ d) (p ∨ q) → (p ∧ q)
▪ e) (p → q) ↔ (¬q → ¬p)
▪ f ) (p → q) → (q → p)
Activity- II(HW)

▪ Construct a truth table for each of these


compound propositions.
a) (p ∨ q) ∨ r
b) (p ∨ q) ∧ r
c) (p ∧ q) ∨ r
d) (p ∧ q) ∧ r
e) (p ∨ q) ∧ ¬r
f ) (p ∧ q) ∨ ¬r
Tautologies and Contradictions

▪ Some propositions P(p,q…)contain only T in the


last column of their truth tables or, in other
words they are true for any truth values of their
variables, such propositions are called are
called tautologies

p ¬p P ∨ ¬p

T F T
F T T
Tautologies and Contradictions

▪ A propositions P(p,q…) is called contradiction if


it contain only F in the last column of its truth
table, in other words if it is false for any truth
values of its variables

p ¬p P ^ ¬p

T F F
F T F
Tautologies and Contradictions

p ¬p P ∨ ¬p

T F T
F T T

p ¬p P ^ ¬p

T F F
F T F
Example

▪ Verify that the proposition p∨¬(p ∧ q ) is a


tautology
▪ Solution: construct the truth table of
p∨¬(p ∧ q )
Example

▪ Verify that the proposition p∨¬(p ∧ q ) is a


tautology
▪ Solution: construct the truth table of p∨¬(p ∧
q)

p q p∧q ¬(p ∧ q ) p∨¬(p ∧ q )


T T T F T
T F F T T
F T F T T
F F F T T

The truth table of p∨¬(p ∧ q ) is T for


all values of p and q , the proposition is
a tautology
Activity

▪ Show that (¬p)🡪 (p🡪q) is a tautology

▪ Show that (p🡪q) <-->(~p v q ) is a tautology(


SPPU )
Lecture 3
Unit 1
Propositional Logic
Snehal Kamalapur
Department of Computer Engineering
K K Wagh Institute of Engineering Education and Research ,
Nashik

1st Sept 2021


Logical Equivalence

▪ Two logical statements are


logically equivalent if they always produce the
same truth value,denoted by p≡q
▪ Consider, for example ,
the truth tables of ¬(p ∧ q ) and ¬p v ¬q
Logical Equivalence

▪ Consider, for example , the truth tables of


¬(p ∧ q ) and ¬p v ¬q

p q p∧ ¬(p ∧ q ) p q ¬p ¬q ¬p v ¬q
q
T T T F T T F F F
T F F T T F F T T
F T F T F T T F T
F F F T F F T T T

Both truth tables are same , we can write it as ¬(p ∧ q ) ≡


¬p v ¬q
Example

▪ Prove by constructing the truth table:


p 🡪 (q v r) ≡ (p🡪q) v (p🡪 r)
Contingency

▪ A statement is neither a tautology nor a


contradiction
ALGEBRA OF PROPOSITIONS

▪ Idempotent laws: (1a) p ∨ p ≡ p (1b) p ∧ p ≡ p


▪ Associative laws: (2a) (p ∨ q) ∨ r ≡ p ∨ (q ∨ r)
(2b) (p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
▪ Commutative laws: (3a) p ∨ q ≡ q ∨ p
(3b) p ∧ q ≡ q ∧ p
ALGEBRA OF PROPOSITIONS

▪ Idempotent laws: (1a) p ∨ p ≡ p (1b) p ∧ p ≡ p


▪ Associative laws: (2a) (p ∨ q) ∨ r ≡ p ∨ (q ∨ r)
(2b) (p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
▪ Commutative laws: (3a) p ∨ q ≡ q ∨ p
(3b) p ∧ q ≡ q ∧ p
▪ Distributive laws: (4a) p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p
∨ r)
(4b) p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p
∧ r)
▪ Identity laws: (5a) p ∨ F ≡ p
(5b) p ∧ T ≡ p
(6a) p ∨ T ≡ T
(6b) p ∧ F ≡ F
▪ Involution law: (7) ¬¬ p ≡ p
▪ Complement laws: (8a) p ∨¬ p ≡ T
(8b) p ∧¬ p ≡ T
(9a) ¬ T ≡ F
(9b) ¬ F ≡ T
▪ DeMorgan’s laws: (10a) ¬ (p ∨ q) ≡ ¬ p ∧¬
q
(10b) ¬ (p ∧ q) ≡ ¬ p ∨¬
q
Example

▪ Show that ¬(p ∨ q) and ¬p ∧¬q are logically


equivalent.
Solution:
Example

▪ Show that ¬(p ∨ q) and ¬p ∧¬q are logically


equivalent.
Solution:
▪ Show that p → q and ¬p ∨ q are logically
equivalent.
▪ Show that p → q and ¬p ∨ q are logically
equivalent.
Solution:
Show that p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are
Logically Equivalent.
Show that p ∨ (q ∧ r) and (p ∨ q) ∧ (p ∨ r) are
Logically Equivalent.
Logical Equivalences
Example

▪ Use De Morgan’s laws to express the negations


of “Mahesh has a cell phone and he has a
laptop computer” and “Heather will go to the
concert or Steve will go to the concert.
Example

▪ Use De Morgan’s laws to express the negations of


“Mahesh has a cell phone and he has a laptop
computer” and “Heather will go to the concert or
Steve will go to the concert.”
▪ Solution: Let p be “Mahesh has a cellphone” and
q be “Mahesh has a laptop computer.”

Then “Mahesh has a cell phone and he has a laptop


computer” can be represented by p ∧ q.

By the first of De Morgan’s laws, ¬(p ∧ q) is


equivalent to ¬p ∨¬q. Consequently, we can
express the negation of our original statement as
“Mahesh does not have a cellphone or he does not
have a laptop computer.”
▪ Let r be “Heather will go to the concert” and
s be “Steve will go to the concert.”
Then “Heather will go to the concert or Steve will
go to the concert” can be represented by r ∨ s.
▪ By the second of De Morgan’s laws,
¬(r ∨ s) is equivalent to ¬r ∧¬s.
Consequently, we can express the negation of
our original statement as “Heather will not go to
the concert and Steve will not go to the concert.”
▪ Constructing New Logical Equivalences

Show that ¬(p → q) and p ∧¬q are logically


equivalent.

¬(p → q) ≡ ¬(¬p ∨ q) by Example 3


≡ ¬(¬p)∧¬q by the second De
Morgan law
≡ p ∧¬q by the double
negation law
▪ Show that ¬(p ∨ (¬p ∧ q)) and ¬p ∧¬q are
logically equivalent by developing a series of
logical equivalences.
▪ Show that ¬(p ∨ (¬p ∧ q)) and ¬p ∧¬q are logically
equivalent by developing a series of logical equivalences.
Solution: ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧¬(¬p ∧ q) by the second
De Morgan law
≡ ¬p ∧ [¬(¬p)∨¬q] by the first De Morgan law
≡ ¬p ∧ (p ∨¬q) by the double negation law
≡ (¬p ∧ p) ∨ (¬p ∧¬q) by the second distributive law
≡ F ∨ (¬p ∧¬q) because ¬p ∧ p ≡ F
≡ (¬p ∧¬q) ∨ F by the commutative law for
disjunction
≡ ¬p ∧¬q by the identity law for F
Consequently ¬(p ∨ (¬p ∧ q)) and ¬p ∧¬q are logically
equivalent
Precedence of Logical Operators
Logic and Bit Operations

▪ 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.
▪ 1 represents T (true), 0 represents F (false). A
variable is called a Boolean variable if its value
is either true or false
Truth Table
Definition

▪ A bit string is a sequence of zero or more bits.


The length of this string is the number of bits in
the string
Example: Find the bitwise OR, bitwise AND, and
bitwise XOR of the bit strings 01 1011 0110 and
11 0001 1101
Solution: The bitwise OR, bitwise AND, and
bitwise XOR of these strings are obtained by
taking the OR, AND, and XOR of the
corresponding bits, respectively.
Thank you

You might also like