슬라이드 1 - SUNGSHIN

Download Report

Transcript 슬라이드 1 - SUNGSHIN

Logical Equivalence &
Predicate Logic
이재원
School of Information Technique
Sungshin W. University
Propositional Equivalence
Two syntactically (i.e., textually) different
compound propositions may be the
semantically identical (i.e., have the same
meaning). We call them equivalent. Learn:
• Various equivalence rules or laws.
• How to prove equivalences using symbolic
derivations.
Tautologies and Contradictions
• A tautology is a compound proposition that is
true no matter what the truth values of its
atomic propositions are!
Ex. p  p [What is its truth table?]
• A contradiction is a compound proposition
that is false no matter what! Ex. p  p
[Truth table?]
• Other compound props. are contingencies.
Logical Equivalence
• Compound proposition p is logically
equivalent to compound proposition q,
written 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 rows
of their truth tables.
Proving Equivalence via Truth Tables
Ex. Prove that pq  (p  q).
p
F
F
T
T
q
F
T
F
T
pq
F
T
T
T
p
T
T
F
F
q p  q (p  q)
T
T
F
F
F
T
T
F
T
F
F
T
Equivalence Laws
• propositional equivalences provide a pattern
or template that can be used to match all or
part of a much more complicated proposition
and to find an equivalence for it.
Equivalence Laws - Examples
•
•
•
•
•
•
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)
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
• Trivial tautology/contradiction:
p  p  T
p  p  F
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)(qp)
• Implies:
pq  p  q
• Biconditional: pq  (pq)  (qp)
pq  (pq)
An 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)
[Defn. of ]  (p  q)  ((p  r)  (p  r))
[DeMorgan’s Law]
 (p  q)  ((p  r)  (p  r))
Example Continued...
(p  q)  ((p  r)  (p  r))  [ commutes]
 (q  p)  ((p  r)  (p  r)) [ associative]
 q  (p  ((p  r)  (p  r))) [distrib.  over ]
 q  (( (p  (p  r))  (p  (p  r)))
[assoc.]  q  (((p  p)  r)  (p  (p  r)))
[trivail taut.]  q  ((T  r)  (p  (p  r)))
[domination]  q  (T  (p  (p  r)))
[identity]
 q  (p  (p  r))  cont.
End of Long Example
q  (p  (p  r))
[DeMorgan’s]  q  (p  (p  r))
[Assoc.]
 q  ((p  p)  r)
[Idempotent]  q  (p  r)
[Assoc.]
 (q  p)  r
[Commut.]  p  q  r
Q.E.D. (quod erat demonstrandum)
(Which was to be shown.)
Another Example
• Ex. 7) 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) De Morgan
 p  [( p)  q)
De Morgan
 p  (p  q)  (p  p)  (p  q)
 F  (p  q)  (p  q)  F  p  q
• Study Example 8.
Another Example cont.
• Exercise 29. Show that
(p  q)  (q  r)  (p  r ) is tautology
• Solution:
? Use the truth table~!
• Another solution (symbolic derivation):
• (p  q)  (q  r)  (p  r )
•  (p  q)  (q  r)  (p  r )
•  (( p  q)  (q  r))  (p  r )
cont.
•
•
•
•
•
•
•
 (( p  q)  (q  r))  (p  r )
 ( p  q)  (q  r)  (p  r )
 (p  q)  (q  r)  (p  r )
 (p  q)  (p  r )  (q  r)
 ((p  q)  p)  (r  (q  r))
 (p  p)  (q  p)  (r  (q  r))
 T  (q  p)  (r  (q  r))
cont.
•
•
•
•
•
•
•
 T  (q  p)  (r  (q  r))
 (q  p)  (r  (q  r))
 (q  p)  (r  q)  (r  r))
 (q  p)  (r  q)  T)
 (q  p)  (r  q)
 q  q  p  r
 T  p  r  p  r  T  T
• Study Odd Numbered Exercises~!
– especially the simple ones
Predicate Logic
• Predicate logic is an extension of
propositional logic that permits concisely
reasoning about whole classes of entities.
• Propositional logic (recall) treats simple
propositions (sentences) as atomic entities.
• In contrast, predicate logic distinguishes the
subject of a sentence from its predicate.
– Remember these English grammar terms?
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 is true of the subject.
• In predicate logic, a predicate is modeled as a
function P(·) from objects to propositions.
– P(x) = “x is sleeping” (where x is any object).
More About Predicates
• Convention: Lowercase variables x, y, z... denote
objects/entities; uppercase variables P, Q, R… denote
propositional functions (predicates).
• Keep in mind that the result of applying a predicate P
to an object x is the proposition P(x). But the
predicate P itself (e.g. P=“is sleeping”) is not a
proposition (not a complete sentence).
– E.g. if P(x) = “x is a prime number”,
P(3) is the proposition “3 is a prime number.”
Propositional Functions
• A Statement of the form P(x1, x2, …,xn) is the
value of the propositional function P at the ntuple (x1, x2, …,xn), and P is also called a nplace predicate or a n-ary predicate
– 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.”
Quantifiers
• Quantification
– an important way of creating a proposition
from propositional function.
• Predicate Calculus
– The area of logic that deals with predicates and
quantifiers.
Universal Quantifier
• The universal quantification of P(x) is the
statement
– “P(x) for all values of x in the domain.”
– x P(x) denotes the universal quantification of
P(x). Here  is called the universal quantifier.
• The collection of values that a variable x
can take is called x’s universe of discourse
(domain of discourse/domain).
Universal Quantifier continued…
• An element for which P(x) is false is called a
conterexample of x P(x)
• Ex. 9) 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?
Universal Quantifier continued…
• Solution: Q(x) is not true for every real
number x, because, for instance, Q(3) is
false. That is, x=3 is a counterexample for
the statement x Q(x). Thus,
x Q(x)
is false.
Existential Quantifier
• The existential quantification of P(x) is the
proposition
– “There exists an element x in the domain such
that P(x).”
–  x P(x) denotes the existential quantification
of P(x). Here  is called the existential
quantifier.
Existential Quantifier continued…
• Ex. 16) What is the truth value of x P(x) ,
where P(x) is the statement “x2 > 10” and
the universe of discourse consists the
positive integers not exceeding 4?
• Solution: 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 is x P(x) false.
Free and Bound Variables
• An expression like P(x) is said to have a free
variable x (meaning, x is undefined).
• A quantifier (either  or ) operates on an
expression having one or more free variables,
and binds one or more of those variables, to
produce an expression having one or more
bound variables.
Example of Binding
• P(x,y) has 2 free variables, x and y.
• x P(x,y) has 1 free variable, and one bound
variable. [Which is which?]
• “P(x), where x=3” is another way to bind x. :
P(3)
• An expression with zero free variables is a
bona-fide (actual) proposition.
• An expression with one or more free variables
is still only a predicate: x P(x,y)
Still More Conventions
• Sometimes the universe of discourse is
restricted within the quantification, e.g.,
– x>0 P(x) is shorthand for
“For all x that are greater than zero, P(x).”
=x (x>0  P(x))
– x>0 P(x) is shorthand for
“There is an x greater than zero such that P(x).”
=x (x>0  P(x))
More to Know About Binding
• (x P(x))  Q(x) - The variable x is outside of
the scope of the x quantifier, and is
therefore free. Not a proposition!
• (x P(x))  (x Q(x)) – This is legal, because
there are 2 different x’s!
Quantifier Equivalence Laws
• Definitions of quantifiers: If u.d.=a,b,c,…
x P(x)  P(a)  P(b)  P(c)  …
x P(x)  P(a)  P(b)  P(c)  …
• From those, we can prove the laws:
x P(x)  x P(x)
x P(x)  x P(x)
• Which propositional equivalence laws can
be used to prove this?
More Equivalence Laws
• x y P(x,y)  y x P(x,y)
x y P(x,y)  y x P(x,y)
• x (P(x)  Q(x))  (x P(x))  (x Q(x))
x (P(x)  Q(x))  (x P(x))  (x Q(x))
Negating Quantified Expressions
• Consider the negation of the statement
“Every student in your class has taken a course
in calculus.”
– x Q(x), where Q(x) is “x has taken a course in
calculus”, and the domain consists of the students
in your class.
– The negation is “There is a student in your class
who has not taken a course in calculus.”
•  x Q(x) ≡ x Q(x), x Q(x) ≡ x Q(x)
English to Logical Expressions
• Ex. 23) Express the statement “Every student
in this class has studied calculus” using
predicates and quanifiers.
• Solution: Let’s rewrite the sentence,
=> “For every student in this class, that student has
studied calculus.”
=> “For every student x in this class, x has studied
calculus.”
English to Logical Expressions cont.
=> x C(x)
(C(x): “x has studied calculus”, domain: student in
the class)
=> “For every person x, if person x is a student in
this class, x has studied calculus.”
=> x (S(x)  C(x))
(S(x): “person x is in this class”, domain: all people)
causion! How about “x (S(x)  C(x))”?
English to Logical Expressions cont.
• Ex. 24) 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 quanifiers.
• Solution: Let’s rewrite the first sentence,
=> “There is a student in this class with the property
that the student has visited Mexico.”
=> “There is a student x in this class having property
that the x has visited Mexico.”
English to Logical Expressions cont.
=> x M(x)
(M(x): “x has visited calculus”, domain: students in
the class)
=> “There is a person x having the property that x is
a student in this class and x has visited Mexico.”
=>  x (S(x)  M(x))
(S(x): “person x is in this class”, domain: all people)
causion! How about “ x (S(x)  M(x))”?
• Study the rest of this example!
Nesting of Quantifiers
Example: Let the u.d. of x & y be people.
Let L(x,y)=“x likes y” (a predicate w. 2 f.v.’s)
Then y L(x,y) = “There is someone whom x
likes.” (A predicate w. 1 free variable, x)
Then x (y L(x,y)) =
“Everyone has someone whom they like.”
(A __________ with ___ free variables.)
Quantifier Exercise
If R(x,y)=“x relies upon y,” express the following
in unambiguous English:
Everyone has someone to rely on.
x(y R(x,y))=
y(x R(x,y))= There’s a poor overburdened soul whom
everyone relies upon (including himself)!
There’s some needy person who relies
upon everybody (including himself).
x(y R(x,y))=
y(x R(x,y))= Everyone has someone who relies upon them.
x(y R(x,y))= Everyone relies upon everybody,
(including themselves)!
Quantifier Exercise cont.
• Ex. 4) Let Q(x, y) denote “x + y = 0.” What are
the truth values of the quantifications xy
Q(x,y) and xy Q(x,y), where the domain for
all variables consists of all real numbers?
• Solution: The quantifications xy Q(x,y)
denotes
“There is a real number y such that for every real
number x, Q(x, y).”
=> false. (See our textbook to study the reason! )
Quantifier Exercise cont.
• The quantifications xy Q(x,y) denotes
“For every real number x there is a real number y
such that Q(x, y).”
=> Given a real number x, there is a real number y
such that x + y = 0; namely, y = -x. Hence, the
statement xy Q(x,y) is true.
• Study the explanation below this example
(pp. 53).
Natural language is ambiguous!
• “Everybody likes somebody.”
– For everybody, there is somebody they like,
• x y Likes(x,y)
– or, there is somebody (a popular person) whom
everyone likes?
• y x Likes(x,y)
• “Somebody likes everybody.”
– Same problem: Depends on context, emphasis.