1 / 20

Discrete Mathematics

Discrete Mathematics. Chapter 1 The Foundations : Logic and Proofs. 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang). 1-1 Logic. Def : A proposition ( 命題 ) is a declarative ( 敘述 ) sentence that is either true or false, but not both. Example 1 : The following declarative sentences are propositions.

kumiko
Download Presentation

Discrete Mathematics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Discrete Mathematics Chapter 1 The Foundations : Logic and Proofs 大葉大學 資訊工程系 黃鈴玲(Lingling Huang)

  2. 1-1 Logic Def :A proposition (命題) is a declarative (敘述) sentence that is either true or false, but not both. Example 1 : The following declarative sentences are propositions. (1) Toronto is the capital of Canada. (F) (2) 1 + 1 = 2 (T) Example 2 : Consider the following sentences. (1) what time is it ? (not declarative) (2) Read this carefully. (not declarative) (3) x + 1 = 2 (neither true nor false)

  3. Logical operators (邏輯運算子) and truth table (真值表) Table 1. The truth table for the Negation (not) of a Proposition eg. p : “ Today is Friday.” ﹁p : “ Today is not Friday.” Def :A truth table displays the relationships between the truth values of propositions. Table 2. The truth table for the Conjunction (and) of two propositions. eg. p : “ Today is Friday.” q : “ It’s raining today. ” p  q : “ Today is Friday and it’s raining today. “

  4. Table 3. The truth table for the Disjunction (or) of two propositions. eg. p : "Today is Friday. " q : "It’s raining today . " p  q : "Today is Friday or it’s raining today." • Table 4. The truth table for the Exclusive or (xor) of two propositions. eg. p : "Today is Friday. " q : " It’s raining today. " p ⊕ q : "Either today is Friday or it’s raining today, but not both."

  5. Table 5. The truth table for the Implication (p implies q) p → q . (觀念 : 若p對,則q一定要對 若p錯,則對q不做要求) eg. p : “ You make more than $25000 ” q : “ You must file a tax return. “ p → q : “ If you make more … then you must … . “ • Some of the more common ways of expressing this implication are : (1) if p then q (若p則q,p是q的充分條件) (2) p implies q (3) p only if q (只有q是True時,p才可能是True, 若q是False,則p一定是False)

  6. (若且唯若) Def :In the implicationp → q , p is called thehypothesis(假設) and q is called theconclusion (結論). Def :Compound propositions (合成命題) are formed from existing propositions using logical operators. (即、、⊕、→等) Table 6. The truth table for the Biconditional p ↔ q ( p → q and q → p ) “p if and only if q” “p iff q ” “If p then q , and conversely.”

  7. Translating English Sentences into Logical Expression Example 9 :How can the following English sentence be translated into a logical expression ? “You can access the Internet from campus only if you are a computer science major or you are not a freshman. ” Sol : p : “You can access the Internet from campus.” q : “You are a computer science major.” r : “You are a freshman.” ∴ p only if ( q or ( ﹁ r )) => p →( q ( ﹁ r ))

  8. Example 10 : You cannot ride the roller coaster (雲霄飛車 ) if you are under 4 feet tall unless you are older than 16 years old. • Sol : q : “ You can ride the roller coaster. “ r : “ You are under 4 feet tall. “ s : “ You are older than 16 years old. “ ∴ ﹁q if r unless s ∴ ( r ﹁s ) → ﹁q • Table 8. Precedence of Logical Operators eg. (1) p  q  r means ( p  q )  r (2) p  q → r means ( p  q ) → r (3) p  ﹁ q means p  ( ﹁ q ) Exercise : 9、13、29、31、34

  9. Def: A set of propositional expressions is consistent if there is an assignment of truth values to the variables in the expressions that makes each expression true. (一群由數個變數pqr等組成的命題,若存在 一組真值的給法,如設 p  T, q  F, r  T等, 使所有的命題都可以為真,即稱為consistent)

  10. ex: Are the following specifications consistent? “The system is in multiuser state if and only if it is operating normally. If the system is operating normally, the kernel is functioning. The kernel is not functioning or the system is in interrupt mode. If the system is not in multiuser state, then it is in interrupt mode. The system is not in interrupt mode.” Sol:Let p be “the system is in multiuser state”, q be “the system is operating normally”, and r be “the kernel is functioning”. 題目的敘述等同於:p  q, q  r, r  q, p  q, q  T 因 q  r 需為真,故 r  T,因 r  q 需為真,故 not consistent

  11. 1-2 Propositional Equivalences Def 1:A compound proposition that is always true is called a tautology.(真理) A compound proposition that is always false is called acontradiction. ( 矛盾) Example 1 : Def 2:The propositions p and q that have the same truth values in all possible cases are calledlogically equivalent.The notationp ≡ q ( orp  q ) denotes that p and q are logically equivalent.

  12. Example 2 : Show that ﹁( p  q ) ≡ ﹁p  ﹁q • pf : • ※ Some important logically equivalences (Table 6, 7) (1) p  q ≡ q  p (2) p  q ≡ q  p (3) ( p  q )  r ≡ p  (q  r ) (4) ( p  q )  r ≡ p  (q  r ) (5) p  ( q  r ) ≡ ( p q )  ( p  r ) (6) p  ( q  r ) ≡ ( p  q )  ( p  r ) ((5)、(6)的觀念類似於(a + b) x c = (a x c ) + (b x c)) commutative laws. 交換律 associative laws. 結合律 distributive laws 分配律

  13. De Morgan’s laws by (8) by (7) by (6) by (10) (7) ﹁( p  q ) ≡ ﹁p  ﹁q (8) ﹁( p  q ) ≡ ﹁p  ﹁q (9) p  ﹁p ≡ T (10) p  ﹁p ≡ F (11) p → q ≡ ﹁p  q Example 7 : Show that ﹁( p  (﹁p  q )) ≡ ﹁p  ﹁q pf : (也可用真值表証) ﹁( p  (﹁p  q ) ) ≡ ﹁p  ﹁ (﹁p  q ) ≡ ﹁p  ( p  ﹁q ) ≡ (﹁p  p )  ( ﹁p  ﹁q ) ≡ F  ( ﹁p  ﹁q ) ≡ ﹁p  ﹁q

  14. By (11) By (7) By (3) Example 8 : Show ( p  q ) → (p  q) is a tautology. pf : ( p  q ) →(p  q) ≡ ﹁( p  q )  (p  q ) ≡ ( ﹁p  ﹁q )  (p  q ) ≡ ( ﹁p  p )  ( ﹁q  q ) ≡ T  T ≡ T Exercise : 9、11、17

  15. 1-3 Predicates and Quantifiers 屬性 數量詞 predicate variable • 目標 : 了解 ∀及 ∃符號 • Def :The statementP(x)is said to be the value of the propositional function P at x . • ex : P(x) : “ xis greater than 3 “ • ※命題中出現變數 x 時 the domain of x 指的是 x 的範圍 • ※Quantifiers : (數量詞,如 some,any,all 等) ∀: universal quantifier ( for all, for every ) ∃ : existential quantifier ( there exist, there is, for some )

  16. Table 1. Quantifiers • Example 16 : Let P(x) : x2 > 10, when x ∈ Z, x ≤ 4 What is the truth value of ∃x P(x) ? • Sol : x ∈ {1, 2, 3, 4} ∴ 42 = 16 > 10 ∴ ∃x P(x) is true.

  17. Table 2. Negating Quantifiers. • Example 21 : P(x) : x2 > x , Q(x) : x2 = 2 , what is the negations of ∀x P(x) and ∃x Q(x) ? • Sol :﹁∀x P(x) ≡ ∃x ﹁P(x) ≡ ∃x (x2≤ x) ﹁∃x Q(x) ≡ ∀x ﹁Q(x) ≡ ∀x (x2 ≠ 2) • Exercise : 11、13、15、53

  18. 補充 : 習題52 “∃!” 表示 存在且唯一 ∃!xP(x) 表示 “There exists a unique x s.t. P(x) is true.” Example : What is the truth values of the statements (a) ∃! x ( x2 = 1 ) (b) ∃! x ( x + 3 = 2x ) where the domain is the set of integers. (即 x ∈ Z) Ans : (a) 12 = 1 , (-1)2=1 (b) True.

  19. 1-4 Nested Quantifiers • eg. ∀x ∃y (x + y = 0 ) • Table 1. Quantifications of Two Variables.

  20. Example : What is the truth values of the statements • (a) ∀x ∀y (x + y ≥ 0), x,y ∈ N  T • (b)∀x ∀y (xy = 0), x,y ∈ ZF • (c) ∀x ∃y (x + y = 0), x,y ∈ Z  T • (d)∀x ∃y (xy = -1), x,y ∈ Z  F • (e) ∃x ∀y (xy = 0), x,y ∈ Z  T • (f)∃x ∀y (x + y = 0), x,y ∈ Z  F • (g) ∃x ∃y (xy = 0), x,y ∈ Z  T • (h)∃x ∃y (x + y = ½), x,y ∈ Z  F Exercise: 27

More Related