the foundat ions logic and the foundat ions logic and the
play

The Foundat ions: Logic and The Foundat ions: Logic and The Foundat - PDF document

The Foundat ions: Logic and The Foundat ions: Logic and The Foundat ions: Logic and Proof , Set s, and Funct ions Proof , Set s, and Funct ions Proof , Set s, and Funct ions 1 Out line Logic Proposit ional Equivalences Predicat es


  1. The Foundat ions: Logic and The Foundat ions: Logic and The Foundat ions: Logic and Proof , Set s, and Funct ions Proof , Set s, and Funct ions Proof , Set s, and Funct ions 1 Out line ‧ Logic ‧ Proposit ional Equivalences ‧ Predicat es and Quant if iers ‧ Met hods of Proof ‧ Set s and Set Operat ions ‧ Funct ions Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 2

  2. Part 1. Foundat ion of Logic Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 3 Mat hemat ical Logic Mat hemat ical Logic is a t ool f or working wit h complicat ed compound st at ement s. I t includes: ‧ A language f or expressing t hem. ‧ A concise not at ion f or writ ing t hem. ‧ A met hodology f or obj ect ively reasoning about t heir t rut h or f alsit y. ‧ I t is t he f oundat ion f or expressing f ormal proof s in all branches of mat hemat ics. Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 4

  3. Foundat ions of Logic: Overview • Proposit ional logic ( § 1.1-1.2): – Basic def init ions. ( § 1.1) – Equivalence rules & derivat ions. ( § 1.2) • Predicat e logic ( § 1.3-1.4) – Predicat es. – Quant if ied predicat e expressions. – Equivalences & derivat ions. Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 5 Topic #1 – Propositional Logic Proposit ional Logic Proposit ional Logic is t he logic of compound st at ement s built f rom simpler st at ement s using so-called Boolean connect ives. Some applicat ions in comput er science: • Design of digit al elect ronic circuit s. • Expressing condit ions in programs. • Queries t o dat abases & search engines. Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 6

  4. Proposit ions • Proposit ions: t he basic building blocks of logic • Proposit ion (St at ement 、命題、敘述 ) : a declarat ive sent ence t hat is eit her t rue or f alse, but not bot h. • Ex: – Washingt on, D.C., is t he capit al of t he USA. (t r ue) – Toront o is t he capit al of Canada. (f alse) – 1 + 1 = 2. (t r ue) – 2 + 2 = 3. (f alse) Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 7 Proposit ions (Cont .) • Example: A st at ement cannot be t rue or f alse unless it is declarat ive. This excludes commands and quest ions. – Read t his caref ully. – What t ime is it ? • Declarat ions about semant ic t okens of non- const ant value are NOT proposit ions. – x + 1 = 2. – x + y = z. Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 8

  5. Proposit ions (Cont .) ‧ The ar ea of logic t hat deals wit h pr oposit ions is called t he proposit ional calculus (or pr oposit ional logic). – f ir st developed syst emat ically by t he Gr eek philosopher Ar ist ot le mor e t han 2300 year s ago. ‧ Let t er s ar e used t o denot e proposit ions. – p : t he weat her is f ine t oday. ‧ The t r ut h value of a pr oposit ion is t r ue, denot ed by T, if it is a t r ue proposit ion and f alse, denot ed by F, if it is a f alse pr oposit ion. ‧ Compound pr oposit ions : f or med f rom exist ing pr oposit ions using logical oper at or s or connect ives. – p and q, p or q Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 9 Negat ion, Conj unct ion, Disj unct ion, and Exclusive or ‧ Tr ut h t able ( 真值表 ) : displays t he r elat ionships bet ween t he t r ut h values of proposit ions. ‧ negat ion( ¬ )/ conj unct ion( ∧ )/ disj unct ion( ∨ ) / exclusive or( ⊕ ) ¬ p p ∧ q p ∨ q p ⊕ q p p q p q T T F T F T T T T T F T F T T F F T F T T F T F T F F F F F F F Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 10

  6. Nat ural Language is Ambiguous • Not e t hat English “ or ” can be ambiguous r egar ding t he “ bot h ” p q p "or" q case! – “ Pat is a singer or F F F at is a wr it er . ” - ∨ P – “ Pat is a man or F T T at is a woman. ” - ⊕ P T F T • Need cont ext t o disambiguat e t he T T ? meaning! • For t his class, assume “ or ” means inclusive. Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 11 I mplicat ions ‧ I mplicat ion ( → ) is somet imes called a condit ional st at ement : – if p, t hen q p → q p q – p implies q – q when p T T T – q f ollows f r om p T F F – p only if q F T T – p is suf f icient f or q – p is a suf f icient condit ion f or q F F T – q is necessar y f or p – q is a necessar y condit ion f or p ‧ p : hypot hesis, ant ecedent or pr emise ‧ q: conclusion or consequence Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 12

  7. I mplicat ions (Cont .) ‧ Ex: The pledge many polit icians make when r unning f or of f ice is: “ I f I am elect ed, t hen I will lower t axes. ” – I f t he polit ician is elect ed, vot er s would expect t his polit ician t o lower t axes. – I f t he polit ician is not elect ed, t hen vot er s will not have any expect at ion t hat t his per son will lower t axes. – I t is only when t he polit ician is elect ed but does not lower t axes t hat vot er s can say t hat t he polit ician has br oken t he campaign pledge. ‧“ p only if q ” is equivalent t o “ if p t hen q. ” – p can not be t r ue when q is not t r ue – The st at ement is f alse if p is t r ue, but q is f alse. Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 13 I mplicat ions (Cont .) ‧ Ex: The implicat ion “ I f t oday is Fr iday, t hen 2 + 3 = 5. ” is t r ue f r om t he def init ion of implicat ion, since it s conclusion is t r ue. (The t r ut h value of t he hypot hesis does not mat t er t hen.) ‧ Ex: The implicat ion “ I f t oday is Fr iday, t hen 2 + 3 = 6. ” is t r ue ever y day except Fr iday, even t hough 2 + 3 = 6 is f alse. Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 14

  8. Converse, Cont raposit ive, and I nverse ‧ The pr oposit ion q → p is t he converse of p → q. ‧ The cont r aposit ive of p → q is t he pr oposit ion ¬ q →¬ p. – The cont r aposit ive has t he same t r ut h value as p → q. ‧ The pr oposit ion ¬ p →¬ q is t he inver se of p → q. ‧ When t wo compound pr oposit ions always have t he same t r ut h value, we call t hem equivalent . – An implicat ion and it s cont r aposit ive ar e equivalent . – The conver se and t he inver se of an implicat ion ar e also equivalent . Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 15 Biocondit ional ‧ Bicondit ional p ↔ q : p ↔ q p q – p if and only if (if f ) q T T T – p is necessar y and suf f icient f or q – I f p t hen q, and conver sely T F F F T F ‧ p ↔ q has exact ly t he same t r ut h F F T value as (p → q) ∧ (q → p). ‧ The bicondit ional p ↔ q is t r ue pr ecisely when bot h t he implicat ions p → q and q → p ar e t r ue. –“ You can t ake t he f light if f you buy a t icket . ” Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 16

  9. Boolean Operat ions Summary • We have seen 1 unary operat or (out of t he 4 possible) and 5 binary operat ors (out of t he 16 possible). Their t rut h t ables are below. q ¬ p p ∧ q p ∨ q p ⊕ q p → q p ↔ q p F F T F F F T T F T T F T T T F T F F F T T F F T T F T T F T T Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 17 Some Alt er nat ive Not at ions Name: not and or xor implies iff ¬ ∧ ∨ ⊕ → ↔ Propositional logic: ⊕ p Boolean algebra: pq + C/C++/Java (wordwise): ! && || != == ~ & | ^ C/C++/Java (bitwise): Logic gates: Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 18

  10. Precedence of Logical Operat ors Operat or Precedence ¬ 1 ∧ 2 ∨ 3 → 4 ↔ 5 Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 19 Translat ing English Sent ences • Translat ing English sent ences int o logical expressions removes t he ambiguit y. • Ex: “You can access t he I nt ernet f rom campus only if you are a comput er science maj or or you are not a f reshman.” – Let a be “You can access t he I nt er net f r om campus” – Let c be “You ar e a comput er science maj or” – Let f be “You ar e a f reshman” – Then, t his sent ence can be r epr esent ed as a → (c ∨ ¬ f ). Spring 2005 CS 233601 Discret e Mat h by Shun-Ren Yang, CS, NTHU 20

Recommend


More recommend