Upload
lizbeth-bishop
View
213
Download
0
Embed Size (px)
Citation preview
Mathematical preliminaries
Episode 2
0
• Sets• Sequences• Functions • Relations • Strings
Sets2.1
Set --- any collection of distinct objects.
• E={2,4,6,8,…}, or• E={x | x is a positive integer divisible by 2}, or• E={x | x=2k for some positive integer k}, etc.
aE --- “a is an element of E”, or “a is in E”aE --- “a is not an element of E”, or “a is not in E”ST --- “S is a subset of T” i.e. every element of S is also an element of TST --- “the intersection of S and T ” i.e. the set of the objects that are both in S and TST --- “the union of S and T ” i.e. the set of the objects that are in either S or T or both --- “the empty set”
Describing a set:
Set-related terminology and notation:
Sequences, tuples, products2.2
A sequence is a finite or infinite list. E.g.: 1,1,2,1,2,3,1,2,3,4,1,2,3,4,5,… is a sequence of natural numbers
An n-tuple is a sequence with n elements.E.g.: (5,2) --- 2-tuple (pair) (3,0,3) --- 3-tuple (triple) (1,2,1,2) --- 4-tuple (quadruple)
{1,2,2} = {1,2} = {2,1}, but (1,2,2) (1,2) (2,1)
The product of sets S and T is defined by ST = {(s,t) | sS and tT}
Generalizes to S1...Sn
!
Functions
2.3
Function (often also called an operation) f from set A to set B --- assignment of a unique element f(a)B to each aA
N --- natural numbers: {0,1,2,…} R --- rational numbers: {0/1, 5/1, 1/3, 8/5, etc.}
If x,y always take values from N, what are the types of f, g, h?
the type of f
the range of fthe domain of f
f: A B
A B
a
b
c
1234
f
f(x) = 2x g(x) = x/2 h(x,y) = x+y
f: g: h: NN N N RN N
Relations
2.4
Let A be a set and n be a natural number. An n-ary relation on A is any subset of An (An means A...A n times).
When n=1, the relation is said to be unary; when n=2, it is said to be binary; when n=3, it is said to be ternary.
Example: < is a binary relation on N:
NN
<
(1,3) (6,20)
(12,32) ...
(3,1)
(4,4)
(100,39)
...
Predicates; characteristic functions
2.5
Throughout this course, by a predicate we will try to exclusively meana unary relation.
In the literature, the words “predicate” and “relation” are usually used as synonyms. This is OK: after all, every n-ary relation on A can as well be thought of as a unary relation (predicate) on An.
Furthermore, we will see no difference between predicates and sets. Indeed, by definition, a predicate (or a relation in general) is nothingbut a set.
Let A be a set and P be a predicate on it. The characteristic function of P is defined as the function p: A{0,1} such that, for every wA,
p(w) =1 if wP;0 if wP.
Often we further identify predicates with their characteristic functions.
Strings
2.6
Alphabet --- a finite set of objects called the symbols of the alphabet. {a,…,z,0,...,9,!,?,$,>,#,...} --- Keyboard alphabet.{0,...,9} --- Decimal alphabet. Its elements are called decimal digits.{0,1} --- Binary alphabet. Its elements are called bits (binary digits).
String over an alphabet --- a sequence of symbols from .Decimal strings: 2007, 12144, etc.Binary strings (bit strings): 1001, 00000, 011, etc. Finite strings: abracadabra, 厦门大学 , etc. Infinite strings: 00000..., 101010..., etc.
The empty string is denoted by .
The Concatenation wu of strings w and u is the result of appending u at the end of w. Defined only when w is finite.
The set of all strings over alphabet is denoted by *.
What else you need
2.7
You are expected to have some basic knowledge and experience with:
• Graphs
• Mathematical definitions and proofs
• Theory of computation
• Logic