# Reviewing Set Theory

Document Sample

```					                                                                                                 Set Theory Basics

Basic concepts:

Reviewing Set Theory
 Objects, elements, sets
 Enumeration notation: as in f1 2 3g         ;   ;

COMP2600 — Formal Methods for Software Engineering
 Is-element-of notation: as in 5 P f1 3 5 7g         ;   ;   ;

Set equality and notational ambiguity:

Clem Baker-Finch                                           f1 2 3g = f3 2 1g
;   ;           ;   ;

Australian National University
 f1 2 3 2 1g = f1 2 3g
;   ;   ;   ;           ;   ;

Semester 2, 2009

COMP 2600 — Reviewing Set Theory                                                    1   COMP 2600 — Reviewing Set Theory                                                      3

Why should we study set theory?                                                         Standard sets

Understanding mathematics: It is the foundation!                                        Named sets
Programming: Types and classes are sets.                                                   numbers:
Specifying software: Legal inputs and appropriate outputs are sets.                         N is the set of natural numbers; Z is the set of integers;
Q is the set of rational numbers; R is the set of real numbers.
Reasoning about programs: This inevitably relies on sets of data values.
 booleans: The set fT Fg is typically called Bool.
;

Semantics: The meaning of a program is a mapping of one set of data to
another.
 characters: Often consisting of the set of ASCII characters, and often
will be referred to as Char.

The empty set           ?
 Basic properties: V x P D x TP ? and V A P D ? & A
:                       :

 Note: f?g is not the same set as ?.
COMP 2600 — Reviewing Set Theory                                                    2   COMP 2600 — Reviewing Set Theory                                                      4
Notation for Inﬁnite Sets                                                      Russell’s Paradox

The “dot-dot-dot” notation                                                     Reveals a problem with an unconstrained notion of sets: even if   P is a
sensible predicate, it doesn’t necessarily characterise a set.
 f1 3 5 7 g ‘obviously’ denotes the set of odd numbers.
;   ;   ;   ; :::

Russell considered the set of all sets that are not members of themselves:
Problems:
S  fA j A TP Ag
Occasionally, but in general, no.                                         and posed the question “Is    S a member of itself?”
 Is it ambiguous?                                                           Consider the 2 cases:
Is f1 2 3 g the same set as f1 2 3 4 g ?
;   ;   ; :::                ;   ;   ;   ; :::
 Suppose S P S . Then S is in the set fA j A TP Ag, so S TP S .
 Suppose S TP S . Then S satisﬁes the predicate A TP A, so S P S .
Hence there is no such S . The predicate is sensible, but it does not
characterise a set.

COMP 2600 — Reviewing Set Theory                                           5   COMP 2600 — Reviewing Set Theory                                                      7

Characteristic Predicates                                                      Universal Sets

Need a better notation:                                                        Venn diagrams are a notation where union and intersection can be well
illustrated. If complements are to have any meaning then Venn diagrams
 S = fx P D j P (x )g                                                        often show a box that corresponds to the whole domain of discourse — the
 P will be called the characteristic predicate of the set S .                universal set.
U
We often write fx j P (x )g when the domain is understood.                                                                            B
A
We should ask ourselves “Is this always a sensible notation?”

A B
U

COMP 2600 — Reviewing Set Theory                                           6   COMP 2600 — Reviewing Set Theory                                                      8
New sets from Old                                                                           Cartesian Product

Subset:                                                                                     Notation:

 Notation: A & B holds iff V x P A x P B       :
 A ¢ B = f(x y ) j x P A  y P B g
;

 If P is a predicate of appropriate type, and A is given, then                              A ¢ B ¢ C = f(x y z ) j x P A  y P B  z P C g
;   ;

fx P A j P (x )g is a new set.                                                             etc.
Of course it is a subset of A.
Apparent abuse of notation: The product is deﬁned in terms of a set of
On subsequent slides we recall other ways to build sets.                                    ordered pairs. Since the set they belong to is the Cartesian product, the
 Power set                                                                               deﬁnition seems circular.

 Cartesian Product                                                                       Resolution: The existence of the Cartesian product is an axiom of set theory.
Consequently the expression           f(x y ) P A ¢ B j x P A  y P B g
;                                is well
 Union and intersection                                                                  formed.

COMP 2600 — Reviewing Set Theory                                                        9   COMP 2600 — Reviewing Set Theory                                                             11

New sets from Old - II                                                                      The Usual Binary Operations

Power set:                                                                                  Binary union and intersection (of 2 sets belonging to a universe of
discourse):
 Notation: P (A) denotes the power set of A.
 A  B = fx P U j (x P A)  (x P B )g
 Deﬁnition: P (A)  fs j s & Ag
i.e. P (A) is the set of all subsets of A.                                                A  B = fx P U j (x P A)  (x P B )g
 Example: P (f1 2g) = f? f1g f2g f1 2gg
;              ;    ;       ;   ;
U is the universe of discourse. That is, A & U        and   B & U.
Iterated union and intersection

Cardinality notation:         jAj   indicates the cardinality of         A.                    Union: Si 2I Di = fx P U j W i P I x P Di g  :

The power set is so called because           j P (A) j        =   2jAj                         Intersection: Ti 2I Di = fx P U j V i P I x P Di g:

I is called the index set.

COMP 2600 — Reviewing Set Theory                                                       10   COMP 2600 — Reviewing Set Theory                                                             12
Functions and Relations as Sets                                                               Reference Details

Set-theoretic view: relations and functions are both sets of ordered pairs.                   Chapter 5 of Grassman and Tremblay is called Sets and Relations.

Relations:                                                                                   5.1 Sets and Set Operations. You must know this.

 Any subset of A ¢ B is a relation between elements of A and elements                     5.2 Tuples, Sequences and Power-sets.
of B .                                                                                     5.2.1 Introduction: should know.

 That is, any R P P (A ¢ B ) is a relation between A and B .                                5.2.2 Tuples and Cartesian Products: must know.

 If xRy then (x y ) P R, x P A and y P B .
;
5.2.3 Sequences and Strings: We’ll get to this.
5.2.4 Power-sets: should know.
Functions:
5.2.5 Types and Signatures: We’ll cover this.
 Each function f from A to B , is also an element of P (A ¢ B ), but                      5.3 Relations: We’ll be talking about this.
subject to the condition that if (x y1 ) P f  (x y2 ) P f then y1 = y2 .
;              ;