Review 1 Andreas Klappenecker
Summary Propositional Logic, Chapter 1 Predicate Logic, Chapter 1 Proofs, Chapter 1 Sets, Chapter 2 Functions, Chapter 2 Sequences and Sums, Chapter 2 Asymptotic Notations, Chapter 3 Time Complexity of Algorithms, Chapter 3
Strategy for Exam Preparation - Start studying now! - Make sure you know your definitions! - Do odd numbered exercises (Solutions are in the Appendix) - Review your quizzes - Review your homework
Logical Connectives - Summary Let B={t,f}. Assign to each connective a function M: B->B that determines its semantics. P M (P ) f t t f P Q M (P, Q) y if is false. M (P, Q) M (P, Q) M (P, Q) M (P, Q) f f f f f t t f t f t t t f t f f t t f f t t t t f t t
Alternative Summary Summary. Informally, we can summarize the meaning of the connectives as follows: 1) The and connective (a b) is true if and only if both a and b are true. 2) The or connective (a b) is true if and only if at least one of a, b is true. 3) The exclusive or (a b) is true if and only if precisely one of a, b is true. 4) The implication (a b) is false if and only if the premise a is true and the conclusion b is false. 5) The biconditional connective (a b) is true if and only if the truth values of a and b are the same. An interpretation of a subset S of Prop is an assignment of truth values to all variables that occur in the propositions contained in S. We showed that there exist a unique valuation extending an interpretation of all propositions.
Conditional Perhaps the most important logical connective is the conditional, also known as implication: p -> q The statement asserts that q holds on the condition that p holds. We call p the hypothesis or premise, and q the conclusion or consequence. Typical usage in proofs: If p, then q ; p implies q ; q only if p ; q when p ; q follows from p p is sufficient for q ; a sufficient condition for q is p ; a necessary condition for p is q ; q is necessary for p
Predicates A function P from a set D to the set Prop of propositions is called a predicate. The set D is called the domain of P. E: Z->{t,f} with E(x)= x is an even integer, E(6) is true; O: Z->{t,f} with O(x)= x is an odd integer; O(6) is false.
Logical Equivalence Two statements involving quantifiers and predicates are logically equivalent if and only if they have the same truth values no matter which predicates are substituted into these statements and which domain is used. We write A B for logically equivalent A and B. You use logical equivalences to derive more convenient forms statements. Example: De Morgan s laws.
De Morgan s Laws xp (x) x P (x) xp (x) x P (x) (p q) p q (p q) p q
Valid Arguments An argument in propositional logic is a sequence of propositions that end with a proposition called conclusion. The argument is called valid if the conclusion follows from the preceding statements (called premises). In other words, in a valid argument it is impossible that all premises are true but the conclusion is false.
Modus Ponens The tautology (p (p->q)) -> q is the basis for the rule of inference called modus ponens. p p -> q ------- q
Modus Tollens q p -> q ------ p The University will not close on Wednesday. If it snows on Wednesday, then the University will close. Therefore, It will not snow on Wednesday
Simplification p q ------ p
Formal Argument p q r p r s s t t Argument 1) p q Hypothesis 2) p Simplification of 1) 3) r p Hypothesis 4) r Modus tollens using 2) and 3) 5) r s Hyposthesis 6) s Modus ponens using 4), 5) 7) s t Hypothesis 8) t Modus ponens using 6), 7)
Sets, Functions, Summations
Set Builder Notation The set builder notation describes all elements as a subset of a set having a certain property. Q = { p/q R p Z, q Z, and q 0 } [a,b] = { x R a <= x <= b } [a,b) = { x R a <= x < b } (a,b] = { x R a < x <= b } (a,b) = { x R a < x < b } 16
Equality of Sets Two sets A and B are called equal if and only if they have the same elements. A = B if and only if x(x A x B) [To prove A=B, it is sufficient to show that both x(x A x B) and x(x B x A) hold. Why? ] 17
Subset A set A is a subset of B, written A B, if and only if every element of A is an element of B. Thus, A B if and only if x(x A x B) 18
Cardinality of a Set Let S be a set with a finite number of elements. We say that the set has cardinality n if and only if S contains n elements. We write S to denote the cardinality of the set. For example, = 0. 19
Power Sets Given a set S, the power set P(S) of S is the set of all subsets of S. Example: P( {1} ) = {, {1} } P( {1,2} ) = {, {1}, {2}, {1,2} } P( ) = { } since every set contains the empty set as a subset, even the empty set. P({ }) = {, { }}. 20
Cartesian Products Let A and B be sets. The Cartesian product of A and B, denote AxB, is the set of all pairs (a,b) with a A and b B. AxB = { (a,b) a A b B } 21
Set Operations Give two sets A and B. You should know - the union of A and B - the intersection of A and B - the set difference between A and B - the complement of A 22
De Morgan Laws A B = A B Proof : A B = {x x A B} by definition of complement = {x (x A B)} = {x (x A x B)} by definition of intersection = {x (x A) (x B)} de Morgan s law from logic = {x (x A) (x B)} by definition of = {x x A x B} by definition of complement = {x x A B} by definition of union = A B 23
Terminology Let f: A -> B be a function. We call - A the domain of f and - B the codomain of f. The range of f is the set f(a) = { f(a) a in A } 24
Functions Let A and B be sets. Consider a function f: A-> B. - When is f surjective? - When is f injective? - When is f bijective? 25
Floor Function The floor function : R -> Z assigns to a real number x the largest integer <= x. 3.2 = 3-3.2 = -4 3.99 = 3 26
Ceiling Function The ceiling function : R -> Z assigns to a real number x the smallest integer >= x. 3.2 = 4-3.2 = -3 0.5 = 1 27
Basic Facts We have x = n if and only if n <= x < n+1. We have x =n if and only if n-1< x <= n. We have x = n if and only if x-1 < n <= x. We have x =n if and only if x<= n < x+1. 28
Example Prove or disprove: x = x 29
Example 3 Let m = x Hence, m x <m+1 Thus, m 2 x < (m + 1) 2 It follows that m 2 x<(m + 1) 2 Therefore, m x<m+1 Thus, we can conclude that m = x This proves our claim. 30
Geometric Series Extremely useful! If a and r = 0 are real numbers, then n ar n+1 ar j a = r 1 if r = 1 (n + 1)a if r =1 j=0 Proof: The case r = 1 holds, since ar j = a for each of the n + 1 terms of the sum. The case r = 1 holds, since (r 1) n n j=0 arj = ar j+1 = j=0 n+1 ar j j=1 n ar j j=0 n ar j j=0 = ar n+1 a and dividing by (r 1) yields the claim.
Sum of First n Positive Integers. Extremely useful! For all n 1, we have n k = n(n + 1)/2 k=1 We prove this by induction. Basis step: For n = 1, we have 1 k=1 k = 1 = 1(1 + 1)/2.
Sum of the First n Positive Integers Induction Hypothesis: We assume that the claim holds for n 1. Induction Step: Assuming the Induction Hypothesis, we will show that the claim holds for n. n k=1 k = n + n 1 k=1 k = 2n/2 +(n 1)n/2 by Induction Hypothesis = 2n+n2 n 2 = n(n+1) 2 Therefore, the claim follows by induction on n.
Infinite Geometric Series Let x be a real number such that x < 1. Then k=0 x k = 1 1 x.
Infinite Geometric Series Since the sum of a geometric series satisfies we have k=0 n k=0 x k = lim n x k = xn+1 1 x 1, n k=0 As lim n x n+1 = 0, we get x k = lim n x n+1 1 x 1 x k = k=0 1 x 1 = 1 1 x.
Asymptotic Notations
Big Oh Notation Let f,g: N -> R be functions from the natural numbers to the set of real numbers. We write f O(g) if and only if there exists some real number n 0 and a positive real constant U such that f(n) <= U g(n) for all n satisfying n >= n 0
Big Ω We define f(n) = Ω(g(n)) if and only if there exists a constant L and a natural number n 0 such that L g(n) <= f(n) holds for all n >= n 0. In other words, f(n) = Ω(g(n)) if and only if g(n) = O(f(n)).
Big Θ We define f(n) = Θ(g(n)) if and only if there exist constants L and U and a natural number n 0 such that L g(n) <= f(n) <= U g(n) holds for all n >= n 0. In other words, f(n) = Θ(g(n)) if and only if f(n) = Ω(g(n)) and f(n) = O(g(n)).