Discrete Mathematics -- Chapter 2: Fundamentals of Ch t 2 F d t l f Logic Hung-Yu Kao ( 高宏宇 ) Department of Computer Science and Information Engineering, N National Cheng Kung University l Ch K U
Outline � Basic Connectives and Truth Tables � Logical Equivalence: The Law of Logic � Logical Equivalence: The Law of Logic � Logical Implication: Rule of Inference � The Use of Quantifiers � Quantifiers Definitions and the Proofs of � Quantifiers, Definitions, and the Proofs of Theorems 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 2
The Way to Proof 證明 ”A 君是萬能 ” 這 句 話是錯的 � (1) A 君可以搬動任何石頭 (1) A 君可以搬動任何石頭 (2) A 君可以製造出他無法搬動的石頭 (3) (1) (2) 相互矛盾 原命題為假 (3) (1), (2) 相互矛盾 , 原命題為假 A logical sequence of st at ement s. 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 3
2.1 Basic Connectives and Truth Tables � Statement 敘述 (Proposition 命題 ): are declarative S 敘述 (P i i 命題 ) d l i sentences that are either true or false, but not both. � Primitive Statement ( 原始命題 ) � Primitive Statement ( 原始命題 ) � Examples � p : ‘Discrete Mathematics’ is a required course for sophomores. � p : Discrete Mathematics is a required course for sophomores. � q : Margaret Mitchell wrote ‘ Gone with the Wind ’. � r : 2+3=5. � “What a beautiful evening!” (not a statement) � ”Get up and do your exercises.” (not a statement) � No way to make them simpler � No way to make them simpler “The number x is an integer.” is a statement ? g 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 4
2.1 Basic Connectives and Truth Tables � New statements can be obtained from primitive statements in two ways statements in two ways � Transform a given statement p into the statement ¬ p , which denotes its negation and is read “Not p ” 非 p which denotes its negation and is read Not p . 非 p ( Negation statements ) � Combine two or more statements into a compound � Combine two or more statements into a compound statement, using logical connectives . ( Compound statements 複合敘述 ) 複合敘述 ) 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 5
2.1 Basic Connectives and Truth Tables � Compound Statement (Logical Connectives) � Conjunction: p � q (read “p and q”) j � Disjunction : p v q (read “p or q”) � Exclusive or : p v q . � Exclusive or : p v q . p → q is also called, p → q is also called • If p , then q � Implication: p → q , • p is sufficient for q p: hypothesis “ p implies q ” p implies q . • p is a sufficient condition for q q: conclusion l i • q is necessary for p � Biconditional: p ↔ q • q is a necessary condition for p • p only if q � “ p if and only if q ” ( 若 且為 若 ) p if and only if q ( 若 且為 若 ) � •q whenever p q whenever p � “ p iff q ” � “ p is necessary and sufficient for q ” p is necessary and sufficient for q . � 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 6
2.1 Basic Connectives and Truth Tables � The truth and falsity of the compound statements based on the truth values of their components (primitive statements). We do not want a true statement to lead us into believing something that is false. p → q p ↔ q p v q p v q p � q p q ¬ p p 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 1 1 Truth Tables 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 7
Writing Down Truth Tables � “ True, False” is preferred (less ambiguous) than “1, 0” “ � List the elementary truth values in a consistent way (from F…F to T…T or from T…T to F…F). � They get long: with n variables, the length is 2 n . � In the end we want to be able to reason about logic without having to write down such tables. 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 8
2.1 Basic Connectives and Truth Tables � p → q is equivalent with ( ¬ p ∨ q) � It’s not relative about the causal relationship If Discrete Mathematics’ is a required course for sophomores, then If Discrete Mathematics is a required course for sophomores, then � � Margaret Mitchell wrote ‘Gone with the Wind’. is true If “2+3=5”, then “4+2=6” is true � If “2+3=6”, then “2+4=7” is true If 2 3 6 , then 2 4 7 is true � 1 2 3 � “Margaret Mitchell wrote ‘ Gone with ≠ ≠ the Wind ’ (q) and 2+3 the Wind (q) , and 2+3 5 (not r) , the 5 (not r) the ‘Discrete Mathematics’ is a required course for sophomores (p) . ∧ ¬ → ( ) q r p � 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 9
Implications examples p : If it is sunny today, then we will go to the beach. p : If it is sunny today then we will go to the beach q: If today is Friday then 2+3=5 q: If today is Friday, then 2+3=5. r : If today is Friday, then 2+3=6. r is true every day except Friday, even though 2+3=6 is false. The Mathematical concept of an implication is independent of a Th M h i l f i li i i i d d f cause-and-effect relationship between hypothesis and conclusion. 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 10
2.1 Basic Connectives and Truth Tables � Ex 2.1: Let s , t , and u denote the primitive statements. s : Phyllis goes out for a walk. � t : The moon is out t : The moon is out. � � u : It is snowing. � � English sentences for compound statements. ( t � ¬ u ) → s : � � If the moon is out and it is not snowing, then Phyllis goes out for a walk. If th i t d it i t i Ph lli t f lk th Same? t → (¬ u → s ) : � � If the moon is out, then if it is not snowing Phyllis goes out for a walk. ¬ ( s ↔ ( u v t )) : � � It is not the case that Phyllis goes out for a walk if and only if it is snowing or the moon is out. g 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 11
2.1 Basic Connectives and Truth Tables � Let s , t , and u denote the primitive statements. s : Phyllis goes out for a walk. � t : The moon is out t : The moon is out. � � u : It is snowing. � � Reversely, examine the logical form for given English sentences. R l i th l i l f f i E li h t “Phyllis will go out walking if and only if the moon is out.” � � s ↔ t If it is snowing and the moon is not out, then Phyllis will not go out for � a walk.” � ( u � ¬ t ) → ¬ s t ) → ( u s It is snowing but Phyllis will still go out for a walk. � � u � s 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 12
2.1 Basic Connectives and Truth Tables � Ex 2.3: � Decision (selection) structure ( ) � In computer science, the if-then and if-then-else decision structure arise in high-level programming languages such as Java and C++. � E.g., “if p then q else r ,” q is executed when p is true and r is executed when p is false. i d h i f l 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 13
2.1 Basic Connectives and Truth Tables � Tautology , T 0 : If a compound statement is true for all truth value assignments for its component statements. � Example: p ∨¬ p � Contradiction , F 0 : If a compound statement is false for 0 all truth value assignments for its component statements. � Example: p ∧¬ p � Examples � “2 = 3–1” is not a tautology, but “2=1 or 2 ≠ 1” is; � “1+1=3” is not a contradiction, but “1=1 and 1 ≠ 1” is. 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 14
2.1 Basic Connectives and Truth Tables � An argument starts with a list of given statements called premises ( hypothesis ) and a statements called premises ( hypothesis ) and a statement called the conclusion of the argument. � ( p 1 � p 2 � ⋯ � p n ) → q � p ) → q � ( p � p � 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 15
2.2 Logical Equivalence: The Laws of Logic s ⇔ � Logically equivalent , : When the statement s 1 is s 1 2 true (false) if and only if s 2 is true (false). ¬ ∨ ⇔ → p q p q → → ∧ ∧ → → ⇔ ⇔ ↔ ↔ ( ( ) ) ( ( ) ) p p q q q q p p p p q q the same truth tables p → q q → p ( p → q ) � ( q → p ) p ↔ q ¬ p ¬ p v q ( ) ( ) p q 0 0 1 1 1 1 1 1 0 1 1 1 1 0 0 0 1 0 0 0 0 1 0 0 1 1 0 1 1 1 1 1 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 16
2.2 Logical Equivalence: The Laws of Logic � Negation, v (exclusive) 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 17
2.2 Logical Equivalence: The Laws of Logic � Logically equivalent examples � p ⇔ ( p ∨ p ) � p ⇔ ( p ∨ p ) � “1+1=2” ⇔ “1+1=2 or 1+1=2” � ¬¬ p ⇔ p � ¬¬ p ⇔ p � “He did not not do it” ⇔ “He did it” � ¬ ( p ∧ q ) ⇔ ¬ p ∨¬ q ( p ∧ q ) ⇔ p ∨ q � � “If p then not p ” ⇔ “not p ” 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH2 CH2 18
Recommend
More recommend