1 / 47

Final Review

Final Review. List of Logical Equivalences. p T  p; pF  p Identity Laws pT  T; pF  F Domination Laws pp  p; pp  p Idempotent Laws (p)  p Double Negation Law pq  qp; pq  qp Commutative Laws (pq) r  p (qr); (pq)  r  p  (qr)

rbrink
Download Presentation

Final Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Final Review

  2. List of Logical Equivalences pT  p; pF  p Identity Laws pT  T; pF  F Domination Laws pp  p; pp  p Idempotent Laws (p)  p Double Negation Law pq  qp; pq  qp Commutative Laws (pq) r  p (qr); (pq)  r  p  (qr) Associative Laws

  3. List of Equivalences p(qr)  (pq)(pr) Distribution Laws p(qr)  (pq)(pr) (pq)(p  q) De Morgan’s Laws (pq)(p  q) Miscellaneous p  p  T Or Tautology p p  F And Contradiction (pq)  (p  q) Implication Equivalence pq(pq)  (qp) Biconditional Equivalence

  4. The Proof Process Assumptions -Definitions -Already-proved equivalences -Statements (e.g., arithmetic or algebraic) Logical Steps Conclusion (That which was to be proved)

  5. Prove: (pq)  q  pq (pq)  q Left-Hand Statement  q  (pq) Commutative  (qp)  (q q) Distributive  (qp)  T Or Tautology  qp Identity  pq Commutative Begin with exactly the left-hand side statement End with exactly what is on the right Justify EVERY step with a logical equivalence

  6. Predicate Calculus: Quantifiers Universe of Discourse, U: The domain of a variable in a propositional function. Universal Quantification of P(x) is the proposition:“P(x) is true for all values of x in U.” Existential Quantification of P(x) is the proposition: “There exists an element, x, in U such that P(x) is true.”

  7. Universal Quantification of P(x) xP(x) “for all x P(x)” “for every x P(x)” Defined as: P(x0)  P(x1)  P(x2)  P(x3)  . . . for all xi in U Example: Let P(x) denote x2  x If U is x such that 0 < x < 1 then xP(x) is false. If U is x such that 1 < x then xP(x) is true.

  8. Existential Quantification of P(x) xP(x) “there is an x such that P(x)” “there is at least one x such that P(x)” “there exists at least one x such that P(x)” Defined as: P(x0)  P(x1)  P(x2)  P(x3)  . . . for all xi in U Example: Let P(x) denote x2  x If U is x such that 0 < x  1 then xP(x) is true. If U is x such that x < 1 then xP(x) is true.

  9. Quantifiers • xP(x) • True when P(x) is true for every x. • False if there is an x for which P(x) is false. • xP(x) • True if there exists an x for which P(x) is true. • False if P(x) is false for every x.

  10. Negation (it is not the case) • xP(x) equivalent to xP(x) • True when P(x) is false for every x • False if there is an x for which P(x) is true. •  xP(x) is equivalent to xP(x) • True if there exists an x for which P(x) is false. • False if P(x) is true for every x.

  11. Examples 2a Let T(a,b) denote the propositional function “a trusts b.” Let U be the set of all people in the world. Everybody trusts Bob. xT(x,Bob) Could also say: xU T(x,Bob)  denotes membership Bob trusts somebody. xT(Bob,x)

  12. Examples 2b Alice trusts herself. T(Alice, Alice) Alice trusts nobody. x T(Alice,x) Carol trusts everyone trusted by David. x(T(David,x)  T(Carol,x)) Everyone trusts somebody. x y T(x,y)

  13. Quantification of Two Variables(read left to right) • xyP(x,y) or yxP(x,y) • True when P(x,y) is true for every pair x,y. • False if there is a pair x,y for which P(x,y) is false. • xyP(x,y) or yxP(x,y) • True if there is a pair x,y for which P(x,y) is true. • False if P(x,y) is false for every pair x,y.

  14. Quantification of Two Variables • xyP(x,y) • True when for every x there is a y for which P(x,y) is true. • (in this case y can depend on x) • False if there is an x such that P(x,y) is false for every y. • yxP(x,y) • True if there is a y for which P(x,y) is true for every x. • (i.e., true for a particular y regardless (or independent) of x) • False if for every y there is an x for which P(x,y) is false. • Note that order matters here • In particular, if yxP(x,y) is true, then xyP(x,y) is true. • However, if xyP(x,y) is true, it is not necessary that yxP(x,y) is true.

  15. Examples 3a Let L(x,y) be the statement “x loves y” where U for both x and y is the set of all people in the world. Everybody loves Jerry. xL(x,Jerry) Everybody loves somebody. x yL(x,y) There is somebody whom everybody loves. yxL(x,y)

  16. Examples 3b1 There is somebody whom Lydia does not love. xL(Lydia,x) Nobody loves everybody. (For each person there is at least one person they do not love.) xyL(x,y) There is somebody (one or more) whom nobody loves y x L(x,y)

  17. Basic Number Theory Definitionsfrom Chapter 2 • Z = Set of all Integers • Z+ = Set of all Positive Integers • N = Set of Natural Numbers (Z+ and Zero) • R = Set of Real Numbers • Addition and multiplication on integers produce integers. (a,b  Z)  [(a+b)  Z]  [(ab)  Z]

  18. Number Theory Defs (cont.)  = “such that” • n is even is defined as k  Z  n = 2k • n is odd is defined as k  Z  n = 2k+1 • x is rational is defined as a,b  Z  x = a/b, b0 • x is irrational is defined as a,b  Z  x = a/b, b0 or a,b  Z, x  a/b, b0 • p  Z+ is prime means that the only positive factors of p are p and 1. If p is not prime we say it is composite.

  19. Methods of Proof p q (Example: if n is even, then n2 is even) • Direct proof: Assume p is true and use a series of previously proven statements to show that q is true. • Indirect proof: Show q p is true (contrapositive), using any proof technique (usually direct proof). • Proof by contradiction: Assume negation of what you are trying to prove (pq). Show that this leads to a contradiction.

  20. Example of an Indirect Proof Prove: If n3 is even, then n is even. Proof: The contrapositive of “If n3 is even, then n is even” is “If n is odd, then n3 is odd.” If the contrapositive is true then the original statement must be true. Assume n is odd.Then kZ  n = 2k+1. It follows that n3 = (2k+1)3 = 8k3+8k2+4k+1 = 2(4k3+4k2+2k)+1. (4k3+4k2+2k) is an integer. Therefore n3 is 1 plus an even integer. Therefore n3 is odd. Assumption,Definition, Arithmetic, Conclusion

  21. Example: Proof by Contradiction Prove: The sum of an irrational number and a rational number is irrational. Proof:Let q be an irrational number and r be a rational number.Assume that their sum is rational,i.e., q+r=s where s is a rational number. Then q = s-r. But by our previous proof the sum of two rational numbers must be rational, so we have an irrational number on the left equal to a rational number on the right. This is a contradiction. Therefore q+r can’t be rational and must be irrational.

  22. Structure of Proof by Contradiction • Basic idea is to assume that the opposite of what you are trying to prove is true and show that it results in a violation of one of your initial assumptions. • In the previous proof we showed that assuming that the sum of a rational number and an irrational number is rational and showed that it resulted in the impossible conclusion that a number could be rational and irrational at the same time. (It can be put in a form that implies n  n is true, which is a contradiction.)

  23. Approaches to Set Proofs • Membership tables (similar to truth tables) • Convert to a problem in propositional logic, prove, then convert back • Use set identities for a tabular proof (similar to what we did for the propositional logic examples but using set identities) • Do a logical argument (similar to what we did for the number theory examples)

  24. Prove (AB)  (AB) = B (AB)  (AB) = {x | x(AB)(AB)} Set builder notation = {x | x(AB)  x(AB)} Def of  = {x | (xA  xB)  (xA  xB)} Def of  x2 and Def of complement = {x | (xB  xA )  (xB  xA )} Commutative x2 = {x | (xB  (xA  xA )} Distributive = {x | (xB  T } Or tautology = {x | (xB } Identity = B Set Builder notation

  25. Prove (AB)  (AB) = B (Using Set Identities) (AB)  (AB) = (BA)  (BA) Commutative Law x2 =B  (A  A) Distributive Law =B  U Definition of U =B Identity Law

  26. Prove (AB)  (AB) = B Proof: We must show that (AB)  (AB)  B and that B  (AB)  (AB) . First we will show that (AB)  (AB)  B. Let e be an arbitrary element of (AB)  (AB). Then either e (AB) or e (AB). If e (AB), then eB and eA. If e (AB), then eB and eA. In either case e B.

  27. Prove (AB)  (AB) = B Now we will show that B  (AB)  (AB). Let e be an arbitrary element of B. Then either e AB or e AB. Since e is in one or the other, then e  (AB)  (AB).

  28. f a1 f a2 a3 A f f a1 b1 f a2 a3 One-to-one? b2 b3 A B f b4 b1 b2 One-to-one? b3 B Functions: One-to-one function A function f is said to be one-to-one, or injective, if and only if f(x) = f(y) implies that x=y for all x and y in the domain of f. a0,a1  A f(a0) = f(a1)  a0 = a1 ORa0  a1  f(a0)  f(a1)

  29. f a1 f a2 a3 A f f a1 b1 f b2 a2 a3 A B f b1 b2 b3 B Onto Function A function f from A to B is called onto, or surjective, if and only if for every element bB there is an element aA with f(a) = b. bB  aA such that f(a) = b

  30. f a1 f a2 a3 A f f a1 b1 f b2 a2 a3 Bijection? A B f Bijection? b1 b2 b3 B One-to-one Correspondence The function f is a one-to-one correspondence or a bijection, if it is both one-to-one and onto.

  31. Correspondence Diagrams: One-to-One or Onto? 1 2 3 4 a b c d a b c d 1 2 3 4 a b c 1 2 3 One-to-one, not onto One-to-one, and onto Onto, not one-to-one 1 2 3 4 a b c d 1 2 3 4 a b c Neither one-to-one nor onto Not a function!

  32. f b a f-1 Inverse Function, f-1 Let f be a one-to-one correspondence from the set A to the set B. The inverse function of f is the function that assigns to an element b belonging to B the unique element a in A such that if f(a) = b, then f-1(b) = a. Example: f(a) = 3(a-1) f-1(b) = (b/3)+1

  33. Examples Is each of the following (on the real numbers): a function? one-to-one? Onto? Invertible? f(x) = 1/x not a function f(0) undefined f(x) = x not a function since not defined for x<0 f(x) = x2 is a function, not 1-to-1 (-2,2 both go to 4), not onto since no way to get to the negative numbers, not invertible

  34. Sequence • A sequence is a discrete structure used to represent an ordered list. • A sequence is a function from a subset of the set of integers (usually either the set {0,1,2,. . .} or {1,2, 3,. . .}to a set S. • We use the notation an to denote the image of the integer n. We call an a term of the sequence. • Notation to represent sequence is {an}

  35. Examples • {1, 1/2, 1/3, 1/4, . . .} or the sequence {an} where an = 1/n, nZ+ . • {1,2,4,8,16, . . .} = {an} where an = 2n, nN. • {12,22,32,42,. . .} = {an} where an = n2, nZ+

  36. Summations • Notation for describing the sum of the terms am, am+1, . . ., an from the sequence, {an} n am+am+1+ . . . + an =  aj j=m • j is the index of summation (dummy variable) • The index of summation runs through all integers from its lower limit, m, to its upper limit, n.

  37. Summations follow all the rules of multiplication and addition! c(1+2+…+n) = c + 2c +…+ nc

  38. Telescoping Sums Example

  39. Closed Form Solutions A simple formula that can be used to calculate a sum without doing all the additions. Example: Proof: First we note that k2 - (k-1)2 = k2 - (k2-2k+1) = 2k-1. Since k2-(k-1)2 = 2k-1, then we can sum each side from k=1 to k=n

  40. Proof (cont.)

  41. Big-O Notation • Let f and g be functions from the set of integers or the set of real numbers to the set of real numbers. We say that f(x) is O(g(x)) if there are constants CN and kR such that |f(x)|  C|g(x)| whenever x > k. • We say “f(x) is big-oh of g(x)”. • The intuitive meaning is that as x gets large, the values of f(x) are no larger than a constant time the values of g(x), or f(x) is growing no faster than g(x). • The supposition is that x gets large, it will approach a simplified limit.

  42. Show that 3x3+2x2+7x+9 is O(x3) Proof: We must show that  constants CN and kR such that |3x3+2x2+7x+9|  C|x3| whenever x > k. Choose k = 1 then 3x3+2x2+7x+9  3x3+2x3+7x3+9x3 = 21x3 So let C = 21. Then 3x3+2x2+7x+9  21 x3when x  1.

  43. Show that n! is O(nn) Proof: We must show that  constants CN and kR such that |n!|  C|nn| whenever n > k. n! = n(n-1)(n-2)(n-3)…(3)(2)(1)  n(n)(n)(n)…(n)(n)(n) n times =nn So choose k = 0 and C = 1

  44. General Rules • Multiplication by a constant does not change the rate of growth. If f(n) = kg(n) where k is a constant, then f is O(g) and g is O(f). • The above means that there are an infinite number of pairs C,k that satisfy the Big-O definition. • Addition of smaller terms does not change the rate of growth. If f(n) = g(n) + smaller order terms, then f is O(g) and g is O(f). Ex.: f(n) = 4n6 + 3n5 + 100n2 + 2 is O(n6).

  45. General Rules (cont.) • If f1(x) is O(g1(x)) and f2(x) is O(g2(x)), then f1(x)f2(x) is O(g1(x)g2(x)). • Examples: 10xlog2x is O(xlog2x) n!6n3 is O(n!n3) =O(nn+3)

  46. Example: Big-Oh Not Symmetric • Order matters in big-oh. Sometimes f is O(g) and g is O(f), but in general big-oh is not symmetric. Consider f(n) = 4n and g(n) = n2. f is O(g). • Can we prove that g is O(f)? Formally,  constants CN and kR such that |n2|  C|4n| whenever n > k? • No. To show this, we must prove that negation is true for all C and k. CN, kR, n>k such that n2 > C|4n|.

  47. CN, kR, n>k such that n2 > 4nC. • To prove that negation is true, start with arbitrary C and k. Must show/construct an n>k such that n2 > 4nC • Easy to satisfy n > k, then • To satisfy n2>4nC, divide both sides by n to get n>4C. Pick n = max(4C+1,k+1), which proves the negation.

More Related