Fundamentals of Computer Mathematics ②(Sets and Strings)

Article directory

Sets and Strings

Strings

Definition 2.1. An alphabet is any collection of symbols.

The alphabet is a collection of any symbols

Definition 2.2. Take any alphabet Σ. A string over the alphabet Σ is
any sequence of letters in an alphabet.

Take any letter Σ for example. A string on the letter Σ is any sequence of letters in the alphabet.

Definition 2.3. The length of any string is the number of characters
in that string.

The length of any string is the number of characters
insert image description here
In other words, two strings are equal if and only if they are literally exactly character-by-character! Note that two strings of different lengths are always unequal of.

insert image description here
We specify that st is the concatenation of string s and string t

Definition 2.6. Let s and t be strings. We say that s is a prefix of t
if t is just s with some additional stuff possibly tacked on the end: i.e. if
we can find a third string u such that su = t.

Similarly, we say that s is a suffix of t if t is just s with some additional
stuff possibly tacked on the front: i.e. if we can find a third string u such
that us = t.

Finally, we say that s is a substring (alternately, an “infix”) of t if t
is just s with some stuff possibly tacked on both the front and end: i.e.
if we can find strings u, v such that usv = t.

Let s and t be strings. We say that s is a prefix of t. If t is just s with something extra at the end, we can find a third string u such that su = t.

Similarly, if t is just s plus something that might be appended to the front: for example, if we can find a third string u such that us = t. We say that s is a suffix of t,

Finally, if t is just s, there might be something appended to both the front and the end: if we can find the strings u, v, such that usv = t. We say that s is a substring (or "infix") of t.

Claim 2.1. The empty string λ is a prefix, suffix, and substring of every
string t.

The empty string λ is the prefix, suffix, and substring of each string t.

Claim 2.2. If s is a prefix of t, then s is a substring of t.

If s is a prefix of t, then s is a substring of t

Sets

Definition 2.7. A set A is just a collection of things. We call those
things the elements of A, and write x ∈ A to denote with symbols the
statement “x is an element of A.

To describe a set, we just list its elements between a pair of curly braces:
for example, {
    
    1, 2, 3} would be how we would describe the set consisting
of the three numbers 1, 2 and 3.

A set A is a set of things. We
denote x ∈ A as an element of A
"x is an element of a"

To describe a set, simply list its elements between a pair of curly braces: for example, {1,2,3} is the way to describe a set consisting of the numbers 1,2, and 3.

Definition 2.8. A set A has size n if it contains precisely n different
elements. If A contains infinitely many different elements, we say that
A has “infinite” size. We denote the size of A by writing ∣A.

If it contains exactly n distinct elements, the set A is of size n. If A contains an infinite number of distinct elements, we say that the size of A is "infinite". We denote the size of A by writing ∣A∣.

Definition 2.9. Take two sets A, B We say that B is a subset of A,
and write BA, if every object in B is also an object in A.

Take two sets A and B. If every object in B is also an object in A, we say that B is a subset of A, and write B⊆A.

Definition 2.10. Let A, B be a pair of sets. We define the union of
these two sets, AB, to be the collection of all elements that are in
either A or B or both.

Let A, B be a pair of sets. Define the union of these two sets:
A∪B, is the set of all elements in it, either A or B, or both.

Definition 2.11. Let A, B be a pair of sets. We define the intersection
of these two sets, AB, to be the collection of all elements that are in
both A and B at the same time.

Let A, B be a pair of sets. We define the intersection in these two sets:
A∩B, is the set where all elements of A and B appear at the same time.

Definition 2.12. Let A, B be a pair of sets. We define the difference
of these two sets, written AB or alternately AB, to be the collection
of all elements that are both in A and not in B at the same time.

Let A, B be a pair of sets. We define the difference set, written A∖B or A - B, as the set of all elements that are in A but not in B at the same time.

Definition 2.13. We say that two sets A, B are equal if they both
consist of the same elements; that is, if
• Every element in A is a element in B, and
• Every element in B is also a element in A.

We say that a set A and a set B are equal if they are both
the same: consist of the same elements; that is, if
each element in A is an element in B, and each element in
B An element is also an element in a.

Claim 2.3. Let A, B be any two sets such that AB. Then AB = B.

Let A and B be any two sets of A⊆B, then A∪B = B

Claim 2.4. Let A, B be any two sets. Then (AB)A =.

Let AB be any two sets. Then (A∖B)∖A =∅.

Claim 2.5. If A, B, C are three sets, then A(BC) = (AB)(AC).

If A, B, C are three sets, then A∖(B∪C) = (A∖B)∩(A∖C).

Guess you like

Origin blog.csdn.net/zyb18507175502/article/details/124232581