0% found this document useful (0 votes)
23 views32 pages

1 Logics

Uploaded by

Sagar Mal Mal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views32 pages

1 Logics

Uploaded by

Sagar Mal Mal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

1

INTRODUCTI
 Proposition: ON
A proposition is a statement that is either true or
false, but
not both.

 Statements are declarative sentences.

 Propositional Logic:
The area of logic that deals with propositions.

2
⚫ “Elephants are bigger than
mice.”

Is this a statement? yes


Is this a ye
proposition? s
What is the truth tru
value of the e
proposition?

3
NEGATION (Unary
Operator)
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 read as “not p.”
 Examples
⚫ p:Today is Friday.
⚫ ¬p: Today is not
Friday. or
It is not Friday
today. to display
 Truth the
between tables arevalue of
truth relationships
used
propositions. 4
⚫ “520 <
111”
Is this a ye
statement? s
Is this a ye
proposition? s
What is the truth fals
value of the e
proposition?

5
⚫ “y >
5”
Is this a ye
statement? s
Is this a n
proposition? o
Its truth value
depends on the value
of y, but this value is
not specified.
6
⚫ “What time is
it?”

Is this a statement?
no
Is this a n
proposition? o
A proposition has
to be a
statement.

7
 Truth
table:
The Truth Table for the
Negation of a
Proposition.
p ¬p
T F
F T

 Logical are used to


propositions
operators form new two or
propositions.
from The logical operators
moreexisting
are also called
connectives. 8
LOGICAL OPERATORS
(CONNECTIVES)
 Conjunction (AND
)
 Disjunction (OR)
 Exclusive (XOR)
or (if – then)
 Implication (if and only
 Bicondition if)
al

9
CONJUNCTION: (Binary
Operator)
Let p and q be propositions. The conjunction of
p and q, denoted by pΛq, is the proposition “p
and q” which is true when both p and q are true
and is false otherwise.

Examples
p:“Today is Friday.”
q:“It is raining today.”
p Λ q: “Today is Friday and it is raining
today”.

The proposition is true on rainy Fridays. 10


 Truth
table :
The Truth Table
for the
Conjunction of
Two
Propositions.
p pΛq
q
T T T
T F F
F T F
F F F

11
 DISJUNCTION: (Binary Operator)
Let p and q be propositions. The disjunction of
p and q, denoted by p ν q, is the proposition “p
or q” which is false when both p and q are false
and is true otherwise.

⚫ Note:
inclusive or : The disjunction is true when at
least one of the two propositions is true.
⚫ E.g. “Students who have taken
calculus or computer science can
take this class.”

exclusive or : The disjunction is true only


when one of The proposition is true.
⚫ E.g. “Ice cream or pudding will be served 12
 Truth
table :
The Truth Table The Truth Table for
for the the Exclusive Or
Disjunction of (XOR) of Two
Two Propositions.
Propositions. p pq
p pνq q
q T T F
T T T T F T
T F T F T T
F T T F F F
F F F

13
 CONDITIONAL STATEMENT:
Let p and q be propositions. The conditional
statement p → q, is the proposition “if p, then q”
which is false when p is true and q is false, and true
otherwise.

p is called the hypothesis (or antecedent or


premise) and q is called the conclusion (or
consequence).

 Example: “If I am elected,


elected, then I will
lower taxes. T lower
T | T taxes.” p
→ q not elected, lower taxes. F T |T
not elected, not lower F F |T
taxes.
elected, not lower taxes. T F |F
14
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.
1. “If Marialearns discrete
find a
mathematics, goodthen
job. she will
2. “Mariawill find a good job if she learns
mathematics.”
discrete
3. “For Maria to get a good job, it is
sufficient for her to learn discrete
mathematics.”
4. “Maria will find a good job unless
she does not learn discrete
mathematics.” 15
⚫ If p then q
⚫ p implies q
⚫ q if p
⚫ q whenever p
⚫ p is sufficient
for q
⚫ q is necessary
for p
⚫ p only if q

16
Other conditional
statements:
⚫ Converse of p → q : q → p
⚫ Contrapositive of p → q : ¬ q → ¬ p
⚫ Inverse of p → q : ¬ p → ¬ q

 The statement and its contrapositive are


equivalent.

 Converse and inverse of a statement are


equivalent

17
BICONDITIONAL STATEMENT:
Let p and q be propositions. The
biconditional statement
p q is the proposition “p if and only if q”
which is true when p and q have the same
truth values, and is false otherwise.

 p q has the same truth value as (p → q) Λ (q


→ p)

Example:
⚫ Let p be the statement “You can
take the flight”
and let q be the statement “You buy a
ticket.” 18
The Truth fo the
Table r q.
Biconditional
p
p q p q
T T T
T F F
F T F
F F T
“ p is necessary and sufficient
for q” “If p then q and
conversely”

19
 Connectives can beuse to up complicated
compound d involving
build any number
propositions
propositional of
variables.
trut tabl of the
Example:Construct h e compound
the (p ν ¬q) → (p
proposition Λ q)
The Truth Table of (p ν ¬q) → (p Λ q).
p ¬q p ν ¬q pΛq (p ν ¬q) → (p Λ q)
q
T F T T T
T T T F F
T F F F F T
F T T F F
T
F F 20
PRECEDENCE OF LOGICAL
OPERATORS
 Parentheses are used to specify the order in which logical
operators in a compound proposition are to be applied.
 To reduce the number of parentheses, the precedence
order is defined for logical operators.

Precedence of Logical Operators.


Operator Precedence

¬ 1
Λ 2
ν 3
→ 4
5

21
TRANSLATING ENGLISH
SENTENCES
Example: How can this English sentence be
translated into a logical expression?
“You cannot ride the roller coaster if you
are under 4
feet tall unless you are older than 16 years
old.”

p: You can ride the roller coaster.


q: You are under 4 feet tall.
r: You are older than 16 years old.
(q Λ ¬ r) → ¬p
22
Example: How can this English sentence be
translated into a logical expression?
“You can access the Internet from
campus only if you are a computer science
major or you are not a freshman.”

p: You can access the Internet from


campus.
q: You are a computer science major.
r: You are a freshman.

p → (q ν ¬r)

23
LOGIC PUZZLES
You visit an island where there are two kinds of
inhabitants, knights, who always tell the truth, and
knaves, who always lie. You encounter two people A
and B. A says “ B is a knight” and B says “ the two
of us are opposite types”. What are A and B?

Let p: A is a
knight
q: B is a knight

Suppose p is
true,
A’s statement
that B is a
knight is true. 24
TAUTOLOGY:
A compound proposition that is always
true, no matter what the truth values of the
propositions that occurs in it, is called a
tautology.
CONTRADICTION:
A compound proposition that is always
false is called a contradiction.
CONTINGENCY:
A compound proposition that is neither a
tautology or a contradiction is called a25
Examples of a Tautology and a
Contradiction.
p ¬p p ν ¬p p Λ ¬p

T F T F
F T T F

26
⚫ The compound propositions p and q are called
logically equivalent if p q is a tautology.
Notation p ≡ q

⚫ Example: Show that ¬p ν q and p → q are


logically equivalent.

Truth Tables for ¬p ν q and 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

27
Logical Equivalences

Law Name
p Fp Identity laws
p Tp
p TT Domination laws
p FF
p p p Idempotent laws
p p p
( p)  p Double-negation law
Law Name
p q q p Commutati
p q q p ve laws
(p  q)  r  p  (q  r) Associative
(p  q)  r  p  (q  r) laws
(p  q)  (p  r)  p  (q  r) Distributive
(p  q)  (p  r)  p  (q  r) laws
(p  q)   p   q De Morgan’s
(p  q)   p   q laws
p  (p  q)  p Absorption laws
p  (p  q)  p
Some useful
logical
Equivalences
p  p 
T p  p
F
p →q 
p  q
⚫ Example: Show that ¬(p → q ) and p Λ ¬q are logically
equivalent. Solution:
¬(p → q ) ≡ ¬(¬p ν q)
≡ ¬(¬p) Λ De Morgan’s law
¬q Double negation
≡ p Λ ¬q law
⚫ Example: Show that (p Λ q) → (p ν q) is a tautology.
Solution: To show that this statement is a tautology, we will
use logical equivalences to demonstrate that it is logically
equivalent to T.
(p Λ q) → (p ν q)≡ ≡
(¬¬(p q) νν(p
p νΛ¬q) (pν q) De Morgan’s law
ν q) Associative and
≡ (¬ p ν p) ν (¬ q Commutative
ν
≡T q)ν law
T
≡T
3
Prove Absorption
Laws
p  (p  q) 
p p  (p  q)
 p Proof
p  (p  q)  (p  T)  (p 
q)
 p  (T  q)
p T
p

You might also like