Download - CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1
![Page 1: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/1.jpg)
CSE 311 Foundations of Computing I
Lecture 10Set Theory
Autumn 2012
Autumn 2012 CSE 311 1
![Page 2: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/2.jpg)
Announcements
• Reading assignments– Wednesday:
• 4.1-4.2 7th Edition• 3.4, 3.6 up to p. 227 6th Edition• 2.4, 2.5 up to p. 177 5th Edition
• Homework 4– Coming soon . . .
Autumn 2012 CSE 311 2
![Page 3: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/3.jpg)
3
Set Theory
• Formal treatment dates from late 19th century• Direct ties between set theory and logic• Important foundational language
Autumn 2012 CSE 311
![Page 4: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/4.jpg)
4
Definition: A set is an unordered collection of objects
x A : “x is an element of A” “x is a member of A” “x is in A”x A : (x A)/
Autumn 2012 CSE 311
![Page 5: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/5.jpg)
5
Definitions
• A and B are equal if they have the same elements
• A is a subset of B if every element of A is also in B
A = B x (x A x B)
A B x (x A x B)
Autumn 2012 CSE 311
![Page 6: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/6.jpg)
6
Empty Set and Power Set
• Empty set ∅ does not contain any elements
• Power set of a set A = set of all subsets of A𝓟(A) = { B : B A}
Autumn 2012 CSE 311
![Page 7: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/7.jpg)
7
Cartesian Product : A B
A B = { (a, b) | a A b B}
Autumn 2012 CSE 311
![Page 8: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/8.jpg)
8
Set operations
A B = { x | (x A) (x B) }
A B = { x | (x A) (x B) }
A B = { x | (x A) (x B) }
A - B = { x | (x A) (x B) }
A = { x | x A } (with respect to universe U)
_
//
union
intersection
set difference
symmetric difference
complement
Autumn 2012 CSE 311
![Page 9: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/9.jpg)
It’s Boolean algebra again
• Definition for based on • Definition for based on • Complement works like
Autumn 2012 CSE 311 9
![Page 10: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/10.jpg)
10
De Morgan’s Laws
A B = A B
A B = A B
Proof technique:To show C = D showx C x D andx D x C
A B
Autumn 2012 CSE 311
![Page 11: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/11.jpg)
11
Distributive Laws
A (B C) = (A B) (A C)A (B C) = (A B) (A C)
C
A B
C
A B
Autumn 2012 CSE 311
![Page 12: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/12.jpg)
Characteristic vectors:Representing sets using bits
• Suppose universe U is {1,2,...,n}• Can represent set B ⊆ U as a vector of bits:
b1b2...bn where bi=1 (i ∈ B)
bi=0 (i ∈ B)– Called the characteristic vector of set B
• Given characteristic vectors for A and B– What is characteristic vector for A B? A B ?
Autumn 2012 CSE 311 12
/
![Page 13: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/13.jpg)
Boolean operations on bit-vectors:(a.k.a. bit-wise operations)
• 01101101 Java: z=x|y 00110111
01111111
• 00101010 Java: z=x&y 00001111
00001010
• 01101101 Java: z=x^y 00110111
01011010Autumn 2012 CSE 311 13
![Page 14: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/14.jpg)
A simple identity
• If x and y are bits: (x y) y = ?
• What if x and y are bit-vectors?
Autumn 2012 CSE 311 14
![Page 15: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/15.jpg)
Private Key Cryptography
• Alice wants to be able to communicate message secretly to Bob so that eavesdropper Eve who hears their conversation, cannot tell what Alice’s message is.
• Alice and Bob can get together and privately share a secret key K ahead of time.
Autumn 2012 CSE 311 15
![Page 16: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/16.jpg)
One-time pad
• Alice and Bob privately share random n-bit vector K – Eve does not know K
• Later, Alice has n-bit message m to send to Bob– Alice computes C = m K– Alice sends C to Bob– Bob computes m = C K which is (m K) K
• Eve cannot figure out m from C unless she can guess K
Autumn 2012 CSE 311 16
![Page 17: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/17.jpg)
Unix/Linux file permissions
• ls –l drwxr-xr-x ... Documents/ -rw-r--r-- ... file1
• Permissions maintained as bit vectors– Letter means bit is 1 - means bit is 0.
Autumn 2012 CSE 311 17
![Page 18: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/18.jpg)
18
Russell’s Paradox
S = { x | x x }/
Autumn 2012 CSE 311
![Page 19: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/19.jpg)
19
Functions review• A function from A to B
• an assignment of exactly one element of B to each element of A.
• We write f: A→B.• “Image of a” = f(a)
• Domain of f : A• Range of f = set of all images of elements of A
Autumn 2012 CSE 311
![Page 20: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/20.jpg)
20
Image, Preimage
A B
a
b
c
d
e
1
2
3
4
Autumn 2012 CSE 311
![Page 21: CSE 311 Foundations of Computing I Lecture 10 Set Theory Autumn 2012 Autumn 2012CSE 311 1](https://reader036.vdocuments.site/reader036/viewer/2022062423/5697c0071a28abf838cc60a4/html5/thumbnails/21.jpg)
21
Is this a function? one-to-one? onto?
a
b
c
d
e
1
2
3
4
5
6
Autumn 2012 CSE 311