cse 311 foundations of computing announcements
play

CSE 311: Foundations of Computing announcements Fall 2013 Reading - PowerPoint PPT Presentation

CSE 311: Foundations of Computing announcements Fall 2013 Reading assignment Lecture 9: Set theory and functions Set theory 2.1-2.3 (both editions) set theory definition: a set is an unordered collection of objects : x is an


  1. CSE 311: Foundations of Computing announcements Fall 2013 Reading assignment Lecture 9: Set theory and functions Set theory 2.1-2.3 (both editions) set theory definition: a set is an unordered collection of objects � ∈ � : “ x is an element of A ” “ x is a member of A ” • Formal treatment dates from late 19 th century “ x is in A ” • Direct ties between set theory and logic • Important foundational language � ∉ � : ¬ ( � ∈ � ) � = { 1, 2, 7, cat, dog, �, � } cat ∈ � fish ∉ �

  2. definitions empty set and power set • A and B are equal if they have the same elements • Empty set ∅ does not contain any elements A = B ≡ ∀ x ( x ∈ A ↔ x ∈ B) • Power set of a set A = set of all subsets of A � � = { � ∶ � ⊆ � } • A is a subset of B if every element of A is also in B A ⊆ B ≡ ∀ x ( x ∈ A → x ∈ B) cartesian product set operations � ∪ � = { � ∶ � ∈ � ∨ � ∈ � } union � ∩ � = { � ∶ � ∈ � ∧ � ∈ � } intersection � − � = { � ∶ � ∈ � ∧ � ∉ � } set difference symmetric � ⊕ � = { � ∶ � ∈ � ⊕ � ∈ � } difference $ = � ∶ � ∉ � � complement (with respect to universe U)

  3. it’s Boolean algebra again De Morgan’s Laws • Definition for ∪ ∪ based on ∨ � ∪ � = �̅ ∩ � & ∪ ∪ ∨ ∨ ∨ • Definition for ∩ ∩ based on ∧ ∩ ∩ ∧ ∧ ∧ � ∩ � = �̅ ∪ � & • Complement works like ¬ Proof technique: To show C = D show x ∈ C → x ∈ D and x ∈ D → x ∈ C distributive laws representing sets using bits • Suppose universe ( is {1,2, … , *} � ∩ � ∪ ' = � ∩ � ∪ � ∩ ' • Can represent set � ⊆ ( as a vector of bits: � ∪ � ∩ ' = � ∪ � ∩ � ∪ ' + , + - … + . where + / = 1 when 0 ∈ � + / = 0 when 0 ∉ � – Called the characteristic vector of set B A B A B • Given characteristic vectors for � and � – What is characteristic vector for � ∪ � ? � ∩ � ? C C

  4. bitwise operations on vectors a simple identity • If x and y are bits: (x ⊕ y) ⊕ y = ? 01101101 Java: z=x|y ∨ 00110111 ∨ ∨ ∨ 01111111 • What if x and y are bit-vectors? 00101010 Java: z=x&y ∧ 00001111 ∧ ∧ ∧ 00001010 01101101 Java: z=x^y ⊕ 00110111 ⊕ ⊕ ⊕ 01011010 private key cryptography one-time pad • Alice and Bob privately share random n-bit vector K • Alice Alice Alice wants to communicate message secretly to Alice Bob Bob Bob so that eavesdropper Eve Bob Eve Eve who hears their Eve – Eve does not know K conversation cannot tell what Alice Alice Alice Alice’s message is. • Later, Alice has n-bit message m to send to Bob • Alice Alice and Bob Alice Alice Bob can get together and privately share Bob Bob – Alice computes C = m ⊕ K a secret key K ahead of time. – 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

  5. unix/linux file permissions russell’s paradox • ls –l drwxr-xr-x ... Documents/ -rw-r--r-- ... file1 • Permissions maintained as bit vectors – Letter means bit is 1 – “--” means bit is 0. functions review image, preimage • A function from 2 to 3 � � • an assignment of exactly one element of 3 to each element of 2 . 1 a • We write 4 ∶ 2 → 3 . • “Image of a” = 4(7) 2 b c 3 • Domain of 4 : 2 d 4 e • Range of 4 = set of all images of elements of 2

  6. is this a function? one-to-one? onto? 1 a 2 b c 3 d 4 5 e 6

Recommend


More recommend