Professional Documents
Culture Documents
Set, Logical and Operation
Set, Logical and Operation
Set, Logical and Operation
This denotes the empty set – i.e., the set with no elements in it. This can also be denoted
as {}.
{Matthew, Mark, Luke, John}
This is a set of people containing four elements. The types of Matthew, Mark, Luke, John
must be compatible!
{0, 1, 2} = {0, 0, 1, 0, 2, 1} = {1, 2, 0}
The empty set (of a particular type) is a member of the set containing just the empty set
of that type. In fact it is the only member.
0∉ ∅
This is another way of writing ‘¬ (0 ∈ ∅)’ – i.e., 0 is not a member of the empty set (of
numbers). This is true because no element can be a member of the empty set; there are
no elements in it by definition. In fact, for any x, we can say x ∉ ∅. A special notation is
used for ‘is not a member of ’ since this occurs quite often in specifications.
The set being checked by ∉ need not be empty for a predicate using it to be true.
For example, the set of people given here does not include Paul, so the predicate is true.
Venn Diagram
Venn Diagram
Venn Diagram
Venn Diagram
A ⊆B Each element of A is also an element of B.
{x : N | x is_prime ∧ x
The set of prime numbers (not including the
≠ 2} ⊆ {x : N | x
number 2) is a subset of the odd numbers.
is_odd}
Set intersection (∩) and logical conjunction (∧):
{x : T | p} ∩ {x : T | q} = {x : T | p ∧ q}
Union (∪) and disjunction (∨):
{x : T | p} ∪ {x : T | q} = {x : T | p ∨ q}
Complementing a set is like negating a predicate:
{x : T | p}− = {x : T | ¬ p}
The notion of a subset (⊆) matches that of implication (⇒):
{x : T | p} ⊆ {x : T | q} iff p ⇒ q
Set equality (=) matches logical equivalence (⇔):
{x : T | p} = {x : T | q} iff p ⇔ q
Sets and predicates are similar in some respects. Each set operator has a
corresponding logical connective which may be associated with it.
The empty set (of a particular type T) is equivalent to the false
predicate:
∅ [T] = {x : T | false}
The entire set of a given type is equivalent to the true predicate:
T = {x : T | true}