Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mathematical preliminaries Episode 2 0 Sets Sequences Functions Relations Strings.

Similar presentations


Presentation on theme: "Mathematical preliminaries Episode 2 0 Sets Sequences Functions Relations Strings."— Presentation transcript:

1

2 Mathematical preliminaries Episode 2 0 Sets Sequences Functions Relations Strings

3 Sets 2.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. a  E --- “a is an element of E”, or “a is in E” a  E --- “a is not an element of E”, or “a is not in E” S  T --- “S is a subset of T” i.e. every element of S is also an element of T S  T --- “the intersection of S and T ” i.e. the set of the objects that are both in S and T S  T --- “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:

4 Sequences, tuples, products 2.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 S  T = {(s,t) | s  S and t  T} Generalizes to S 1 ...  S n !

5 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 a  A 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 f the domain of f f: A  B A B abcabc 12341234 f f(x) = 2x g(x) = x/2 h(x,y) = x+y f: g: h: N  N  N N  RN  N

6 Relations 2.4 Let A be a set and n be a natural number. An n-ary relation on A is any subset of A n (A n 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: NNNN < (1,3) (6,20) (12,32)... (3,1) (4,4) (100,39)...

7 Predicates; characteristic functions 2.5 Throughout this course, by a predicate we will try to exclusively mean a 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 A n. Furthermore, we will see no difference between predicates and sets. Indeed, by definition, a predicate (or a relation in general) is nothing but 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 w  A, p(w) = 1 if w  P; 0 if w  P. Often we further identify predicates with their characteristic functions.

8 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  *.

9 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


Download ppt "Mathematical preliminaries Episode 2 0 Sets Sequences Functions Relations Strings."

Similar presentations


Ads by Google