Chapter 0 Introduction Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin October 2014
Automata Theory 2 of 22 Automata theory deals with the definitions and properties of mathematical models of computation. These models play a role in several applied areas of computer science. One model, called the finite automaton, is used in text processing, compilers, and hardware design. Another model, called the context-free grammar, is used in programming languages and artificial intelligence. Automata theory allows practice with formal definitions of computation as it introduces concepts relevant to other nontheoretical areas of computer science.
Computability Theory 3 of 22 There are certain basic problems cannot be solved by computers. One example of this phenomenon is the problem of determining whether a mathematical statement is true or false. In complexity theory, the objective is to classify problems as easy ones and hard ones; whereas in computability theory, the classification of problems is by those that are solvable and those that are not.
Complexity Theory 4 of 22 Computer problems come in different varieties; some are easy, and some are hard. For example, the sorting problem is an easy one. Say that you need to arrange a list of numbers in ascending order. Even a small computer can sort a million numbers rather quickly. Compare that to a scheduling problem. Say that you must find a schedule of classes for the entire university to satisfy some reasonable constraints, such as that no two classes take place in the same room at the same time. The scheduling problem seems to be much harder than the sorting problem. If you have just a thousand classes, finding the best schedule may require centuries, even with a supercomputer.
5 of 22 Math Notes and Terminology : Sets A set is a group of objects represented as a unit. Sets may contain any type of object, including numbers, symbols, and even other sets. The objects in a set are called its elements or members. For example, S = { 7, 21, 57} Where 7,21, and 57 are elements in set S. Therefore, 7 { 7, 21, 57} and 8 { 7, 21, 57} For two sets A and B, A B if every member of A also member of B. The set with 0 members is called the empty set or. For example, { n n = m 2 for some m N } means the set with perfect squares. (N for natural numbers). Union: A B ( combining all elements in A and B) Intersection: A B (a set of elements in A and B) Complement: A ( all elements are not in A)
6 of 22 Math Notes and Terminology: Sequences Sequence: is a list of objects in some order. Usually, a sequence designates by writing the list within parentheses. For example: Sq1=(7, 21, 57) Note: order and repetition don t matter in a set, but in a sequence they do. Sets and sequences may be finite or infinite. For example: (7,21,57) is not the same as (57,7,21) S1= {7,21,57}, S2 = {7,7,21,57} S1 and S2 are identical sets. Sq2=(7, 7, 21, 57) Sq1 and Sq2 are not the identical sequences.
7 of 22 Math Notes and Terminology: Tuples Tuple: is a finite sequence, a sequence with k elements is a k-tuple. For example: Sq1 is a 3-tuple Note: a 2-tuple is called an ordered pair. Note: sets and sequences may appear as elements of other sets of sequences. For example: the power set of A is the set of all subsets of A. let A = {0,1} therefore, the power set of A is {,{0},{1},{0, 1 }} the set of all ordered pairs whose elements are 0s and 1s is {(0, 0 ), ( 0, 1 ), ( 1, 0 ), ( 1, 1 )}
8 of 22 Math Notes and Terminology: Cartesian Product Cartesian Product: (A B), is a set of all ordered pairs wherein the first element is a member of A and the second element is a member of B. Example 1 Let A={1, 2 } and B={x, y, z } then A B= { ( 1, x ), ( 1, y ), ( 1, z ), ( 2, x ), ( 2, y ), ( 2, z ) } A B A = { ( 1, x, 1 ), ( 1, x, 2 ), ( 1, y, 1 ), ( 1, y, 2 ), ( 1, z, 1 ), ( 1, z, 2 ), ( 2, x, 1 ), ( 2, x, 2 ), ( 2, y, 1 ), ( 2, y, 2 ), ( 2, z, 1 ), ( 2, z, 2 )} Note: if we have the Cartesian product of a set with itself, thus Example 2 The set N 2 equal N N, it consist of all ordered pairs of natural numbers; {{i, j ) i, j 1 }
Math Notes and Terminology: Functions and Relations Function: is an object that sets up an input-output relationship. A function takes an input and produces an output. f(a) = b Mapping: if f(a)=b, then f maps a to b. Domain: is a set of possible inputs to the function. Range: the outputs of a function come from a set. For example, f: D R : f is a function with domain D and range R Example 3 This function adds 1 to its input and then outputs the result modulo 5. 9 of 22
10 of 22 Math Notes and Terminology: Graphs A graph (or undirected graph): is a set of points with lines connecting some of the points. Nodes (or vertices): are points in the graph. Edges: are lines in the graph, no more than one edge is allowed between any two nodes. Degree: is the number of edges at a particular node. Note: if V is the set of nodes of G and E is the set of edges, then G=(V,E). For example: All nodes have degree 2 all nodes have degree 3
11 of 22 Math Notes and Terminology: Graphs Example: Describe the following graphs For graph (a) All nodes have degree 2 G= ( V, E ) = ( { 1, 2, 3, 4, 5 },{(1, 2 ), ( 2, 3 ), ( 3, 4 ), ( 4, 5 ), ( 5, 1 ) } ) For graph (b) All nodes have degree 3 G= ( V, E ) = ( { 1, 2, 3, 4 },{(1, 2 ), ( 1, 3 ), ( 1, 4 ), ( 2, 3 ), ( 2, 4 ), ( 3, 4 ) } )
12 of 22 Math Notes and Terminology: Graphs Path: is a sequence of nodes connected by edges A graph is connected if every two nodes have a path between them A path is cycle if it starts and ends in the same node A path is a tree if it is connected and has no simple cycles The nodes of a degree 1 in a tree, other than the root, are called leaves of the tree. a path in a graph a cycle in a graph a tree in a graph
13 of 22 Math Notes and Terminology: Graphs Directed graph: is a graph which has paths with arrows. Note: in a directed graph, an edge from i to j is represented as pair(i,j) Example: Consider the following graph G= ( V, E ) =({1, 2, 3, 4, 5, 6 },{(1, 2 ), ( 1, 5 ), ( 2, 1 ), ( 2, 4 ), ( 5, 4 ), ( 5, 6 ), ( 6, 1 ), ( 6, 3 ) } )
14 of 22 Math Notes and Terminology: Strings and Languages Alphabet : is any nonempty finite set. Symbol: is the member of the alphabet. Note: 1. Strings of characters are fundamental building blocks in computer science. 2. Greek letters and are used to designate alphabets and a typewrite font from symbols from an alphabet. 1 = { 0, 1 } 2 = { a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z } = { 0, 1, x, y, z } String over an alphabet: is a finite sequence of symbols from that alphabet usually written next to one another and not separated by commas. For example: 01001 is a string over 1, and abracadabra is a string over 2.
Math Notes and Terminology: Strings and Languages Length of string : is the number of symbols that the string contains. w is the length of string w over alphabet Empty string : is the string with length zero. The empty string represents 0 in a number system. Example: for w with length n, then w = w 1 w 2 w 3 w n where w i and reverse of w is w n w n-1 w n-2 w 1 Note: String z is substring of w if z appears consecutively within w such, cad is a substring of abracadabra Concatenation: is the string obtained by appending string y to the end of string x. such, string x with length m, string y with length n, then concatenation xy is x 1 x m y 1 y n Note: x k is a string concatenated with itself 15 of 22
Math Notes and Terminology: Strings and Languages 16 of 22 Example : What is the string ordering of all strings over the = {0,1}? Answer: (, 0, 1, 00, 01, 10, 11, 000, )
17 of 22 Math Notes and Terminology: Boolean Logic NOT ( ): negation AND ( ): conjunction OR ( ) : disjunction XOR ( ):exclusive or Equality ( ) Implication ( )
18 of 22 Math Notes and Terminology: Exercises Exercise 1: Name the following sets 1. S1= { 1, 3, 5, 7, } 2. S2 = { n n = 2 m f o r s o me m in N} where N is natural number Answer: 1. Odd natural number 2. S2={2, 4, 6, 8,..} even natural numbers Exercise 2: Write the formal description of the set containing the numbers 1, 10, and 100. Answer: S = {1, 10, 100}
19 of 22 Math Notes and Terminology: Exercises Exercise 3: Let A = { x, y, z }, and B={x, y }. Find A B and A B. Answer: A B = { x, y } A B = {(x, x ), ( x, y ), ( y, x ), ( y, y ). ( z, x ), ( z, y )}
20 of 22 Math Notes and Terminology: Exercises Exercise 4: Let X = {1,2,3,4,5}, and Y={6,7,8,9,10}. The unary function f:x Y and the binary function g: X X Y are described in the following tables 1. What are the range and domain of f? 2. What is the value of g(4,f(4))? Answer 1. the domain is X and the range is Y 2. g(4,7) = 8
21 of 22 Math Notes and Terminology: Exercises Exercise 5: Describe the following graph Answer The graph is the directed graph V = {0,1,2,3,4,5,6} E={(0, 2), (0, 4), (0, 5), (1, 0), (2, 1), (2, 5), (3, 1), (3, 6), (4, 0), (4, 5), (6, 3), (6, 5)}
22 of 22 End of Chapter 0! Questions?