Presentation is loading. Please wait.

Presentation is loading. Please wait.

 2004 SDU Introduction to the Theory of Computation My name: 冯好娣 My office: 计算中心 430

Similar presentations


Presentation on theme: " 2004 SDU Introduction to the Theory of Computation My name: 冯好娣 My office: 计算中心 430"— Presentation transcript:

1  2004 SDU Introduction to the Theory of Computation My name: 冯好娣 My office: 计算中心 430 Email: fenghaodi@sdu.edu.cn

2  2004 SDU 2 Text book: Introduction to the Theory of Computation, Michael Sipser, 机械工业出版社 References:  Martin, John C. Introduction to Languages and The Theory of Computation (3 rd edition), MC. GrawHill. 2003  Garey, Michael R. and Johnson, David S. Computers and Intractability: A guide to Theory of NP- completeness, W.H.Freeman 1979

3  2004 SDU 3 Grading Final exam 70% Homework 30%

4  2004 SDU Lecture one: Overview and Concepts

5  2004 SDU 5 What is this course about Why it is important Subject: The fundamental mathematical properties of computers (hardware, software and certain applications). Questions: What does computation mean? What can be computed and what can not? How quickly? With how much memory? On which type of machines?

6  2004 SDU 6 The three central areas of TOC The main question in TOC: What are the fundamental capabilities and limitations of computers? Each of the three central areas of TOC focuses on this question but interprets it differently. Automata Theory: What can be computed with different sorts of weak machines, such as Finite automata, Pushdown automata, etc.? Computability Theory: What can be computed with the strongest possible machines, such as Turing machines? Complexity Theory: How efficiently can things be computed, in particular, in how much Time, Space?

7  2004 SDU 7 Set Set-- Any collection of distinct objects (“elements”)  E ={1,2,3,…}; E ={x | x = 2y for some positive integer y}; E = {G | G is a spanning tree of graph F}; etc. a  A -- “a is an element of A” or “a is in A” a  A -- “a is not an element of A” or “a is not in A” S  T --- “S is a subset of T”, i.e., every element of S is also an element of T A  B -- “the union of A and B”, i.e., the set of objects that are in either A or B or both A  B -- “the intersection of A and B”, i.e., the set of objects that are in both A and B -- “The complement of a set A” contains exactly those elements under consideration that are not in A  -- “the empty set” P(S) --- “the power set of S” i.e. the set of all subsets of S

8  2004 SDU 8 Sequence, Tuple, Cartesian Product Sequence-- a list of objects in order. E.g., (7, 7, 21,35) is a sequence of natural numbers. n Tuple– a sequence of n elements. (2,3)—2 tuple (pair) (3,1,2)– 3 tuple (triple) Two n-tuples (a 1, a 2, a 3, …, a n ) and (b 1, b 2, b 3, …, b n ) are equal if and only if they contain exactly the same elements in the same order, i.e. a i = b i for 1  i  n. Cartesian product of two sets A and B is defined by A  B = {(a, b) | a  A and b  B} A  =  Similarly, S 1  S 2 ...  S n ={(s 1,s 2,…,s n ) | s 1  S 1, s 2  S 2, …, s n  S n } A k = A  A  …  A

9  2004 SDU 9 Function (mapping) 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, 5, 8.6, 1/3, 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 function

10  2004 SDU 10 Graphs Undirected graph: G=(V, E), where V is a set of nodes(vertices), and E is a set of edges, i.e., set of unordered pairs of nodes. Directed graph: edge is ordered. Path: sequence of nodes connected by edges. Simple path: no repeat of nodes Connected: each pair of nodes are connected by path Cycle: a path with same start and end points Tree: connected and acyclic Degree: # of edges incident with a specified node Leaves: nodes of a tree with degree one

11  2004 SDU 11 Strings and Languages An alphabet is a finite, nonempty set A of objects called symbols.   ={0,1},  ={a,b,c,d,…,z} A string over an alphabet A is a finite sequence of symbols from A.  000110 is a string over {0,1}, abcdefsssg is a string over {a,b,c,…} String length-- |w|, number of symbols in w. Empty string-- string with length zero.  Concatenation of strings x, y, written as xy-- the string obtained by appending y at the end of x  E.g., u = “monkey”, v = “business”, uv = “monkeybusiness” x k --- x x … x, i.e., to concatenate a string to itself many times. A substring of a string s-- a consectutive sequence withhin s. A Language (over alphabet  ) -- a set of strings (over  ).   * is the language consists of all the strings on . k

12  2004 SDU 12 Boolean logic A Boolean variable takes on one of 0 (FALSE) and 1 (TRUE). The negation of x, denoted by  x, is 1-x. We will use the following Boolean operators:    conjunction    disjunction    negation

13  2004 SDU 13 If and only if P if and only if Q, or P iff Q.  if: Q  P  Only if: P  Q

14  2004 SDU 14 Sets equality A = B  For each x  A  x  B  For each x  B  x  A

15  2004 SDU 15 Disproof by Counterexample A counterexample to  x P(x) is an object c so that P(c) is false. Statements such as  x (P(x)  Q(x)) can be disproved by simply providing a counterexample. Statement: “All birds can fly.” Disproved by counterexample: Penguin.

16  2004 SDU 16 Proof by construction To prove some special objects exist. Example: for each even number n greater than 2, there exists a 3-regular graph with n nodes.

17  2004 SDU 17 Proof by contradiction is irrational. Proof: otherwise, is rational. W.l.o.g, suppose, where m and n have no common divisors. Then:

18  2004 SDU 18 Induction The principle of mathematical induction is a useful tool for proving that a certain predicate is true for all natural numbers. If we have a propositional function P(n), and we want to prove that P(n) is true for any natural number n, we do the following: Show that P(1) is true. (basis step) Show that if P(n) then P(n + 1) for any n  N. (inductive step) Then P(n) must be true for any n  N. (conclusion)

19  2004 SDU 19 Induction Example (“Gauss”): P(n): 1 + 2 + … + n = n (n + 1)/2 1.Show that P(1) is true. (basis step) 2.Show that if P(n) then P(n + 1) for any n  N (inductive step) 1.If 1 + 2 + … + n = n (n + 1)/2 2.Then 1 + 2 + … + n + (n + 1) = n (n + 1)/2 + (n + 1) 3.= (2n + 2 + n (n + 1))/2 4.= (2n + 2 + n 2 + n)/2 5.= (2 + 3n + n 2 )/2 6.= (n + 1) (n + 2)/2 7.= (n + 1) ((n + 1) + 1)/2 3.Then P(n) must be true for any n  N (conclusion)


Download ppt " 2004 SDU Introduction to the Theory of Computation My name: 冯好娣 My office: 计算中心 430"

Similar presentations


Ads by Google