410 likes | 634 Views
CSE 2500 Intro. to Discrete Systems. Chun-Hsi (Vincent) Huang Dept. of Computer Science and Engineering University of Connecticut
E N D
CSE 2500Intro. to Discrete Systems Chun-Hsi (Vincent) Huang Dept. of Computer Science and Engineering University of Connecticut Notes are based on the book “Discrete Mathematics with Applications”, Third Edition, by Susanna Epp, in consultation with equivalent courses offered at other universities, including the Univ. of Alberta (V. Bulitko), the New York University (A. Bukharovich), as well as on-line materials provided by Brooks/Cole.
Logic Mathematical logic is a tool for dealing with formal reasoning. In a nutshell: Logic does: Assess if an argument is valid/invalid. Logic does not directly: Assess the truth of atomic statements.
Logic Logic can deduce that: Storrs is in New England. given these facts: Storrs is in Connecticut. Connecticut is a part of New England. and the definitions of: ‘to be a part of’ ‘to be in’ Logic does not know/concern whether these atomic statements actually hold true in real life!
Connectives Different notations have been in use. We will use the common math notation: ~ not v or ^ and → implies (if … then …) ↔ if and only if for all exists See the reverse of the text’s front cover
Logical Statement (Definition, P6) A statement form (or propositional form) is an expression made up of statement variables and logical connectives that becomes a statement when actual statements are substituted for the component statement variables. The truth table for a given statement form displays the truth values that correspond to all possible combinations of truth values for its component statement variables.
Logical Statement A logical statement (or proposition) is either true or false, but not both. Atomic: P, Q, X, Y, … Negation: ~P, … Conjunctive: P ^ Q, P ^ ~Q, … Disjunctive: P v Q, P v (P ^ X),… Conditional: P → Q Biconditional: P ↔ Q
Order of Precedence ~highest ^ v →, ↔ lowest To avoid confusion - use ‘(‘ and ‘)’: P ^ Q v X (P ^ Q) v X
Determining Truth Values Atomic statement: given Compound statement: via meaning of the connectives Suppose: P is trueQ is falseHow about: (P v Q) Truth tables for P ^ Q, P v Q, ~P.
Conditionals “If I go to Walmart tomorrow I will buy one pound of coffee there” S = (I go to Walmart) → (I buy one pound of coffee) When is S true? When I went to Walmart and bought one pound of coffee. When I didn’t go there at all ! When is S false? When I went there but didn’t buy one pound of coffee.
Truth Table N independent atomic variables →2N rows (combinations) N=20: 220 ~ 1 million Consider A → B: A B A → B T T T T F F F T T F F T
More Terminology A → B A is called: Hypothesis (or Antecedent) B is called Conclusion (or Consequent)
Bi-Conditionals “Michael will take CSE2500 if and only if Debra does so.” S = (Michael takes CSE2500) ↔ (Debra takes CSE2500) When is S true? When Michael takes it and Debra takes it. When Michael doesn’t take it and neither does Debra. When is S false? When one of them takes it but not the other.
Truth Table A B A ↔ B T T T T F F F T F F F T
More on Conditional Statements Suppose: B = “I’ll buy a Ferrari.” S = “The Ferrari is on sale.” I will buy a Ferrari if it is on sale: S → B I will buy a Ferrari if and only if it is on sale: S ↔ B I will buy a Ferrari only if it is on sale: ~S → ~B B → S
Sufficient, Necessary Conditions Suppose X is a statement A is a sufficient condition for X iff we can prove that:“A implies X” A is necessary condition for X iff we can prove that: “X implies A” A is a criterion for X iff we can prove that:“X holds if and only if A holds”
Contradictions & Tautologies Contradiction: A statement that is always false regardless of the values of its variables Example: A ^ ~A Tautology: A statement that is always true regardless of the values of its variables Example: A v ~A
Contingencies What if I have a logical statement that is sometimes true and sometimes false? It is called a contingency. Example: A ^ B where A and B are independent variables.
Interpretation In propositional logic, interpretation is an assignment of truth values of variables in the logical statement (expression). Example: Formula: A v B Interpretation: A = true, B = false
Statement Classifications Tautology (T) all interpretations satisfy the logical statement Contradiction (C) all interpretations falsify the logical statement Contingency some interpretations satisfy and some falsify the logical statement
Models/Counter-models An interpretation is called a model for statement F iff: It satisfies F (i.e., makes F=true) An interpretation is called a counter-model for statement F iff: It falsifies F (i.e., makes F=false)
Logical Equivalence Statements A and B are logically equivalent when: A holds if and only if B holds Notation: A B Examples: A v A is equivalent to A A v ~A is equivalent to T (a tautology)
Equivalence & Tautology Suppose A and B are logically equivalent. Consider the proposition (A ↔ B) What can we say about it? It is a tautology! Why? A B A ↔ B T T T F F T
More Equivalences Alex is not unemployed. Alex is employed. P ~(~P): Double-negation It is not true that he is single and he is cute. He is not single or he is not cute. ~(A ^ B) ~A v ~B : De Morgan’s law It is not true that he is single or he is cute. He is not single and he is not cute. ~(A v B) ~A ^ ~B : De Morgan’s law
Boolean Algebra Page 14 presents Theorem 1.1.1 with 11 logical equivalences. Example: Let’s prove that P v C P (4) P v C P v (P ^ ~P) by (5) (P v P) ^ (P v ~P) by (3) (P v P) ^ T by (5) P v P by (4) P by (7)
Proving Equivalences Suppose P and Q can take on T and F only. Then all equivalences can be proven by definition using truth tables P Q ~(P v Q) ~P ^ ~Q F F T F T T T F T F T T F F T F F T F F T T T F T F F F
Another Example Prove P → Q ~P v Q Truth tables …
Uses of Equivalences Simplification Suppose someone gives you ~P v (A→B) v ~(C v D→H) v P v X and asks you to compute it for all possible input values. You can either immediately draw a truth table with 27 = 128 rows Or you can simplify it first.
Simplification ~P v (A→B) v ~(C v D→H) v P v X ~P v P v (A→B) v ~(C v D→H) v X T v (A→B) v ~(C v D→H) v X T The statement is a tautology.
Test Drive Let’s take our equivalence tool box for a spin … What can we tell about A → B and its contraposition: ~B → ~A ? They are equivalent!
Proof? By truth-table By logical equivalence A → B ~A v B B v ~A ~B → ~A
Test Drive Let’s try another one! What can we tell about A → B and its inverse: ~A → ~B ? They are not equivalent! Counter-model: A is false and B is true…
Summary Implication A → B is equivalent to: ~B → ~A : its contraposition But is not equivalent to: ~A → ~B : its inverse Or to: B → A : its converse
Another Lesson Learned Proving equivalences via truth-tables via other equivalences Proving non-equivalence: Finding an instantiation that makes one statement hold and the other doesn’t
Bi-conditionals How can we express: A ↔ B with ^, v, ~ ? It is simply: (A ^ B) v (~A ^ ~B) How can we express it with →, Λ ? Why, but of course it is just: (A → B) ^ (B → A)
Another Spin … Ok, let’s try this fun ride: (P → Q) ^ P In English it would sound: (If P is true then Q is true) and (P is true) What does it tell us? (One would intuitively think Q is true!) Let’s prove/disprove it …
Proving … (P → Q) ^ P (~P v Q) ^ P (~P ^ P) v (Q ^ P) F v (Q ^ P) Q ^ P But we want just Q, not Q ^ P! Is Q ^ P Q? No -- counter-model: Q=T and P=F …
What is the matter? Not all arguments have the form of a chain of equivalences. Example: P→Q= “If Socrates is human then Socrates is mortal” P=“Socrates is human” A conjunction of these two is NOT equivalent to Q = “Socrates is mortal” Why? Name a dog Socrates. It is mortal (Q holds). But it is NOT human (P does not hold)…
Logical Argument A collection of statements P1, …,Pn (premises) logically implies (entails) statement Q (conclusion) if and only if: Whenever all premises hold, the conclusion holds. Example: Premises: P1= “If Socrates is human then Socrates is mortal” P2 = “Socrates is human” Conclusion: Q = “Socrates is mortal”
Valid/Invalid Arguments Suppose someone makes an argument: P1, …,PN therefore Q. The argument is called valid iff: P1, …,PN logically imply Q. That is: Q must hold when all Pi hold. Otherwise the argument is called invalid.
Relation to Tautologies We already know that statements A and B are equivalent iff (A ↔ B) is a tautology (i.e., holds for any interpretation) How about entailment? Statement A entails (logically implies) statement B iff (A → B) is a tautology. In general: premises P1, …,PN entail (logically imply) Q iff (P1 ^ … ^ PN→ Q) is a tautology. Refer to Table 1.3.1 on P40 of Textbook for a summary of Rules of Inference.