Download presentation
Presentation is loading. Please wait.
Published byEmil McGee Modified over 9 years ago
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) Ch1-2
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. “ Ch1-3 pq p q TTT TFF FTF FFF p ﹁ p TF FT
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. " pq p q TTT TFT FTT FFF Ch1-4 pq p ⊕ q TTF TFT FTT FFF
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) pqp → q TTT TFF FTT FFT Ch1-5
6
Def : In the implication p → q, p is called the hypothesis ( 假設 ) and q is called the conclusion ( 結論 ). 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.” Ch1-6 pqp → qq → pp ↔ q TTTTT TFFTF FTTFF FFTTT ( 若且唯若 )
7
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 )) Ch1-7 Translating English Sentences into Logical Expression
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 OperatorPrecedence ﹁ 1 2 3 →4 5 Ch1-8
9
Ch1-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
Ch1-10 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 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.”
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 a contradiction. ( 矛盾 ) Example 1 : Def 2: The propositions p and q that have the same truth values in all possible cases are called logically equivalent. The notation p ≡ q ( or p q ) denotes that p and q are logically equivalent. Ch1-11 p ﹁p﹁pp ﹁ pp ﹁ p T F T F F T T F
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)) pq ﹁ ( p q ) ﹁p﹁p ﹁q﹁q ﹁ p ﹁ q TTFFFF TFFFTF FTFTFF FFTTTT Ch1-12 commutative laws. 交換律 associative laws. 結合律 distributive laws 分配律
13
(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 Ch1-13 De Morgan’s laws by (8) by (7) by (6) by (10)
14
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 Ch1-14 By (3) By (11) By (7)
15
1-3 Predicates and Quantifiers 目標 : 了解 ∀ 及 ∃ 符號 Def : The statement P(x) is said to be the value of the propositional function P at x. ex : P(x) : “ x is 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 ) Ch1-15 variable predicate 屬性數量詞
16
Table 1. Quantifiers Example 16 : Let P(x) : x 2 > 10, when x ∈ Z, x ≤ 4 What is the truth value of ∃ x P(x) ? Sol : x ∈ {1, 2, 3, 4} ∴ 4 2 = 16 > 10 ∴ ∃ x P(x) is true. StatementWhen True ?When False ? ∀ x P(x) P(x) is true for every x. There is an x for which P(x) is false. ∃ x P(x) There is an x for which P(x) is true. P(x) is false for every x. Ch1-16
17
Table 2. Negating Quantifiers. Example 21 : P(x) : x 2 > x, Q(x) : x 2 = 2, what is the negations of ∀ x P(x) and ∃ x Q(x) ? Sol : ﹁∀ x P(x) ≡ ∃ x ﹁ P(x) ≡ ∃ x (x 2 ≤ x) ﹁∃ x Q(x) ≡ ∀ x ﹁ Q(x) ≡ ∀ x (x 2 ≠ 2) Exercise : 11 、 13 、 15 、 53 NegationEquivalent Statement When True ?When False ? ﹁∃ x P(x) ∀ x ﹁ P(x) P(x) is false for every x. ∃ x, s.t. P(x) is true. ﹁∀ x P(x) ∃ x ﹁ P(x) ∃ x, s.t. P(x) is false P(x) is true for every x. Ch1-17
18
補充 : 習題 52 “ ∃ !” 表示 存在且唯一 ∃ ! x P ( x ) 表示 “There exists a unique x s.t. P ( x ) is true.” Example : What is the truth values of the statements (a) ∃ ! x ( x 2 = 1 ) (b) ∃ ! x ( x + 3 = 2x ) where the domain is the set of integers. ( 即 x ∈ Z ) Ans : (a) 1 2 = 1, ( 1) 2 =1 (b) True. Ch1-18
19
1-4 Nested Quantifiers eg. ∀ x ∃ y (x + y = 0 ) Table 1. Quantifications of Two Variables. StatementWhen true ?When False ? ∀ x ∀ y P(x,y) ∀ y ∀ x P(x,y) P(x,y) is true for every pair x,y. ∃ a pair (x,y) s.t. P(x,y) is false. ∀ x ∃ y P(x,y)For every x, ∃ y s.t. P(x,y) is true. ∃ x, s.t. P(x,y) is false for every y. ∃ x ∀ y P(x,y) There is an x for which P(x,y) is true for every y. For every x, ∃ y s.t. P(x,y) is false. ∃ x ∃ y P(x,y) ∃ y ∃ x P(x,y) ∃ a pair (x,y) s.t. P(x,y) is true. ∀ pair (x,y), P(x,y) is false. Ch1-19
20
Ch1-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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.