Sets (Computer Science Notes)
Sets
•
Definition: A set is an unordered collection of objects {x
∈
Z  3 ≤ x ≤ 7}, first part tells
you that a variable x that ranges in the set and the second part gives you the constraints
for the variable, separator ( or :) is often read “such that.”
Things to be Careful About
•
A set is an unordered collection. So {1, 2, 3} and {2, 3, 1} are two names for the same
set. Each element occurs only once in a set. Or, alternatively, it doesn’t matter how many
times you write it. So {1, 2, 3} and {1, 2, 3, 2} also name the same set
•
We’ve seen ordered pairs and triples of numbers, such as (3, 4) and (4, 5, 2). The general
term for an ordered sequence of k numbers is a ktuple.1 Tuples are very different from
sets, in that the order of values in a tuple matters and duplicate elements don’t magically
collapse (1, 2, 2, 3) 6= (2, 2, 1, 3) Pair() Set{}
•
∅ 
empty set
Cardinality, Inclusion
•
If A is a finite set (a set containing only a finite number of objects), then A is the number
of (different) objects in A. This is also called the cardinality of A
•
{a, b, 3} = 3 and {a, b, a, 3} is also 3, because we count a group of identical objects
only once
•
If A and B are sets, then A is a subset of B (written A
⊆
B) if every element of A is also in
B
•
The notion of subset allows the two sets to be equal. So A
⊆
A is true for any set A. So
⊆
is like ≤
•
If you want to force the two sets to be different (i.e. like <), you must say that A is a
proper subset of B, written A
⊂
B. You’ll occasionally see reversed versions of these
symbols to indicate the opposite relation B
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Erickson
 Computer Science, Set Theory, Sets, Empty set, representative, Set Union

Click to edit the document details