4.4.2.2 Maths for regular expressions Flashcards
What is a set?
an unordered collection of values in which each value occurs at most once.
X = {1,2,3,…}
… shows the set continues in the obvious way infinitely
{} = empty set
What is set building?
The process of creating sets by describing them using notation rather than listing the elements
e.g {x | x ∈ ℕ ∧ x ≥ 1 }
What is a member?
Describes a value or element that belongs to a set
What is a proper subset?
Where one set is wholly contained within another
Proper subset - the set that isn’t the subset contains some values not found in the subset
A ⊂ B where A is a proper subset of B
A ⊆ B where A is a subset of B
What is cardinality?
Number of elements in a finite set
X = {1,2,3} cardinality = 3
What is a countably infinite set?
Infinite set - set where the elements go on forever
… shows the set continues in the obvious way infinitely
Countable set - a set which can be counted off against a subset of natural numbers
Sets where the elements can be put into a one-to-one correspondence with the set of natural numbers
one that can be counted off by the natural numbers.
e.g set of N, you can count off each item of the set, but R is not because you can’t list all the numbers of the set, you don’t know what number is next
What is a cartesian product?
Combining the elements of two or more sets to create a set of ordered pairs.
Cartesian product of two sets, A and B,written A x B and read ‘A cross B’, is the set of all ordered pairs (a, b) where a is a member of A and b is a member of B.
e.g
A = {9, 57, 104}
B = {33, 66, 99}
C = {(9,33),(9,66),(9,99),(57,33)etc.}
Union
Where two sets are joined and all the elements of both sets are included in the joined set. If there are duplicates of the same value in two sets then you only keep one instance
Venn diagram - everything filled in
∪
print (A | B)
Intersection
Describes which elements are common to both sets when two sets are joined - the duplicates (middle shaded in)
∩
print (A & B)
Difference
Describes which elements differ when two sets are joined together - in venn diagram just one circle but without intersection. Everything which is set A but not in set B A = {1,2,3,4,5} B = {1,3,5,7,9} A \ B = {2,4} print (A ^ B)
What is a finite set?
A set whose elements can count up to a particular number using natural numbers, i.e the set has an end value