42
Logical Equivalence & Logical Equivalence & Predicate Logic Predicate Logic 이이이 School of Information Technique Sungshin W. University

Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Embed Size (px)

Citation preview

Page 1: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Logical Equivalence &Logical Equivalence &Predicate LogicPredicate Logic

이재원School of Information Technique

Sungshin W. University

Page 2: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Propositional Equivalence 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.

Page 3: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Tautologies and ContradictionsTautologies 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.

Page 4: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Logical EquivalenceLogical Equivalence

• Compound proposition p is logically equivalent to compound proposition q, written pq, IFF the compound proposition pq 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.

Page 5: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Ex. Prove that pq (p q).

p q pp qq pp qq pp qq ((pp qq))F FF TT FT T

Proving Equivalence via Truth TablesProving Equivalence via Truth Tables

FT

TT

T

T

T

TTT

FF

F

F

FFF

F

TT

Page 6: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Equivalence LawsEquivalence 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.

Page 7: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Equivalence Laws - ExamplesEquivalence Laws - Examples

• Identity: pT p pF p• Domination: pT T pF F• Idempotent: pp p pp p• Double negation: p p• Commutative: pq qp pq qp• Associative: (pq)r p(qr)

(pq)r p(qr)

Page 8: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

More Equivalence LawsMore Equivalence Laws• Distributive: p(qr) (pq)(pr)

p(qr) (pq)(pr)• De Morgan’s:

(pq) p q (pq) p q

• Trivial tautology/contradiction: p p T p p F

Page 9: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Defining Operators via EquivalencesDefining Operators via Equivalences

Using equivalences, we can define operators in terms of other operators.

• Exclusive or: pq (pq)(pq) pq (pq)(qp)

• Implies: pq p q• Biconditional: pq (pq) (qp)

pq (pq)

Page 10: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

An Example ProblemAn 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))

Page 11: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

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

Page 12: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

End of Long ExampleEnd 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.)

Page 13: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Another ExampleAnother 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.

Page 14: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Another Example cont.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 )

Page 15: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

cont.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))

Page 16: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

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

Page 17: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Predicate Logic 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?

Page 18: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Subjects and PredicatesSubjects 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).

Page 19: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

More About PredicatesMore 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.”

Page 20: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Propositional FunctionsPropositional Functions

• A Statement of the form P(x1, x2, …,xn) is the value of the propositional function P at the n-tuple (x1, x2, …,xn), and P is also called a n-place 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.”

Page 21: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

QuantifiersQuantifiers• Quantification– an important way of creating a proposition

from propositional function.

• Predicate Calculus– The area of logic that deals with predicates and

quantifiers.

Page 22: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Universal QuantifierUniversal 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).

Page 23: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Universal Quantifier continued…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?

Page 24: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Universal Quantifier continued…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.

Page 25: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Existential QuantifierExistential 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.

Page 26: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Existential Quantifier continued…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.

Page 27: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Free and Bound VariablesFree 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.

Page 28: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Example of BindingExample 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)

Page 29: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Still More ConventionsStill 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))

Page 30: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

More to Know About BindingMore 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!

Page 31: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Quantifier Equivalence LawsQuantifier 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?

Page 32: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

More Equivalence LawsMore 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))

Page 33: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Negating Quantified ExpressionsNegating 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)

Page 34: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

English to Logical ExpressionsEnglish 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.”

Page 35: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

English to Logical Expressions English to Logical Expressions cont.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))”?

Page 36: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

English to Logical Expressions English to Logical Expressions cont.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.”

Page 37: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

English to Logical Expressions English to Logical Expressions cont.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!

Page 38: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Nesting of QuantifiersNesting 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.)

Page 39: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Quantifier ExerciseQuantifier Exercise

If R(x,y)=“x relies upon y,” express the following in unambiguous English:

x(y R(x,y))=y(x R(x,y))=

x(y R(x,y))=y(x R(x,y))=x(y R(x,y))=

Everyone has someone to rely on.

There’s a poor overburdened soul whom everyone relies upon (including himself)!

There’s some needy person who relies upon everybody (including himself).

Everyone has someone who relies upon them.

Everyone relies upon everybody, (including themselves)!

Page 40: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Quantifier Exercise cont.Quantifier Exercise cont.

• Ex. 4) Let Q(x, y) denote “x + y = 0.” What are the truth values of the quantifications xy Q(x,y) and xy Q(x,y), where the domain for all variables consists of all real numbers?

• Solution: The quantifications xy 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! )

Page 41: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Quantifier Exercise cont.Quantifier Exercise cont.

• The quantifications xy 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 xy Q(x,y) is true.

• Study the explanation below this example (pp. 53).

Page 42: Logical Equivalence & Predicate Logic 이재원 School of Information Technique Sungshin W. University

Natural language is ambiguous!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.