set builder notation: P=x∈Z+∣xisprimenumberandx<20
data types in CS is built upon the concept of a set
my_set = {1,2,"hi"} # set from iterable object my_set = set([1,2, "hi"])
Set<Integer> mySet = newHashSet<>();
Equal Set
every element in 1st set is in 2nd set, and vice versa ∀x(x∈A↔x∈B)
Remark 1: empty set / null set is special set with no element ∅
Remark 2: set with 1 element: singleton set
Subset:
A is a subset of B, and B is a superset of A ⇐> every element of A is also element of B
(A is subset of set B: A⊆B) = (B is superset of set A: B⊇A)
Theorem 4: For every set S, (i) ∅⊆S, (ii) S⊆S
Remark 1: A is proper subset of B if (i) A is a subset of B (ii) A=B
Remark 2:A⊆B and B⊆C⇒A=B
Power Set:
power set of S is set of all subsets of set S, P(S)
Cardinality:
If have exactly n distinct elements in set S, n is nonnegative integer → S is a finite set, n is cardinality (number of elements) of S (denoted as ∣S∣)
Sn is the set of length n ‘strings’. Can be defined as product of n copies of S (i.e., S×S×⋯×S).”
{0,1}n: set of all n-bit strings. n=3→ set is all possible combination of 0 and 1 in string of length 3
There are 2n possible strings (8 when n = 3 above)
S∗ is the set of finite length ‘strings’S∗=S0∪S1∪S2∪..., where S0 contains empty string.”
{0,1}∗: set of all finite-length bit strings. ∗ = any length, even 0. → set is all possible combinations of 0 and 1 for all possible lengths, including "", “0”, and so on
[n] is the set {0,1,2,⋯,n−1}
Russell’s Paradox
R={S∣S∈/S}, that is R is the set of all sets that don’t contain themselves as an element