Set Theory & Predicate Calculus Applied Discrete Mathematics
Total Page:16
File Type:pdf, Size:1020Kb
CSC 224/226 Notes Packet #2: Set Theory & Predicate Calculus Barnes Packet #2: Set Theory & Predicate Calculus Applied Discrete Mathematics Table of Contents Full Adder Information Page 1 Predicate Calculus Information Pages 2-9 First Hour Exam Study Sheet Page 10 Some First Hour Exam review material Pages 11-16 Set Theory Information Pages 17-26 Arithmetic Proofs Information Page 27 CSC 224/226 Notes Packet #2: Set Theory & Predicate Calculus Barnes Design of Full Adder A full binary adder has 3 inputs 1. bit A (X) 2. bit B (Y) 3. carry in (C) and 2 outputs 1. bit out (S) 2. carry to next digit (Cout ) Start by making truth table assuming all inputs and specifying all outputs. Inputs Outputs X Y C S Cout 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 then write "and" condition for all "1" outputs then "or" all "and" conditions. S = X'Y'C + X'YC' + XY'C' + XYC Cout = X'YC + XY'C + XYC' + XYC then simplify. 1 Predicate Calculus Outline I. Predicates - binding of variables to form propositions. II. General Quantifiers A. ∀ - Universal - means "for all" B. ∃ - Existential - means "there exists" C. Combinations of two variables using quantifiers D. Distribution of negation using De Morgan's rules III. Compound propositions of a single variable and proving set theory problems (next topic that will be covered) 2 Predicate - function which becomes a proposition when the variables are assigned values from an appropriate Universe of Discourse (U). QUANTIFIERS P(x): x2 > x (not a proposition) But these are: - For all x in ℜ, x2 > x - For some x in ℜ, x2 > x - There exists x in ℜ for which x2 > x Predicates 1. P(x): x2 > x P(x) is not a proposition Choose value for x from ℜ. P(5): 52 > 5 pin variable at 5 P(5) is a proposition 2. P(x): x ⊕ x = x P(x) is not a proposition Choose value for x from P({0,1}). P(0): 0 ⊕ 0 = 0 pin variable at 0 P(0) is a proposition 3. Q(x,y): (x < y) ∧ (x2 < y2 ) Q(x,y) is not a proposition Choose x,y from ℜ. Q(-3,2): (-3 < 2) ∧ ((-3)2 < 22 ) Q(-3,2) is a proposition From predicates (P(x), Q(x)) one can form compound predicates: ¬P(x) (P(x) → Q(x)) (P(x) ∨ Q(x)) (P(x) ↔ Q(x)) (P(x) ∧ Q(x)) ∃x P(x) ∀x Q(x) Example: [ ∃x (P(x) ∧ Q(x)) → ( ∃x P(x) ∧ ∃x Q(x))] 3 Propositional Logic Equivalences and Implications Still Hold Example: ( ∃x P(x) → ∀x Q(x)) ⇔ ( ¬(∃x P(x)) ∨ ∀x Q(x)) (implication equivalence) Example: ∀x (P(x) → Q(x)) ∧ ∃x P(x) ⇒ ∃x Q(x) (modus ponens implication) Also Have New Relationships: De Morgan's Rules in Predicate Calculus ¬(∀x P(x)) ⇔ ∃x (¬P(x)) ¬(∀x P(x)) P(x) ⇔ ¬P(x) ∃x (¬P(x)) 1 at least one 1 (at least 1 P(x) false one true) 0 all P(x) true 1 (all false) 0 ¬(∃x P(x)) ⇔ ∀x (¬P(x)) P(x) ¬(∃x P(x)) ⇔ ∀x (¬P(x)) ¬P(x) all false 1 1 1 (all true) at least 0 1 0 (at least one true one false) 4 Predicate Calculus Truth Table Example 1: ∀x P(x) ∧ ∀x Q(x) ⇔ ∀x [P(x) ∧ Q(x)] We have two propositions on the left side which form the compound proposition [∀x P(x) ∧ ∀x Q(x)]. We must consider all combinations of the truth values: ∀x P(x) ∀x Q(x) ∀x P(x) ∧ ∀x Q(x) ∀x [P(x) ∧ Q(x)] 0 0 0 Row 1 0 1 0 Row 2 1 0 0 Row 3 1 1 1 Row 4 Row 1: ∀x P(x) = 0 → P(x) has at least one 0 (false for some value of x) ∀x Q(x) = 0 → Q(x) has at least one 0 Therefore, P(x) ∧ Q(x) has at least one 0 Therefore, ∀x(P(x) ∧ Q(x)) = 0 Row 2: ∀x P(x) = 0 → P(x) has at least one 0 ∀x Q(x) = 1 → Q(x) = 1 for all x P(x) ∧ Q(x) = 0 since P(x) = 0 for some x Therefore, ∀x(P(x) ∧ Q(x)) = 0 Row 3: ∀x P(x) = 1 ∀x Q(x) = 0 Work same way and show Case 3 = 0 Row 4: ∀x P(x) = 1 ∀x Q(x) = 1 Work same way and show Case 4 = 1 ∀x P(x) ∧ ∀x Q(x) ⇔ ∀x [P(x) ∧ Q(x)] is the same on both sides of the truth table and therefore the statement is true. 5 Predicate Calculus Conversion Example: We can prove that: ∃x P(x) ∨ ∃x Q(x) ⇔ ∃x [P(x) ∨ Q(x)] from our previous statement without using truth tables: Start: ∀x P(x) ∧ ∀x Q(x) ⇔ ∀x [P(x) ∧ Q(x)] negate both sides ¬[∀x P(x) ∧ ∀x Q(x)] ⇔ ¬[∀x [P(x) ∧ Q(x)]] ∃x [¬P(x)] ∨ ∃x [¬Q(x)] ⇔ ∃x [¬P(x) ∨ ¬Q(x)] substitute ¬P(x) = A(x) ¬Q(x) = B(x) ∃x [A(x)] ∨ ∃x [B(x)] ⇔ ∃x [A(x) ∨ B(x)] Predicate Calculus Truth Table Example 2: Is ∀x P(x) ∨ ∀x Q(x) ⇔ ∀x [P(x) ∨ Q(x)] true? ∀x P(x) ∀x Q(x) ∀x P(x) ∨ ∀x Q(x) ∀x [P(x) ∨ Q(x)] 0 0 0 Row 1: Can be true for 0 1 1 some P(x) ∨ Q(x) and 1 0 1 therefore not logically 1 1 1 equivalent. (See example below.) Row 1: ∀x P(x) = 0 → P(x) has at least one 0 ∀x Q(x) = 0 → Q(x) has at least one 0 Does P(x) ∨ Q(x) always have at least one "0" for any P(x) and Q(x)? ∀x P(x) ∀x Q(x) P(x) Q(x) P(x) ∨ Q(x) ∀x [P(x) ∨ Q(x)] 0 0 0 1 1 1 0 0 1 0 1 1 6 Predicate Calculus Truth Table Example 3 (Independent Variables): ∀x P(x) ∨ ∃y Q(y) ⇔ ∀x ∃y [P(x) ∨ Q(y)] We have two propositions on the left side which form the compound proposition ∀x ∃y [P(x) ∨ Q(y)].We must consider all combinations of the truth values: ∀x P(x) ∃y Q(y) ∀x P(x) ∨ ∃y Q(y) ∀x ∃y [P(x) ∨ Q(y)] 0 0 0 Row 1 0 1 1 Row 2 1 0 1 Row 3 1 1 1 Row 4 Row 1: ∃y Q(y) = 0 → Q(y)=0 for all y values Therefore, sub in Q(y)=0 to get ∀x ∃y [P(x) ∨ 0 ] = ∀x ∃y P(x) = ∀x P(x) Therefore, since ∀x P(x) is false, then ∀x ∃y [P(x) ∨ Q(y)] = 0 Row 2: ∃y Q(y) = 1 → Q(c)=1 for some c Therefore, sub in Q(y)=1 to get ∀x ∃y [P(x) ∨ 1 ] = ∀x ∃y 1 = 1 Therefore, ∀x ∃y [P(x) ∨ Q(y)] = 1 Row 1: ∃y Q(y) = 0 → Q(y)=0 for all y values Therefore, sub in Q(y)=0 to get ∀x ∃y [P(x) ∨ 0 ] = ∀x ∃y P(x) = ∀x P(x) Therefore, since ∀x P(x) is true, then ∀x ∃y [P(x) ∨ Q(y)] = 1 Row 2: ∃y Q(y) = 1 → Q(c)=1 for some c Therefore, sub in Q(y)=1 to get ∀x ∃y [P(x) ∨ 1 ] = ∀x ∃y 1 = 1 Therefore, ∀x ∃y [P(x) ∨ Q(y)] = 1 ∀x P(x) ∨ ∃y Q(y) ⇔ ∀x ∃y [P(x) ∨ Q(y)] is the same on both sides of the truth table and therefore the statement is true. In this case, the variables in each predicate are independent, so the order of the quantifiers DOES NOT MATTER. 7 Example: Definition of Continuity A function of f is continuous on the real numbers if and only if ∀ε [(ε > 0) → ∃δ ((δ > 0) ∧ ∀x∀y [x - y < δ → f(x) - f(y) < ε])] Universe of Discourse = ℜ One can negate an expression. For example, consider the expression ∀x [P(x) → ∃y Q(y)], negating gives the following: ¬ ∀x [P(x) → ∃y Q(y)] ⇔ ∃x ¬ [P(x) → ∃y Q(y)] ⇔ ∃x ¬ [¬P(x) ∨ ∃y Q(y)] ⇔ ∃x [P(x) ∧ ¬(∃y Q(y))] ⇔ ∃x [P(x) ∧ ∀y ¬(Q(y))] **Recommended: Negate the definition of continuity: i.e., f is not continuous on ℜ ⇔ … 8 Given the following predicates, evaluate the propositions generated by using the indicated quantifiers with those predicates. P(x,y) x ∈ ℜ, y ∈ ℜ P(x,y) x ∈ {0,1}, y ∈ {0,1} Quantifiers x2 + y = y2 + 2x x → y ∀x∀y = ∀y∀x 0 (x = 1 and y = 2 is false) 0 (x = 1 and y = 0 is false) ∃x∃y = ∃y∃x 1 (x = 0 and y = 0 is true) 1 (x = 0 and y = 0 is true) 1 x y 0: (2x - x2 ) < , for x = 1 is imag 1: y = 1 ∀ ∃ 4 See ** below. ∃y∀x 0 1: y = 1 ∀y∃x 1: y - y2 < 1, is real for all y 1: x = 0 See * below. ∃x∀y 0 1: x = 0 *: ∀y∃x Case: x2 + y = y2 + 2x **: ∀x∃y Case: x2 + y = y2 + 2x x2 - 2x - (y2 - y) = 0 y2 - y - (x2 - 2x) = 0 2 ± 4 + 4(y2 - y) 1 ± 1 + 4(x2 - 2x) x = y = 2 2 (4 + 4(y2 - y)) > 0 (1 + 4(x2 - 2x)) > 0 4(y2 - y) > -4 4(x2 - 2x) > -1 1 y2 - y > -1 x2 - 2x > - 4 1 y - y2 < 1 2x - x2 < 4 is true for all values is false when x = 1 of y 9 First Hour Exam Study Sheet I.