cpsc 121 models of computation
play

CPSC 121: Models of Computation Instructor: Bob Woodham - PowerPoint PPT Presentation

CPSC 121: Models of Computation Instructor: Bob Woodham woodham@cs.ubc.ca Department of Computer Science University of British Columbia Lecture Notes 2008/2009, Section 203 CPSC 121: Models of Computation Menu March 20, 2009 Topics: Set


  1. CPSC 121: Models of Computation Instructor: Bob Woodham woodham@cs.ubc.ca Department of Computer Science University of British Columbia Lecture Notes 2008/2009, Section 203 CPSC 121: Models of Computation

  2. Menu March 20, 2009 Topics: Set Theory (cont’d) Reading: Today: Epp 5.1 Next: Epp 5.2–5.3 Epp 7.1 Reminders: Look for Assignment 4 Final exam Friday, April 17, 7:00pm, SRC A READ the WebCT Vista course announcements board CPSC 121: Models of Computation

  3. News Item: Enrollment/Prospects for CPSC Majors The March 17, 2009, article, “Computer Science Majors Increase at Most Significant Rate Since Dot Com Boom,” is available at http://www.cra.org/govaffairs/blog/ archives/000729.html “Total enrollment by majors and pre-majors in computer science is up 6.2 percent per department over last year. If only majors are considered, the increase is 8.1 percent” “The average number of new students per department majoring in computer science is up 9.5 percent over last year” “According to the United States Department of Labor, computer science graduates on average earn 13 percent more than the average college graduate” “According to the Bureau of Labor Statistics, future job prospects for computer science graduates are higher than for any other science or engineering field” CPSC 121: Models of Computation

  4. Lecture 27: Re-cap Describing sets with braces and set builder notation Propositions related to set membership: x ∈ A , y / ∈ B Empty set denoted by { } or by ∅ Set equality: two sets are equal if and only if they have the same elements Universal set, U A is a subset of B if ∀ x ∈ U , x ∈ A → x ∈ B Cardinality of a set Venn diagram CPSC 121: Models of Computation

  5. Example 1: Set Equality Consider the sets Q = { x 2 | x ∈ Z + } n � P = { x | ∃ n ∈ Z + , x = ( 2 i − 1 ) } i = 1 Does P = Q ? CPSC 121: Models of Computation

  6. Example 1: Set Equality Consider the sets Q = { x 2 | x ∈ Z + } n � P = { x | ∃ n ∈ Z + , x = ( 2 i − 1 ) } i = 1 Does P = Q ? Question: How do we prove equality of sets? CPSC 121: Models of Computation

  7. Example 1: Set Equality Consider the sets Q = { x 2 | x ∈ Z + } n � P = { x | ∃ n ∈ Z + , x = ( 2 i − 1 ) } i = 1 Does P = Q ? Question: How do we prove equality of sets? Answer: We use the following theorem CPSC 121: Models of Computation

  8. Theorem: Set Equality Theorem: Let A and B be sets contained in a universal set, U ↔ ( A ⊆ B ) ∧ ( B ⊆ A ) A = B That is, we can prove set equality by showing that each set is a subset of the other CPSC 121: Models of Computation

  9. Theorem: Set Equality (cont’d) Proof: To prove the biconditional is a tautology, we have to prove two implications are true 1 A = B → ( A ⊆ B ) ∧ ( B ⊆ A ) 2 ( A ⊆ B ) ∧ ( B ⊆ A ) → A = B CPSC 121: Models of Computation

  10. Theorem: Set Equality (cont’d) First, we show A = B → ( A ⊆ B ) ∧ ( B ⊆ A ) We use a direct proof. Assume, for arbitrary sets A , B , that A = B Prove: A ⊆ B Pick an arbitrary x ∈ A . Then x ∈ B since A = B . Thus, ∀ x , x ∈ A → x ∈ B and A ⊆ B , as required Prove: B ⊆ A We use the identical argument, with the roles of A and B interchanged, to prove B ⊆ A , as required CPSC 121: Models of Computation

  11. Theorem: Set Equality (cont’d) Second, we show ∀ A ⊆ U , ∀ B ⊆ U , ( A ⊆ B ) ∧ ( B ⊆ A ) → A = B Our proof is by contradition Assume ∀ A , ∀ B , ( A ⊆ B ) ∧ ( B ⊆ A ) → A = B ≡ ∃ A , ∃ B , ( A ⊆ B ) ∧ ( B ⊆ A ) ∧ A � = B Let A and B be sets such that ( A ⊆ B ) ∧ ( B ⊆ A ) ∧ A � = B CPSC 121: Models of Computation

  12. Theorem: Set Equality (cont’d) Given that A � = B , without loss of generality, let x ∈ A and x / ∈ B ASIDE: If this is not possible then exchange labelling of sets A and B By assumption, A ⊆ B . Thus, x ∈ A → x ∈ B Thus, x ∈ B ∧ x / ∈ B , a contradiction Therefore, we conclude ∀ A , ∀ B , ( A ⊆ B ) ∧ ( B ⊆ A ) → A = B as required QED CPSC 121: Models of Computation

  13. Power Set Let S = { q , x , z } Construct the set of all subsets of S {{ q , x , z } , { q , x } , { q , z } , { x , z } , { q } , { x } , { z } , ∅} The set of all subsets of a given set, S , is called the power set of S and is denoted by P ( S ) ASIDE: A is a proper subset of B , denoted A ⊂ B , if A is a subset of B but A � = B . The power set, P ( S ) , includes all subsets of S , not just the proper subsets CPSC 121: Models of Computation

  14. Questions about Power Set Question: What is the power set of the empty set, P ( ∅ ) ? CPSC 121: Models of Computation

  15. Questions about Power Set Question: What is the power set of the empty set, P ( ∅ ) ? Answer: {∅} CPSC 121: Models of Computation

  16. Questions about Power Set Question: What is the power set of the empty set, P ( ∅ ) ? Answer: {∅} Question: What is P ( P ( ∅ )) ? CPSC 121: Models of Computation

  17. Questions about Power Set Question: What is the power set of the empty set, P ( ∅ ) ? Answer: {∅} Question: What is P ( P ( ∅ )) ? Answer: P ( P ( ∅ )) = P ( {∅} ) = {∅ , {∅}} CPSC 121: Models of Computation

  18. Questions about Power Set Question: What is the power set of the empty set, P ( ∅ ) ? Answer: {∅} Question: What is P ( P ( ∅ )) ? Answer: P ( P ( ∅ )) = P ( {∅} ) = {∅ , {∅}} Question: What is P ( P ( P ( ∅ ))) ? CPSC 121: Models of Computation

  19. Questions about Power Set Question: What is the power set of the empty set, P ( ∅ ) ? Answer: {∅} Question: What is P ( P ( ∅ )) ? Answer: P ( P ( ∅ )) = P ( {∅} ) = {∅ , {∅}} Question: What is P ( P ( P ( ∅ ))) ? Answer: P ( P ( P ( ∅ ))) = P ( {∅ , {∅}} ) = {∅ , {∅} , {{∅}} , {∅ , {∅}}} CPSC 121: Models of Computation

  20. Questions about Power Set Question: What is the power set of the empty set, P ( ∅ ) ? Answer: {∅} Question: What is P ( P ( ∅ )) ? Answer: P ( P ( ∅ )) = P ( {∅} ) = {∅ , {∅}} Question: What is P ( P ( P ( ∅ ))) ? Answer: P ( P ( P ( ∅ ))) = P ( {∅ , {∅}} ) = {∅ , {∅} , {{∅}} , {∅ , {∅}}} Question: For a set of cardinality n , what is the cardinality of its power set? CPSC 121: Models of Computation

  21. Questions about Power Set Question: What is the power set of the empty set, P ( ∅ ) ? Answer: {∅} Question: What is P ( P ( ∅ )) ? Answer: P ( P ( ∅ )) = P ( {∅} ) = {∅ , {∅}} Question: What is P ( P ( P ( ∅ ))) ? Answer: P ( P ( P ( ∅ ))) = P ( {∅ , {∅}} ) = {∅ , {∅} , {{∅}} , {∅ , {∅}}} Question: For a set of cardinality n , what is the cardinality of its power set? Answer: For each of the n elements, we have 2 independent choices: put it in the subset or don’t put it in the subset. Therefore, the total number of choices is 2 × 2 × . . . × 2 ( n times) = 2 n CPSC 121: Models of Computation

  22. Questions about Power Set Question: What is the power set of the empty set, P ( ∅ ) ? Answer: {∅} Question: What is P ( P ( ∅ )) ? Answer: P ( P ( ∅ )) = P ( {∅} ) = {∅ , {∅}} Question: What is P ( P ( P ( ∅ ))) ? Answer: P ( P ( P ( ∅ ))) = P ( {∅ , {∅}} ) = {∅ , {∅} , {{∅}} , {∅ , {∅}}} Question: For a set of cardinality n , what is the cardinality of its power set? Answer: For each of the n elements, we have 2 independent choices: put it in the subset or don’t put it in the subset. Therefore, the total number of choices is 2 × 2 × . . . × 2 ( n times) = 2 n CPSC 121: Models of Computation

  23. Theorem: Cardinality of Power Set Theorem: Let S be a finite set |P ( S ) | = 2 | S | Proof (by induction): To follow (later) CPSC 121: Models of Computation

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend