Episode 2 Mathematical preliminaries Sets Sequences Functions Relations

  • Slides: 8
Download presentation
Episode 2 Mathematical preliminaries • Sets • Sequences • Functions • Relations • Strings

Episode 2 Mathematical preliminaries • Sets • Sequences • Functions • Relations • Strings 0

2. 1 Sets Set --- any collection of distinct objects. • E={2, 4, 6,

2. 1 Sets Set --- any collection of distinct objects. • E={2, 4, 6, 8, …}, or Describing a set: • E={x | x is a positive integer divisible by 2}, or • E={x | x=2 k for some positive integer k}, etc. Set-related terminology and notation: 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”

2. 2 Sequences, tuples, products A sequence is a finite or infinite list. E.

2. 2 Sequences, tuples, products A sequence is a finite or infinite list. E. g. : 1, 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. . . Sn

2. 3 Functions Function (often also called an operation) f from set A to

2. 3 Functions 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 A the domain of f B f a b c f: A B N --- natural numbers: {0, 1, 2, …} the range of f 1 2 3 4 the type of f 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? f(x) = 2 x g(x) = x/2 h(x, y) = x+y f: N N g: N R h: N N N

2. 4 Relations Let A be a set and n be a natural number.

2. 4 Relations 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: (3, 1) (1, 3) (6, 20) (12, 32) . . . (4, 4) (100, 39) < N N . . .

2. 5 Predicates; characteristic functions Throughout this course, by a predicate we will try

2. 5 Predicates; characteristic functions 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 An. 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, 1 if w P; p(w) = 0 if w P. Often we further identify predicates with their characteristic functions.

2. 6 Strings Alphabet --- a finite set of objects called the symbols of

2. 6 Strings 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 set of all strings over alphabet 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.

2. 7 What else you need You are expected to have some basic knowledge

2. 7 What else you need You are expected to have some basic knowledge and experience with: • Graphs • Mathematical definitions and proofs • Theory of computation • Logic