資訊科學數學 6 : predicates, quantifiers & mathematical induction 陳光琦助理教授...
TRANSCRIPT
資訊科學數學資訊科學數學 6 6 ::
Predicates, Quantifiers &Predicates, Quantifiers & MathMathematical Inductionematical Induction
陳光琦助理教授 陳光琦助理教授 (Kuang-Chi Che(Kuang-Chi Chen)n)
[email protected]@mail.tcu.edu.tw
Predicates & Predicates & QuantifiersQuantifiers
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)?
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..
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?
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!
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
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..
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).
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.”
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.”
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))
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..
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..
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.”
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.”
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..
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).).
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))
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).).
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)).
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.
InductionInduction
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.
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))
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!
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)). ■. ■
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).).
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.
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
Examples of InductionExamples of Induction
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)
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
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. ■
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
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.
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
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) ) 成立。
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. ■
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..
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.
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.
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..
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
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
補 充補 充Propositional EquivalencePropositional Equivalence
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 ≡≡..
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..
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..
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
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.
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))
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
Nested QuantifiersNested Quantifiers
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.)
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)!
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]
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))))
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!
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?
(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)).)).
(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.
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?
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, …) …)
( )
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.”.”
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))))
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.”
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
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.
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.
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.”)
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.]
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