0% found this document useful (0 votes)
19 views17 pages

ch1 - Discrete Math

Uploaded by

RD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views17 pages

ch1 - Discrete Math

Uploaded by

RD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

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-1
Logical operators ( 邏輯運算子 )
and truth table ( 真值表 )
 Table 1. The truth table for the Negation (not) of a Proposition
p ﹁ p eg. p : “ Today is Friday.”
﹁ p : “ Today is not Friday.”
T F
F T

 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.”
p q p q
q : “ It’s raining today. ”
T T T
p  q : “ Today is Friday
T F F
and it’s raining
F T F
today. “
F F F

Ch1-2
 Table 3. The truth table for the Disjunction (or) of two propositions.
eg. p : "Today is Friday. "
p q pq q : "It’s raining today . "
T T T p  q : "Today is Friday
or
T F T
it’s raining
F T T
today. "
F F F

 Table 4. The truth table for the Exclusive or (xor) of two


propositions.
p q p ⊕ q
T T F eg. p : "Today is Friday. "
T F T q : " It’s raining today. "
F T T p ⊕ q : "Either
today is Friday
F F F
or it’s raining today,
but not both." Ch1-3
 Table 5. The truth table for the Implication (p implies q) p →
q.
p q p→q ( 觀念 : 若 p 對,則 q 一定要對
T T T 若 p 錯,則對 q 不做要求 )
T F F
eg. p : “ You make more than $25000 ”
F T T
q : “ You must file a tax return. “
F F T
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)

Ch1-4
 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 q p → q q → p p ↔ q“p if and only if q”
T T T T T
“p iff q ”
T F F T F
“If p then q , and
F T T F F
F F T T T conversely.”

Ch1-5
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 )) Ch1-6
 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
Operator Precedence
eg. (1) p  q  r means ( p  q )  r
﹁ 1
(2) p  q → r means ( p  q ) → r
 2
(3) p  ﹁ q means p  ( ﹁ q )
 3
→ 4
 5 Exercise : 9 、 13 、 29 、 31 、
34
Ch1-7
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)

Ch1-8
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
Ch1-9
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 :
p ﹁ p p
p ﹁p ﹁p
T F T F
F T T F
 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-10
 Example 2 : Show that ﹁ ( p  q ) ≡ ﹁ p  ﹁ q
 pf : p q ﹁ ( p  q ) ﹁ p ﹁ q ﹁ p  ﹁ q
T T F F F F
T F F F T F
F T F T F F
F F T T T T

 ※ Some important logically equivalences (Table 6, 7)


(1) p  q ≡ q  p commutative laws. 交換律
(2) p  q ≡ q  p
(3) ( p  q )  r ≡ p  (q  r )
associative laws. 結合律
(4) ( p  q )  r ≡ p  (q  r )
(5) p  ( q  r ) ≡ ( p  q )  ( p  r )
distributive laws 分配律
(6) p  ( q  r ) ≡ ( p  q )  ( p  r )
((5) 、 (6) 的觀念類似於 (a + b) x c = (a x c ) + (b x c))
Ch1-11
(7) ﹁ ( p  q ) ≡ ﹁ p  ﹁ q
(8) ﹁ ( p  q ) ≡ ﹁ p  ﹁ q De Morgan’s laws

(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) by (8)
≡ ﹁p(p ﹁q) by (7)
≡(﹁pp)( ﹁p ﹁q) by (6)
≡F( ﹁p ﹁q) by (10)
≡ ﹁p ﹁q

Ch1-12
Example 8 : Show ( p  q ) → (p  q) is a tautology.
pf :
( p  q ) → (p  q) ≡ ﹁ ( p  q )  (p  q ) By (11)
≡ ( ﹁ p  ﹁ q )  (p  q ) By (7)

≡( ﹁pp)( ﹁qq) By (3)

≡TT
≡T

Exercise : 9 、 11 、 17

Ch1-13
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 “
variable predicate
 ※ 命題中出現變數 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-14
 Table 1. Quantifiers
Statement When True ? When False ?
∀x P(x) P(x) is true for every There is an x for
x. which P(x) is false.
∃x P(x) There is an x for P(x) is false for every
which P(x) is true. x.
 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.

Ch1-15
 Table 2. Negating Quantifiers.
Negation Equivalent When True ? When False ?
Statement
﹁∃ x ∀x ﹁ P(x) P(x) is false for ∃x, s.t. P(x) is
P(x) every x. true.
﹁∀ x ∃x ﹁ P(x) ∃x, s.t. P(x) is P(x) is true for
P(x) false every x.

 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

Ch1-16
 補充 : 習題 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 ( 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.
Ch1-17

You might also like