1 / 9

Cardinality of a Set

Cardinality of a Set. Cardinality : the number of members in a set S is called the cardinality of S. The cardinality is often specified with the symbol, # Example 1 : A = { cpu, memory, printer} then #A = 3 Example 2 : S = { 34, 78, 0, 102, -3 } then #S = 5

emmy
Download Presentation

Cardinality of a Set

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. Cardinality of a Set • Cardinality: the number of members in a set S is called the cardinality of S. • The cardinality is often specified with the symbol, # • Example 1 : A = { cpu, memory, printer} • then #A = 3 • Example 2 : S = { 34, 78, 0, 102, -3 } • then #S = 5 • Example 3 : • # { n: positive integers I n<9 } = 8 This concept is similar to the counting operator , Ω, introduced earlier

  2. Reasoning and Proof in Set Theory • Using Rules of inference, we can also reason and derive theorems in set theory. • Some of the rules are: given A,B, and C are sets • x ε A, x ε B  x ε ( A B) • x ε A, A B -> x ε B • A = B , B = C  A = C • x ε A -> x ε ( A U B U ------U Z ) • A B, B C -> A C Do you believe in all these? Try proving them. Hint: one of them may be misleading (Look Carefully)

  3. Example of Proving a Set Theory Rule • Show (A B) = (B A) • x ε (A B) = x ε A , x ε B • “ = x ε A /\ x ε B • “ = x ε B /\ x ε A • “ = x ε ( B A) • Thus (A B) = ( B A)

  4. List of Set Theory Rules (Theorems) • A U A = A • A U O = A • A U B = B U A • (A U B) U C = A U (B U C) • A O = O • A B = B A • A A = A • (A B) C = A (B C) • A U (B C) = (A U B) (A U C) • A (B U C ) = ( A B) U ( A C)

  5. Modeling (with Prop./Pred. Calculus & Set Theory) • Example of Sets & Statements: Let • S = set of all programs in a System X • A = set of all running programs in X • B = set of all non-running programs in X • We can say : • A U B = S : “ all programs in X are running or not running” • A B = O : “ a program is either running or not running but not both ”

  6. More on Modeling • Consider : modeling “users are logged into a system if they key in valid username and password.” • Let : UserNames = set of user names • Pa_Code = set of pass words • Table = { UserName X Pa_Code} • S_Table = security table of this system • S_Table ε IP Table (S_Table is the security table and thus is an element of power set of Table.) • logged_in = set of logged in users • thus • logged_in UserNames • Also let ‘ to mean post-condition : so that S_Table’ would mean the post condition of S_Table.

  7. More on Modeling (cont.) “users are logged into a system if they key in valid username and password.” • Express the Log-in function: • let: userAε UserNames , passε Pa_Code • Log-in (userA, pass) => (S_Table’ = S_Table) /\ (UserNames’ = UserNames) /\ (Pa_Code’ = Pa_Code) /\ { (userA,pass) ε S_Table -> ( logged_in’ = ( logged_in U userA ) ) } /\ { (userA, pass) ε S_Table -> ( logged_in’ = logged_in ) }

  8. More on Modeling (cont.) • Express the Log-in function: • user ε UserNames , pass ε P_Code • log-in (user, pass) => (S_Table’ = S_Table) /\ (UserNames’ = UserNames) /\ (P_Code’ = P_Code) /\ { (user,pass) ε S_Table -> ( logged_in’ = ( logged_in U user ) ) } /\ { (user, pass) ε S_Table -> ( logged_in’ = logged_in ) } Some of you wanted to re-write this --- see next slide.

  9. Alternative • Let A = (user, pass) S_Table • Let B = add user A B A -> B ~A -> ~B /\ A /\ B ~A /\ ~B \/ T T T T T F T T F T F F T F F F T T F F F F F F F T F T T F T T So you can rewrite the “circled” area of previous slide with a OR of two AND conditions.

More Related