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

03-Logic31

lecture on logic

Uploaded by

Lokesh Bohra
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)
10 views

03-Logic31

lecture on logic

Uploaded by

Lokesh Bohra
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/ 19

Discrete Mathematics for

Computer Science

3-1
Propositional Equivalences
Predicates and Quantifiers

3-2
1.2 Propositional Equivalence
 A tautology is a compound proposition that is true
no matter what the truth values of its atomic
propositions are!
 e.g. p  p (“Today the sun will shine or today the

sun will not shine.”) [What is its truth table?]


 A contradiction is a compound proposition that is
false no matter what!
 e.g. p  p (“Today is Wednesday and today is

not Wednesday.”) [Truth table?]


 A contingency is a compound proposition that is
neither a tautology nor a contradiction.
 e.g. (p  q) → r

3-3
Logical Equivalence
 Compound proposition p is logically
equivalent to compound proposition q,
written p  q or p  q, iff the compound
proposition p  q is a tautology.

 Compound propositions p and q are logically


equivalent to each other iff p and q contain
the same truth values as each other in all
corresponding rows of their truth tables.

3-4
Proving Equivalence
via Truth Tables
 Prove that (p  q)  p  q. (De Morgan’s law)

p q pq p q p  q (p  q)
T T T F F F F
T F F F T T T
F T F T F T T
F F F T T T T
 Show that Check out the solution in the textbook!
 (p  q)  p  q (De Morgan’s law)

 p → q  p  q

 p  (q  r)  (p  q)  (p  r) (distributive law)

3-5
Equivalence Laws

 These are similar to the arithmetic identities


you may have learned in algebra, but for
propositional equivalences instead.

 They provide a pattern or template that can


be used to match part of a much more
complicated proposition and to find an
equivalence for it and possibly simplify it.

3-6
Equivalence Laws
 Identity: pTp pFp
 Domination: pTT pFF
 Idempotent: ppp ppp
 Double negation: p  p
 Commutative: p  q  q  p pqqp
 Associative: (p  q)  r  p  (q  r)
(p  q)  r  p  (q  r)

3-7
More Equivalence Laws
 Distributive: p  (q  r)  (p  q)  (p  r)
p  (q  r)  (p  q)  (p  r)
 De Morgan’s:
(p  q)  p  q
(p  q)  p  q
 Absorption
p  (p  q)  p p  (p  q)  p
 Trivial tautology/contradiction:
p  p  T p  p  F

See Table 6, 7, and 8 of Section 1.2


3-8
Defining Operators via
Equivalences

Using equivalences, we can define operators


in terms of other operators.

 Exclusive or: p  q  (p  q)  (p  q)


p  q  (p  q)  (p  q)

 Implies: p  q  p  q

 Biconditional: p  q  (p  q)  (q  p)
p  q  (p  q)

This way we can “normalize” propositions


3-9
An Example Problem
 Show that (p  q) and p  q are logically
equivalent.

(p  q) [Expand definition of ]


 (p  q) [DeMorgan’s Law]
 (p)  q [Double Negation]
 p  q

3-10
Another Example Problem

 Check using a symbolic derivation whether


(p  q)  (p  r)  p  q  r

(p  q)  (p  r) [Expand definition of ]


 (p  q)  (p  r) [Expand definition of ]
 (p  q)  ( (p  r)  (p  r) )
[DeMorgan’s Law]
 (p  q)  ( (p  r)  (p  r) )
cont.
3-11
Example Continued...
(p  q)  (p  r)  p  q  r

(p  q)  ((p  r)  (p  r)) [ Commutative]


 (q  p)  ((p  r)  (p  r)) [ Associative]
 q  ( p  ((p  r)  (p  r)) ) [Distribute  over ]
 q  ( ( (p  (p  r))  (p  (p  r) ) ) [ Assoc.]
 q  ( ( (p  p)  r)  (p  (p  r) ) ) [Trivial taut.]
 q  ( (T  r)  (p  (p  r) ) ) [Domination]
 q  ( T  (p  (p  r)) ) [Identity]
 q  ( p  (p  r) )
cont.
3-12
End of Long Example
(p  q)  (p  r)  p  q  r

q  (p  (p  r) ) [DeMorgan’s Law]


 q  ( p  (p  r) ) [ Associative]
 q  ( (p  p)  r ) [Idempotent]
 q  (p  r) [Associative]
 (q  p)  r [ Commutative]
 p  q  r ■

3-13
Topic #1 – Propositional Logic

Review: Propositional Logic

 Atomic propositions: p, q, r, …
 Boolean operators:      
 Compound propositions: (p  q)  r
 Equivalences: pq   (p  q)
 Proving equivalences using:
 Truth tables

 Symbolic derivations (series of logical

equivalences) p  q  r  
3-14
Topic #3 – Predicate Logic

Predicate Logic
 Consider the sentence
“For every x, x  0”
If this were a true statement about the positive
integers, it could not be adequately symbolized
using only statement letters, parentheses and
logical connectives.
The sentence contains two new features: a
predicate and a quantifier

3-15
Topic #3 – Predicate Logic

Subjects and Predicates


 In the sentence “The dog is sleeping”:
 The phrase “the dog” denotes the subject –
the object or entity that the sentence is about.
 The phrase “is sleeping” denotes the predicate
– a property that the subject of the statement
can have.
 In predicate logic, a predicate is modeled as a
proposional function P(·) from subjects to
propositions.
 P(x) = “x is sleeping” (where x is any subject).
 P(The cat) = “The cat is sleeping” (proposition!)
3-16
Topic #3 – Predicate Logic

More About Predicates


 Convention: Lowercase variables x, y, z...
denote subjects; uppercase variables P, Q,
R… denote propositional functions (or
predicates).
 Keep in mind that the result of applying a
predicate P to a value of subject x is the
proposition. But the predicate P, or the
statement P(x) itself (e.g. P = “is sleeping” or
P(x) = “x is sleeping” ) is not a proposition.
 e.g. if P(x) = “x is a prime number”,
P(3) is the proposition “3 is a prime number.”
3-17
Topic #3 – Predicate Logic

Propositional Functions
 Predicate logic generalizes the grammatical
notion of a predicate to also include
propositional functions of any number of
arguments, each of which may take any
grammatical role that a noun can take.
 e.g.:

let P(x,y,z) = “x gave y the grade z”


then if
x = “Mike”, y = “Mary”, z = “A”,
then
P(x,y,z) = “Mike gave Mary the grade A.”

3-18
Topic #3 – Predicate Logic

Examples
 Let P(x): x > 3. Then
 P(4) is TRUE/FALSE 4>3
 P(2) is TRUE/FALSE 2>3
 Let Q(x, y): x is the capital of y. Then
 Q(Washington D.C., U.S.A.) is TRUE
 Q(Hilo, Hawaii) is FALSE
 Q(Massachusetts, Boston) is FALSE
 Q(Denver, Colorado) is TRUE
 Q(New York, New York) is FALSE
 Read EXAMPLE 6 (pp.33)
 If x > 0 then x:= x + 1 (in a computer program)
3-19

You might also like