資訊科學數學 6 : predicates, quantifiers & mathematical induction 陳光琦助理教授...

73
資資資資資資 資資資資資資 6 6 : : Predicates, Quantifiers Predicates, Quantifiers & & Mathematical Induction Mathematical Induction 陳陳陳陳陳陳陳 陳陳陳陳陳陳陳 (Kuang-Chi Chen) (Kuang-Chi Chen) [email protected] [email protected]

Upload: conrad-craig

Post on 11-Jan-2016

282 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

資訊科學數學資訊科學數學 6 6 ::

Predicates, Quantifiers &Predicates, Quantifiers & MathMathematical Inductionematical Induction

陳光琦助理教授 陳光琦助理教授 (Kuang-Chi Che(Kuang-Chi Chen)n)

[email protected]@mail.tcu.edu.tw

Page 2: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Predicates & Predicates & QuantifiersQuantifiers

Page 3: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

PredicatesPredicates

• The statement “ The statement “ XX is greater than 3” has 2 parts: is greater than 3” has 2 parts: objectobject (variable (variable XX) and ) and predicatepredicate (“is greater (“is greater than 3”).than 3”).

• Let Let PP((XX) denote statement “) denote statement “XX is greater than 3”, is greater than 3”, where where PP denote the predicate “is greater than denote the predicate “is greater than 3”. 3”. PP((XX)) is also said to be is also said to be the value of the value of propositional function propositional function PP((··)) at at XX . .

• For example, let For example, let PP((XX) denote “) denote “XX > 3”, what are > 3”, what are the truth values of the truth values of PP(4) and (4) and PP(2)?(2)?

Page 4: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

PredicatesPredicates• Let Let QQ((xx, , yy) denote the statement “) denote the statement “xx = = yy+3”, Wh+3”, Wh

at are the truth values of the propositions at are the truth values of the propositions QQ(1, (1, 2) and 2) and QQ(3, 0)?(3, 0)?

• Let Let RR((xx, , yy, , zz) denote the statement “) denote the statement “xx++yy = = zz”, W”, What are the truth values of the propositions hat are the truth values of the propositions RR(1, (1, 2, 3) and 2, 3) and RR(0, 0, 1)?(0, 0, 1)?

• A statement of the form A statement of the form PP((xx11, , xx22, …, , …, xxnn)) is is the vathe value of the lue of the propositional functionpropositional function PP at the at the nn-tuple -tuple ((xx11, , xx22, …, , …, xxnn)), and , and PP is also called a is also called a predicatepredicate..

Page 5: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Predicate LogicPredicate Logic

• Predicate logicPredicate logic is an extension of is an extension of propositional propositional logiclogic that permits concisely reasoning about that permits concisely reasoning about whole whole classesclasses of entities. of entities.

• Propositional logic (recall) treats simple Propositional logic (recall) treats simple propositionspropositions (sentences) as atomic entities. (sentences) as atomic entities.

• In contrast,In contrast, predicatepredicate logiclogic distinguishes thedistinguishes the subject subject of a sentence from itsof a sentence from its predicatepredicate..

- Remember these English grammar terms?- Remember these English grammar terms?

Page 6: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Applications of Predicate Applications of Predicate LogicLogic

• It is the formal notation for writing perfectly It is the formal notation for writing perfectly clear, concise, and unambiguous mathematical clear, concise, and unambiguous mathematical definitionsdefinitions, , axiomsaxioms, and, and theorems theorems for anyfor any branch of mathematics.branch of mathematics.

- Predicate logic with function symbols, the- Predicate logic with function symbols, the “=” “=” operator, and a fewoperator, and a few proof-building rules proof-building rules is is sufficient for definingsufficient for defining any conceivable any conceivable mathematical system, and for proving anything mathematical system, and for proving anything that can that can be provedbe proved within that system! within that system!

Page 7: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Other ApplicationsOther Applications• Predicate logicPredicate logic is the foundation of the is the foundation of the

field of field of mathematical logicmathematical logic, which , which culminated in culminated in Gödel’s incompleteness Gödel’s incompleteness theoremtheorem, which revealed the ultimate , which revealed the ultimate limits of mathematical thought :limits of mathematical thought :

Given any finitely describable, consistent Given any finitely describable, consistent proof procedure, there will always remainproof procedure, there will always remain

somesome true statements that will true statements that will never be never be provenproven by that procedure.by that procedure.

i.e.i.e., we , we can’tcan’t discover discover allall mathematical truths, unless we mathematical truths, unless we sometimes resort to sometimes resort to making guessesmaking guesses..

Kurt Gödel1906-1978

Page 8: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Practical Applications of Predicate Practical Applications of Predicate LogicLogic

• It is the basis for clearly expressed formal specIt is the basis for clearly expressed formal specifications for any complex system.ifications for any complex system.

• It is basis forIt is basis for automatic theorem provers automatic theorem provers and mand many other any other Artificial Intelligence systemsArtificial Intelligence systems..

E.g.E.g. automatic program verification systems automatic program verification systems..

• Predicate-logicPredicate-logic like statements are supported b like statements are supported by some of the more sophisticatedy some of the more sophisticated database que database query enginesry engines and and container class librariescontainer class libraries..

- these are types of programming tools- these are types of programming tools..

Page 9: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Subjects and PredicatesSubjects and Predicates

• In the sentence “The dog is sleeping”:In the sentence “The dog is sleeping”:

-- The phrase “the dog” denotes the The phrase “the dog” denotes the subjectsubject : : the the objectobject or or entityentity that the sentence is about.that the sentence is about.

- The phrase “is sleeping” denotes the - The phrase “is sleeping” denotes the predicate predicate :: a a propertyproperty that is true that is true ofof the subject. the subject.

• In predicate logic, a In predicate logic, a predicatepredicate is modeled as a is modeled as a ffunction unction PP(·)(·) from objects to propositions. from objects to propositions.

-- P P((xx) = “) = “xx is sleeping” (where is sleeping” (where xx is any object). is any object).

Page 10: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

More About PredicatesMore About Predicates• Convention: Lowercase variables Convention: Lowercase variables xx, , yy, , z...z... denote denote

objects/entities; uppercase variables objects/entities; uppercase variables PP, , QQ, , RR… … denote propositional functions (predicates).denote propositional functions (predicates).

• Keep in mind that the Keep in mind that the result of applyingresult of applying a a predicate predicate PP to an object to an object xx is the is the propositionproposition P P((xx). ). But the predicate But the predicate PP itselfitself ( (e.g. P e.g. P = “is sleeping”) = “is sleeping”) is is notnot a proposition (not a complete sentence).a proposition (not a complete sentence).

E.g.E.g. if if PP((xx) = “) = “xx is a prime number”, is a prime number”, PP(3) is the (3) is the proposition proposition “3 is a prime number.”“3 is a prime number.”

Page 11: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Propositional FunctionsPropositional Functions• Predicate logic Predicate logic generalizesgeneralizes the grammatical no the grammatical no

tion of a predicate to also include propositional tion of a predicate to also include propositional functions of functions of anyany number of arguments, each of number of arguments, each of which may take which may take anyany grammatical role that a nogrammatical role that a noun can take.un can take.

E.g.E.g. let let PP((xx, , yy, , zz) = “) = “x x gavegave y y the gradethe grade z z”, then if”, then ifx = x = “Mike”, “Mike”, y y = “Mary”, = “Mary”, z z = “A”, then= “A”, then

PP((xx, , yy, , zz) = “Mike gave Mary the grade A.”) = “Mike gave Mary the grade A.”

Page 12: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Universes of Discourse Universes of Discourse (U.D.s)(U.D.s)

• The power of distinguishing objects from prThe power of distinguishing objects from predicates is that it lets you state things about edicates is that it lets you state things about manymany objects at once. objects at once.

E.g., let E.g., let PP((xx)=“)=“xx+1 > +1 > xx”. We can then say,”. We can then say,“For “For anyany number number xx, , PP((xx) is true” ) is true” instead of instead of “(“(00+1>+1>00) ) ( (11+1>+1>11)) ( (22+1>+1>22)) ... ” ... ”

- - The The collection of valuescollection of values that a variable that a variable xx ca can take is called n take is called xx’s’s universe of discourse. universe of discourse. ((ddomainomain))

Page 13: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

QuantifiersQuantifiers

• QuantifiersQuantifiers provide a notation to provide a notation to quantify quantify ((countcount) how many) how many objects satisfy a given objects satisfy a given predicate.predicate.

• There are two types of quantifiers: There are two types of quantifiers: universal universal quantificationquantification and and existential quantificationexistential quantification..

Page 14: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Two Types of QuantifiersTwo Types of Quantifiers

• ““”” is the is the FORFORLLLL or or universal quantifieruniversal quantifier..xx PP((xx) means ) means for allfor all xx in the u.d., in the u.d., PP holds holds..

• ““”” is the is the XISTSXISTS or or existential quantifierexistential quantifier..x Px P((xx) means ) means there there existsexists an an xx in the u.d. in the u.d. (that i (that is, 1 or more) s, 1 or more) such thatsuch that PP((xx) is true) is true..

Page 15: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The Universal Quantifier The Universal Quantifier

E.g., let the u.d. of E.g., let the u.d. of xx be be parking spaces at TCUparking spaces at TCU..

Let Let PP((xx) be the ) be the predicatepredicate “ “xx is full.” is full.”

Then the Then the universal quantificationuniversal quantification of P of P((xx) is) is

xx PP((xx), is the), is the proposition proposition::

“ “All parking spaces at TCU are full.”, All parking spaces at TCU are full.”, i.e.i.e.,,

““Every parking space at TCU is full.”, Every parking space at TCU is full.”, i.e.i.e.,,

““For each parking space at TCU, that space is fulFor each parking space at TCU, that space is full.”l.”

Page 16: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The Existential Quantifier The Existential Quantifier

E.g., let the u.d. of E.g., let the u.d. of xx be be parking spaces at TCUparking spaces at TCU..

Let Let PP((xx) be the ) be the predicate predicate ““xx is full.” is full.”

Then the Then the existential quantificationexistential quantification of P of P((xx),),

xx PP((xx), is the ), is the propositionproposition::

“ “Some parking space at TCU is full.”, Some parking space at TCU is full.”, i.e.i.e.,,

“ “There is a parking space at TCU that is full.”There is a parking space at TCU that is full.”

“ “At least one parking space at TCU is full.”At least one parking space at TCU is full.”

Page 17: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Free and Bound VariablesFree and Bound Variables

• An expression like An expression like PP((xx) is said to have a ) is said to have a free vafree variableriable x x (meaning, (meaning, xx is is undefinedundefined).).

• A A quantifierquantifier (either (either or or ) ) operatesoperates on an expr on an expression having one or more free variables, and ession having one or more free variables, and bibindsnds one or more of those variables, to produce a one or more of those variables, to produce an expression having one or more n expression having one or more bound variablebound variabless..

Page 18: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example of BindingExample of Binding

• PP((x,yx,y) has 2 free variables, ) has 2 free variables, xx and and yy..

xx PP((xx, , yy) has 1 free variable, and one bound va) has 1 free variable, and one bound variable. [Which is which? riable. [Which is which? y y is free …] is free …]

• ““PP((xx), where ), where xx=3” is another way to bind =3” is another way to bind xx..

• An expression with An expression with zerozero free variables is a bon free variables is a bona-fide (actual) proposition.a-fide (actual) proposition.

• An expression with An expression with one or moreone or more free variables i free variables is still only a predicate: e.g., s still only a predicate: e.g., QQ((yy) = ) = xx PP((xx, , yy).).

Page 19: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

NegationsNegations

• Let Let xx PP((xx)) be the statement of be the statement of

“ “Every student in the class has taken a course in Every student in the class has taken a course in calculus”, where calculus”, where PP((xx) is “) is “xx has taken a course i has taken a course in calculus”n calculus”

• What is its negation? What is its negation? xx PP((xx))

((xx PP((xx)) ≡ )) ≡ xx PP((xx))

((xx QQ((xx)) ≡ )) ≡ xx QQ((xx))

Page 20: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Translating from English into Translating from English into Logical ExpressionsLogical Expressions

• Express “Every student in this class has studied Express “Every student in this class has studied Calculus” using predicates and quantifiers.Calculus” using predicates and quantifiers.

Sol.1Sol.1: Let : Let CC((··)) be the predicate of be the predicate of ““·· has studied C has studied Calculus”alculus”. Assume universe of disclosure of . Assume universe of disclosure of xx con consists of sists of the students in the classthe students in the class..

It’s It’s xx CC((xx).).

Page 21: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Translating from English into Translating from English into Logical Expressions Logical Expressions (cont’d)(cont’d)

Sol.2Sol.2: If the u.d. is all people. Let : If the u.d. is all people. Let SS((··)) be the predi be the predicate of cate of ““·· is in this class” is in this class”. The solution is . The solution is x Sx S((xx) ) C C((xx).). [Not [Not x Sx S((xx) ) C C((xx)) ? ]? ]

Sol.3Sol.3: We concern about other subjects. Let : We concern about other subjects. Let QQ((xx, , yy) be the predicate of “student ) be the predicate of “student xx has studied subj has studied subject ect yy”. The solution is ”. The solution is xx ( (SS((xx) ) Q Q((xx, Calculu, Calculus)).s)).

Page 22: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Review: Predicate LogicReview: Predicate Logic

• Objects Objects xx, , yy, , zz, … , …

• Predicates Predicates PP, , QQ, , RR, … are functions mapping obj, … are functions mapping objects ects xx to propositions to propositions PP((xx).).

• Multi-argument predicates Multi-argument predicates PP((xx, , yy).).

• Quantifiers: [Quantifiers: [xx PP((xx)] :≡ “For all )] :≡ “For all xx’s, ’s, PP((xx).” ).” [[x Px P((xx)] :≡ “There is an )] :≡ “There is an xx such that such that PP((xx).”).”

• Universes of discourse, bound & free variables.Universes of discourse, bound & free variables.

Page 23: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

InductionInduction

Page 24: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Introduction to InductionIntroduction to Induction

• A powerful, rigorous technique for proving that A powerful, rigorous technique for proving that a predicate a predicate PP((nn) is true for ) is true for everyevery natural number natural number nn, no matter how large, no matter how large..

• Essentially aEssentially a “domino effect” “domino effect” principle.principle.

Page 25: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The First Principle of The First Principle of Mathematical InductionMathematical Induction

• Based on a predicate-logic inference rule:Based on a predicate-logic inference rule:

PP(0)(0)nn00 ((PP((nn) ) PP((nn+1))+1))nn00 P P((nn))

Page 26: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The “Domino Effect”The “Domino Effect”

• Premise #1:Premise #1: Domino #0 falls.Domino #0 falls.

• Premise #2:Premise #2: For every For every kkNN,,if domino #if domino #kk falls, then so falls, then so

does domino #does domino #kk+1. +1.

• Conclusion:Conclusion: All ofAll ofthe dominoes fall down!the dominoes fall down!

Note:Note: this works even if there are this works even if there are infinitely many dominoes! infinitely many dominoes!

Page 27: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Validity of InductionValidity of Induction

ProofProof that that nn0 0 PP((nn)) is a valid consequent: is a valid consequent:

Given any Given any kk0, the 20, the 2ndnd antecedent antecedent

kk00 ((PP((kk))PP((kk+1))+1)) trivially implies that trivially implies that

kk0 (0 (kk<<nn))((PP((kk))PP((kk+1))+1)), , i.e.i.e., that , that ((PP(0)(0)PP(1)) (1)) ( (PP(1)(1)PP(2)) (2)) … … ( (PP((nn1)1)PP((nn)))). .

Repeatedly applying the hypothetical syllogism Repeatedly applying the hypothetical syllogism rule to adjacent implications in this list rule to adjacent implications in this list nn−−1 tim1 times then gives us es then gives us PP(0)(0)PP((nn)); which together wit; which together with h PP(0) (antecedent #1) and (0) (antecedent #1) and modus pones modus pones gives ugives us s PP((nn). Thus ). Thus nn0 0 PP((nn)). ■. ■

Page 28: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Outline of An Inductive Outline of An Inductive ProofProof

•Let us say we want to prove Let us say we want to prove nn PP((nn)…)…

–Do the Do the base casebase case (or (or basis stepbasis step): Prove): Prove PP(0).(0).

–Do the Do the inductive stepinductive step: Prove: Prove nn PP((nn))PP((nn+1).+1).

E.g.E.g. you could use a direct proof, as follows: you could use a direct proof, as follows:

•Let Let nnNN, assume, assume PP((nn). (). (inductive hypothesisinductive hypothesis))

•Now, under this assumption, proveNow, under this assumption, prove PP((nn+1).+1).

–The inductive inference rule then gives usThe inductive inference rule then gives us

nn PP((nn).).

Page 29: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Generalizing InductionGeneralizing Induction

• Rule can also be used to prove Rule can also be used to prove nncc PP((nn)) for a for a given constant given constant ccZZ, where maybe , where maybe cc0.0.– In this circumstance, the base case is to prove In this circumstance, the base case is to prove PP((cc)) ra ra

ther than ther than PP(0), and the inductive step is to prove(0), and the inductive step is to prove nnc c ((PP((nn))PP((nn+1)).+1)).

• Induction can also be used to proveInduction can also be used to provenncc PP((aann)) for any arbitrary series { for any arbitrary series {aann}.}.

• Can reduce these to the form already shown.Can reduce these to the form already shown.

Page 30: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The Second Principle of The Second Principle of Mathematical InductionMathematical Induction

•Characterized by another inference rule:Characterized by another inference rule: PP(0) (0) “Strong Induction” nn0: (0: (00kknn PP((kk)) )) PP((nn+1)+1)nn0: 0: PP((nn))

•The only difference between this and the 1The only difference between this and the 1stst princip principle is that:le is that:

- the inductive step here makes use of the stronger hypothesis that P(k) is true for all smaller numbers k < n+1, not just for k = n.

P is true in all previous cases

Page 31: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Examples of InductionExamples of Induction

Page 32: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

11stst Principle Example Principle Example

•Prove that the sum of the first Prove that the sum of the first nn odd positive odd positive integers is integers is nn22. That is, prove:. That is, prove:

•Proof by induction:Proof by induction:

– Base case: Let Base case: Let nn=1. The sum of the first 1 =1. The sum of the first 1 odd positive integer is 1 which equals 1odd positive integer is 1 which equals 122..(cont’d…)(cont’d…)

2

1

1: (2 1)n

i

n i n

P(n)

Page 33: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

11stst Principle Example Principle Example (cont’d)(cont’d)

• Inductive step:Inductive step: Prove Prove nn≥≥1: 1: PP((nn)→)→PP((nn+1)+1)..

Let Let nn≥1, assume≥1, assume PP((nn)), and prove, and prove PP((nn+1)+1)

By inductive hypothesis By inductive hypothesis PP((nn). ■). ■

1

1 1

2

2

(2 1) (2 1) (2( 1) 1)

2 1

( 1)

n n

i i

i i n

n n

n

Page 34: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Another Induction ExampleAnother Induction Example

Prove that Prove that n n > 0, > 0, n n < 2< 2nn.. Let Let PP((nn) = () = (n n < 2< 2nn))

Base case:Base case: PP(1) = (1<2(1) = (1<211) = (1<2) = ) = (1<2) = TT..Inductive step: For Inductive step: For nn>0, prove>0, prove PP((nn))→→PP((nn+1)+1)..Assuming Assuming nn < 2 < 2nn, prove , prove n n + 1 < 2+ 1 < 2nn+1+1..NoteNote n n + 1 < 2+ 1 < 2nn + 1 + 1 (by inductive hypothesis)(by inductive hypothesis)

< 2< 2nn + 2 + 2nn (1 < 2 = 2(1 < 2 = 2··220 0 ≤ 2≤ 2··22nn-1 -1 = 2= 2nn))

= 2= 2nn+1+1

So So n n + 1 < 2+ 1 < 2nn+1+1, and we’re done. ■, and we’re done. ■

Page 35: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

More Induction ExamplesMore Induction Examples

1.1. nn33 – – nn is divisible by 3 is divisible by 3

2.2. 1 + 2 + 21 + 2 + 222 + … + 2 + … + 2nn = 2 = 2nn+1+1 – 1 – 1

3.3. Sums of Geometric ProgressionsSums of Geometric Progressions

4.4. An Inequality for Harmonic NumbersAn Inequality for Harmonic Numbers

5.5. , where, where

6.6. DeMorgan’s lawDeMorgan’s law

7.7. Number of Subsets of a finite setNumber of Subsets of a finite set

8.8. 22nn < < n n!!

1 1/ 2 1/ 3 1/H jj 2

1 / 2nH n

Page 36: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

More Induction ExamplesMore Induction Examples

E.g. 9: Any chessboard with 2E.g. 9: Any chessboard with 2nn×2×2nn squares but with one squares but with one removed can be tiled using L-shaped pieces (which removed can be tiled using L-shaped pieces (which cover 3 squares at a time).cover 3 squares at a time).

E.g. 10: The greedy algorithm (selects talk with earliest E.g. 10: The greedy algorithm (selects talk with earliest ending time) schedules the most talks in a single ending time) schedules the most talks in a single lecture halls.lecture halls.

Page 37: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The Second Principle of The Second Principle of Mathematical InductionMathematical Induction

•Characterized by another inference rule:Characterized by another inference rule: PP(0) (0) “Strong Induction” nn0: (0: (00kknn PP((kk)) )) PP((nn+1)+1)nn0: 0: PP((nn))

•The only difference between this and the 1The only difference between this and the 1stst princ principle is that:iple is that:

- the inductive step here makes use of the stronger hypothesis that P(k) is true for all smaller numbers k < n+1, not just for k = n.

P is true in all previous cases

Page 38: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The 2The 2ndnd Principle of Math Principle of Math InductionInduction

PP((nn) ) 為一命題為一命題,,其中其中 nn 為自然數為自然數:: 1. 1. 若 若 PP(1), (1), PP(2), (2), PP(3), …, (3), …, PP((qq) ) 成立成立,, 2. 2. 假設對於所有介於 假設對於所有介於 11iikk 之自然數之自然數 (( 其中其中 qqkk)) ,, PP((ii) ) 成立成立,, 3. 3. 在 在 1& 2 1& 2 成立下成立下,,若 若 PP((kk+1) +1) 亦成立亦成立,, 則 則 nn0: 0: PP((nn) ) 成立。

Page 39: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

22ndnd Principle Example Principle Example

• Show that every Show that every nn>1 can be written as a product >1 can be written as a product ppii = = pp11pp22……ppss of some series of of some series of ss prime numbers. prime numbers.

Let Let PP((nn) = “) = “nn has that property” has that property”

• Base case:Base case: nn = 2, let = 2, let s s = 1,= 1, p p1 1 = 2= 2..

• Inductive step:Inductive step: Let Let nn22. Assume . Assume 2 2 ≤ ≤ k k ≤ ≤ nn: : PP((kk))..

Consider Consider nn+1+1. If it’s prime, let . If it’s prime, let s s = 1, = 1, pp1 1 = = nn+1+1..

Else Else nn+1 = +1 = abab, where , where 2 2 ≤≤ a a ≤ ≤ nn and and 2 2 ≤≤ b b ≤ ≤ nn..Then Then a a = = pp11pp22……pptt and and b b = = qq11qq22……qquu..

Then we have that Then we have that nn+1 = +1 = pp11pp22……ppt t qq11qq22……qquu, a product of , a product of s s

= = tt++uu primes. ■primes. ■

Page 40: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Another 2Another 2ndnd Principle Principle ExampleExample

•Prove that every amount of postage of 12 cents or moProve that every amount of postage of 12 cents or more can be formed using just 4-cent and 5-cent stamps. re can be formed using just 4-cent and 5-cent stamps. PP((nn) = “) = “nn can be…” can be…”

•Base case:Base case: 12 = 3(4), 13 = 2(4)+1(5), 14 = 1(4)+2(5), 12 = 3(4), 13 = 2(4)+1(5), 14 = 1(4)+2(5), 15 = 3(5),15 = 3(5), so so 1212nn15, 15, PP((nn).).

•Inductive step:Inductive step: Let Let nn≥≥1515, assume , assume 1212kknn PP((kk).).

Note Note 1212nn33nn,, so so PP((nn3),3), so add a 4-cent stamp to so add a 4-cent stamp to get postage for get postage for nn+1+1..

Page 41: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The Well-Ordering The Well-Ordering PropertyProperty

• Another way to prove the validity of the Another way to prove the validity of the inductiinductive inferenceve inference rule is by the rule is by the well-ordering propertwell-ordering propertyy, which says that:, which says that:

- - Every non-empty set of non-negative integers Every non-empty set of non-negative integers has a minimum (smallest) element.has a minimum (smallest) element.

- - SSNN : : mmSS : : nnSS : : mmnn

• This implies that {This implies that {nn||PP((nn)} (if non-empty) has a mi)} (if non-empty) has a minimal element nimal element mm, but then the assumption that , but then the assumption that PP((mm−−1)1)PP((((mm−1)+1)−1)+1) would be contradicted. would be contradicted.

Page 42: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The Well-Ordering The Well-Ordering PropertyProperty

• Any non-empty subset of ZAny non-empty subset of Z++ contains a smallest contains a smallest element. element. (Z(Z++ is well ordered) is well ordered)

Example 1: If Example 1: If a a is an integer and is an integer and dd is a positive int is a positive integer. There are unique integers eger. There are unique integers qq and and r r with 0≦with 0≦rr<<dd and and aa = d= d××qq + + r.r.

Example 2: If there is a cycle of length Example 2: If there is a cycle of length mm ( (mm≧≧3) a3) among the players in a round-robin tournament, tmong the players in a round-robin tournament, there must be a cycle of three.here must be a cycle of three.

Page 43: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The Method of Infinite The Method of Infinite DescentDescent

• A way to prove that A way to prove that PP((nn) is false for all ) is false for all nnNN..

(Sort of a (Sort of a converseconverse to the principle of induction) to the principle of induction)

• Prove first that Prove first that PP((nn): ): kk<<nn: : PP((kk).).

- Basically, “For every - Basically, “For every PP there is a smaller there is a smaller PP.”.”

• But by the But by the well-ordering property of well-ordering property of NN, we know , we know that that PP((mm) ) PP((nn): ): PP((kk): ): nn≤≤kk..

- Basically, “If there is a - Basically, “If there is a PP, there is a smallest , there is a smallest PP.”.”

• Note that these are Note that these are contradictorycontradictory unless unless ¬¬PP((mm),),

- that is, - that is, mmNN: ¬: ¬PP((mm).). There is no There is no PP..

Page 44: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Infinite DescentInfinite Descent

• Infinite DescentInfinite Descent :: For a propositional function For a propositional function PP((nn), ), PP((kk) is false for all positive integers.) is false for all positive integers.

Example: is irrational.Example: is irrational.2

Page 45: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Infinite Descent ExampleInfinite Descent Example• Theorem:Theorem: 2 21/21/2 is irrational. is irrational.

Proof:Proof: Suppose 2Suppose 21/21/2 is rational is rational, then , then mm, , nnZZ++: 2: 21/21/2==mm//nn. Let . Let MM, , NN be the be the mm, , nn with the least with the least nn. .

So So kk<<NN, , jj: 2: 21/21/2 = = jj//kk (let (let j j = 2= 2NN−−MM, , k k = = MM−−NN). ■). ■

.222 222

2

MNN

M

N

M

N

M

NNM

MNM

NNM

MNM

NNM

MNN

NNM

NMN

NM

MN

)(

)(

)()(

2

)(

)2(2 22

NNMNMNN

M 0221221

Page 46: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

補 充補 充Propositional EquivalencePropositional Equivalence

Page 47: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Propositional EquivalencePropositional Equivalence

• Compound propositions Compound propositions pp and and qq that have same that have same truth values in all possible cases are called truth values in all possible cases are called logically equivalentlogically equivalent, denoted as , denoted as pp≡ ≡ qq..

• The symbol ≡ is not a logical connective, it The symbol ≡ is not a logical connective, it means that means that pp≡ ≡ q q is not a compound prop.is not a compound prop.

• Sometimes, the symbol Sometimes, the symbol is used instead of is used instead of ≡≡..

Page 48: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Tautologies and Tautologies and ContradictionsContradictions

• A A tautologytautology is a compound proposition that is is a compound proposition that is truetrue no matter whatno matter what the truth values of its the truth values of its atomic propositions are!atomic propositions are!

Ex.Ex. p p pp [Truth table …] [Truth table …]

• A A contradictioncontradiction is a compound proposition that is a compound proposition that is is falsefalse no matter what! no matter what!

Ex.Ex. p p p p [Truth table …][Truth table …]

• Other compound props. are Other compound props. are contingenciescontingencies..

Page 49: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logical EquivalenceLogical Equivalence

• Compound proposition Compound proposition pp is is logically equivalenlogically equivalentt to compound proposition to compound proposition qq, written , written pp≡ ≡ qq, , IFFIFF the compound proposition the compound proposition ppq q is a tautologyis a tautology..

• Compound propositions Compound propositions pp and and q q are logically eare logically equivalent to each otherquivalent to each other IFFIFF pp and and q q contain the contain the same truth values as each other in same truth values as each other in allall rows of t rows of their truth tablesheir truth tables..

Page 50: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Prove Equivalence via Truth Prove Equivalence via Truth TablesTables

Ex.Ex. Prove that Prove that ppqq ≡ ≡ ((p p qq).).

p q p q p q p q (p q) F F F T T F T T

FT

TT

T

T

T

TT

T

FF

F

F

FF

FF

TT

Page 51: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Equivalence LawsEquivalence Laws

• These are similar to the arithmetic identities you These are similar to the arithmetic identities you may have learned in algebra, but for may have learned in algebra, but for propositional equivalences instead.propositional equivalences instead.

• They provide a pattern or template that can be They provide a pattern or template that can be used to match all or part of a much more used to match all or part of a much more complicated proposition and to find an complicated proposition and to find an equivalence for it.equivalence for it.

Page 52: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example of Equivalence Example of Equivalence LawsLaws

• Identity: Identity: ppT T ≡ ≡ p pp pF F ≡ ≡ pp

• Domination: Domination: ppT T ≡ ≡ T T ppF F ≡ ≡ FF

• Idempotent: Idempotent: ppp p ≡ ≡ p pp pp p ≡ ≡ pp

• Double negation:Double negation: p p ≡ ≡ pp

• Commutative:Commutative: p pq q ≡ ≡ qqp pp pq q ≡ ≡ qqpp

• Associative:Associative: ((ppqq))rr ≡ ≡ pp((qqrr)) ( (ppqq))rr ≡ ≡ pp((qqrr))

Page 53: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

More Equivalence LawsMore Equivalence Laws

• Distributive: Distributive: pp((qqrr) ≡ () ≡ (ppqq))((pprr)) pp((qqrr) ≡ () ≡ (ppqq))((pprr))

• De Morgan’s:De Morgan’s:((ppqq) ≡ ) ≡ p p qq

((ppqq) ≡ ) ≡ p p qq

• Trivial tautology/contradiction:Trivial tautology/contradiction: pp pp ≡ ≡ TT pp pp ≡ ≡ FF

Page 54: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Nested QuantifiersNested Quantifiers

Page 55: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Nested QuantifiersNested Quantifiers

Example: Let the u.d. of Example: Let the u.d. of xx & & yy be people. be people.

Let Let LL((xx, , yy) = “) = “x x likes likes yy” (a predicate with 2 free va” (a predicate with 2 free variables)riables)

Then Then y Ly L((x, yx, y) = “There is someone whom ) = “There is someone whom xx like likes.” (A predicate with 1 free variable, s.” (A predicate with 1 free variable, xx))

Then Then xx ( (y Ly L((x, yx, y)) =)) = “Everyone has someone whom they like.” “Everyone has someone whom they like.”(A (A propositionproposition with with 00 free variables.) free variables.)

Page 56: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Quantifier ExerciseQuantifier Exercise

If If RR((xx,,yy)=“)=“xx relies upon relies upon yy,” express the following ,” express the following in unambiguous English:in unambiguous English:

xx((y Ry R((x,yx,y))=))=

yy((xx RR((x,yx,y))=))=

xx((y Ry R((x,yx,y))=))=

yy((x Rx R((x,yx,y))=))=

xx((y Ry R((x,yx,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 57: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Natural Language Is Natural Language Is AmbiguousAmbiguous

• ““Everybody likes somebody.”Everybody likes somebody.”– For everybody, there is somebody they like,For everybody, there is somebody they like,

xx yy LikesLikes((xx, , yy))

– or, there is somebody (a popular person) whom everor, there is somebody (a popular person) whom everyone likes?yone likes?yy xx LikesLikes((xx, , yy))

• ““Somebody likes everybody.”Somebody likes everybody.”– Same problem: Depends on context, emphasis.Same problem: Depends on context, emphasis.

[Probably more likely]

Page 58: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

More ConventionsMore Conventions•Sometimes the universe of discourse is restricted within Sometimes the universe of discourse is restricted within

the quantification,the quantification,

E.g.E.g., , x>x>0 0 PP((xx) is shorthand for) is shorthand for

“ “For all For all xx that are greater than zero, that are greater than zero, PP((xx).”).”

==x x ((x>x>0 0 PP((xx))))

x>x>0 0 PP((xx) is shorthand for) is shorthand for

“ “There is an There is an x x greater than zero such that greater than zero such that PP((xx).”).”

==x x ((x>x>0 0 PP((xx))))

Page 59: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

More About BindingMore About Binding

xx x Px P((xx) - ) - xx is not a free variable in is not a free variable in x Px P((xx), therefore the ), therefore the xx binding binding isn’t usedisn’t used..

• ((xx PP((xx)))) Q( Q(xx) - The variable ) - The variable xx is outside of th is outside of the e scopescope of the of the x x quantifier, and is therefore frequantifier, and is therefore free. Not a proposition!e. Not a proposition!

• ((xx PP((xx)))) ((x x Q(Q(xx))) ) – This is legal, because th– This is legal, because there are 2 ere are 2 differentdifferent xx’s!’s!

Page 60: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Quantifier Equivalence Quantifier Equivalence LawsLaws

•Definitions of quantifiers: If u.d.=a,b,c,… Definitions of quantifiers: If u.d.=a,b,c,… x Px P((xx) ) PP(a) (a) PP(b) (b) PP(c) (c) … … x Px P((xx) ) PP(a) (a) PP(b) (b) PP(c) (c) … …

•From those, we can prove the laws:From those, we can prove the laws:x Px P((xx) ) x x PP((xx))x Px P((xx) ) x x PP((xx))

•Which Which propositionalpropositional equivalence laws can be us equivalence laws can be used to prove this?ed to prove this?

Page 61: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

(Chalkboard)(Chalkboard)• (Chalkboard) Another way to see why the order of quantifier(Chalkboard) Another way to see why the order of quantifier

s matters is to expand out the definitions of FORALL and Es matters is to expand out the definitions of FORALL and EXISTS in terms of AND and OR. E.g., suppose the universe XISTS in terms of AND and OR. E.g., suppose the universe of discourse just consists of two objects of discourse just consists of two objects aa and and bb. Now, consi. Now, consider some predicate der some predicate PP((xx, , yy). Then,). Then,

FORALL FORALL xx EXISTS EXISTS yy PP((xx, , yy)) (EXISTS (EXISTS yy PP((aa, , yy)) /\ (EXISTS )) /\ (EXISTS yy PP((bb, , yy)) )) ((PP((aa, , aa) \/ ) \/ PP((aa, , bb)) /\ )) /\ PP((bb, , aa) \/ ) \/ PP((bb, , bb)).)).

In contrast,In contrast, EXISTS EXISTS yy FORALL FORALL xx PP((xx, , yy)) (FORALL (FORALL xx PP((xx, , aa)) \/ (FORALL )) \/ (FORALL xx PP((xx, , bb)) )) ((PP((aa, , aa) /\ ) /\ PP((bb, , aa)) \/ ()) \/ (PP((aa, , bb) /\ ) /\ PP((bb, , bb)).)).

Page 62: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

(Chalkboard)(Chalkboard)•To see that these two are inequivalent, suppose only To see that these two are inequivalent, suppose only PP((aa,,

aa) and ) and PP((bb, , bb) are true. Then, the first proposition (with ) are true. Then, the first proposition (with the FORALL first) is true, but, the second proposition the FORALL first) is true, but, the second proposition (with the EXISTS first) is true. Students can come up w(with the EXISTS first) is true. Students can come up with this counterexample in-class as an exercise.ith this counterexample in-class as an exercise.

Page 63: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

More Equivalence LawsMore Equivalence Laws

x x y Py P((xx,,yy) ) y y x Px P((xx,,yy))x x y Py P((xx,,yy) ) y y x Px P((xx,,yy))

x x ((PP((xx) ) QQ((xx)))) ((x Px P((xx)))) ((x Qx Q((xx))))x x ((PP((xx) ) QQ((xx)))) ((x Px P((xx)))) ((x Qx Q((xx))))

Exercise: Exercise: See if you can prove these yourself.See if you can prove these yourself.– What propositional equivalences did you use?What propositional equivalences did you use?

Page 64: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

More Notational More Notational ConventionsConventions

• Quantifiers bind as loosely as needed:Quantifiers bind as loosely as needed:parenthesize parenthesize x x PP((xx) ) Q( Q(xx))

• Consecutive quantifiers of the same type can Consecutive quantifiers of the same type can be combined: be combined: x x y y z Pz P((xx,,yy,,zz) ) x,y,z Px,y,z P((xx,,yy,,zz) or even ) or even xyz Pxyz P((xx,,yy,,zz))

• All quantified expressions can be reducedAll quantified expressions can be reducedto the canonical to the canonical alternatingalternating form form xx11xx22xx33xx44… … PP((xx11,, xx22, , xx33, , xx4,4, …) …)

( )

Page 65: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Defining New QuantifiersDefining New Quantifiers

• As per their name, quantifiers can be used to As per their name, quantifiers can be used to express that a predicate is true of any given express that a predicate is true of any given quantityquantity (number) of objects. (number) of objects.

• Define Define !!xx PP((xx) to mean “) to mean “PP((xx) is true of ) is true of exactly oneexactly one xx in the universe of discourse.” in the universe of discourse.”

!!xx PP((xx) ) x x ((PP((xx) ) y y ((PP((yy) ) y y x x))))“There is an “There is an xx such that such that PP((xx), where there is no ), where there is no yy such that P( such that P(yy) and ) and yy is other than is other than xx.”.”

Page 66: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Some Number Theory Some Number Theory ExamplesExamples

• Let u.d. = the Let u.d. = the natural numbersnatural numbers 0, 1, 2, … 0, 1, 2, …

• ““A number A number xx is is eveneven, , EE((xx), if and only if it is e), if and only if it is equal to 2 times some other number.”qual to 2 times some other number.”x x ((EE((xx) ) ( (y x=y x=22yy))))

• ““A number is A number is primeprime, , PP((xx), iff it’s greater than ), iff it’s greater than 1 and it isn’t the product of two non-unity num1 and it isn’t the product of two non-unity numbers.”bers.”x x ((PP((xx) ) ((xx>1 >1 yz xyz x==yzyz yy1 1 zz11))))

Page 67: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Goldbach’s Conjecture Goldbach’s Conjecture (unproven)(unproven)

• Using Using EE((xx) and ) and PP((xx) from previous slide,) from previous slide,EE((xx>2): >2): PP((pp),),PP((qq): ): pp++qq = = xx

or, with more explicit notation:or, with more explicit notation: xx [ [xx>2 >2 EE((xx)] → )] →

pp q Pq P((pp) ) PP((qq) ) pp++qq = = xx..

“ “Every even number greater than 2 Every even number greater than 2 is the sum of two primes.” is the sum of two primes.”

Page 68: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Calculus ExampleCalculus Example

• One way of precisely defining the calculus One way of precisely defining the calculus concept of a concept of a limitlimit, using quantifiers:, using quantifiers:

lim ( )

0 : 0 : :

| | | ( ) |

x af x L

x

x a f x L

Page 69: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Deduction ExampleDeduction Example

• Definitions:Definitions:s :≡s :≡ Socrates Socrates (ancient Greek philosopher)(ancient Greek philosopher);;HH((xx) :≡ “) :≡ “xx is human”; is human”;MM((xx) :≡ “) :≡ “xx is mortal” is mortal”..

• Premises:Premises:HH(s) (s) Socrates is human.Socrates is human.

xx HH((xx))MM((xx) ) All hAll humans are mortal.umans are mortal.

Page 70: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Deduction Example Deduction Example ContinuedContinued

Some valid conclusions you can draw:Some valid conclusions you can draw:HH(s)(s)MM(s) (s) [Instantiate universal.][Instantiate universal.] If Socrates is humanIf Socrates is human

then he is mortal. then he is mortal.HH(s) (s) MM(s) (s) Socrates is inhuman or mortal.Socrates is inhuman or mortal.HH(s) (s) ( (HH(s) (s) MM(s)) (s))

Socrates is human, and also either inhuman or Socrates is human, and also either inhuman or mortal.mortal.

((HH(s) (s) HH(s)) (s)) ( (HH(s) (s) MM(s)) (s)) [Apply distributive law.][Apply distributive law.]FF ( (HH(s) (s) MM(s)) (s)) [Trivial contradiction.][Trivial contradiction.]HH(s) (s) MM(s) (s) [Use identity law.][Use identity law.]MM(s) (s) Socrates is mortal.Socrates is mortal.

Page 71: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Another ExampleAnother Example

• Definitions: Definitions: HH((xx) :≡ “) :≡ “xx is human”; is human”; MM((xx) :≡ “) :≡ “xx is mortal”; is mortal”; G G((xx) :≡ “) :≡ “xx is a god” is a god”

• Premises:Premises:– xx HH((xx) ) MM((xx) (“Humans are mortal”) and) (“Humans are mortal”) and

– xx GG((xx) ) MM((xx) (“Gods are immortal”).) (“Gods are immortal”).

• Show that Show that x x ((HH((xx) ) GG((xx))))(“No human is a god.”)(“No human is a god.”)

Page 72: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

The DerivationThe Derivationxx HH((xx))MM((xx) and ) and xx GG((xx))MM((xx).).

xx MM((xx))HH((xx) ) [Contrapositive.][Contrapositive.]

xx [ [GG((xx))MM((xx)] )] [ [MM((xx))HH((xx)])]

xx GG((xx))HH((xx) ) [Transitivity of [Transitivity of .].]

xx GG((xx) ) HH((xx) ) [Definition of [Definition of .].]

xx ((GG((xx) ) HH((xx)) )) [DeMorgan’s law.][DeMorgan’s law.]

xx GG((xx) ) HH((xx) ) [An equivalence law.][An equivalence law.]

Page 73: 資訊科學數學 6 : Predicates, Quantifiers & Mathematical Induction 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Summary of Predicate LogicSummary of Predicate LogicFrom these sections you should have learned:From these sections you should have learned:

- Predicate logic notation & conventions- Predicate logic notation & conventions

- Conversions: predicate logic - Conversions: predicate logic clear English clear English

- Meaning of quantifiers, equivalences- Meaning of quantifiers, equivalences

- Simple reasoning with quantifiers- Simple reasoning with quantifiers