1 / 17

Turing Machines for Functions: Recursive Functions and Homework Examples

This text provides an overview of Turing machines that compute functions, focusing on recursive functions and examples for addition, multiplication, and proper subtraction. The text also explores the concepts of composition, primitive recursion, and minimalization.

dmclaughlin
Télécharger la présentation

Turing Machines for Functions: Recursive Functions and Homework Examples

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computability Turing machines for functions. Recursive functions. Homework: Modify class example for addition to produce contiguous 1s. Construct TM for multiplication. If we don't finish in class: show multiplication is recursive and show proper subtraction is recursive.

  2. Turing machine for functions • Up until now, our TM had input a string and either accepted or rejected or did not halt. • A variation of TM is to have TM compute functions (stick to natural numbers to natural numbers) • input be representation of a natural number (0, 1, 2, …): 1 stands for 0, 11 stands for 1, (n+1) 1s stand for n. • When TM stops, the number of 1s on the tape is the answer. No 1s represents 0, n 1s represent n.

  3. Generalization • Functions on vectors to vectorsF(n, m) → (v, w, z) • Use blanks in-between or use a special symbol, such as comma or $.

  4. Examples • F(n) = nJob of TM is to erase one 1. S0 reading a 1, writes a blank, and changes to S1, which is a final state. No more action. • F(n) = 1Job is to erase all but one 1. S0 reading a 1, moves right, changes to S1. S1 reads a 1, writes a blank, moves right. S1 reading a blank, changes to S2, a final state.

  5. Examples • F(n,m) = n+m. Assume representation has blank in-between two inputs.Job is to erase two 1s from initial representation. S0 read 1, write a blank, go right, change to S1. S1 read 1, go right. S1 read blank, change to S2, go right. S2 read 1, write a blank, change to S3. S3 final. • NOTE: an improved version would be to make the answer be 1 contiguous string of 1s, starting at the left hand end of the tape. HOMEWORK!

  6. Switch: Recursive functions • [More] mathematical type of definition. • The recursive functions are a set of functions defined using a starter set and allowing any functions that can be defined using a finite number of applications of composition, primitive recursion, and minimalization (will define the last two)

  7. Starter set • Identity F(x) = x This is special case ofProjections Uin(x1, x2,…,xn) = xi • Successor S(x) = x+1 • Constant Fc(x) = c

  8. Composition • Given F and G, FG (x) = F(G(x))

  9. Primitive recursion • Motivation similar to mathematical induction, definition of factorial, exponentiation. • Have definition for the zero case. Have way for building. • x0 = 1x(n+1) = xn * x

  10. Primitive recursion • Given functions f: N → N and g: (N,N,N) →N, then define h: (N,N) as follows h(x,0) = f(x) h(x,y+1) = g(x,y,h(x,y)) • You will see variations. For example, f: Nn and g: Nn+2

  11. Addition • Want h(x,y) = x+y. Can we do this using primitive recursion, that is, are there some simpler functionsLet f(x) = x. Then h(x,0) = f(x) = x = x+0 okay! • Working backwards, I need to define g so that h(x,y+1) = x+y+1 and h(x,y+1) = g(x,y,h(x,y)). Let g(x,y,z) = S(P33(x,y,z))

  12. Classwork • Do multiplication!

  13. Minimalization • Also think of it as inverse. If f(x) is recursive, then define g to be g(y) = min {x | f(x) = y} if any x exists. Otherwise, g(y) is undefined.

  14. Total versus partial • A function is total if it is defined for all its domain (in this case, the counting or natural numbers). • A function is partial if it is defined for some, possibly all, of its domain.

  15. Classwork/Homework • Define (proper) subtraction, if x >= y, then B(x,y) = x-y. If x < y, then B(x,y) undefined. • Show B(x,y) is recursive.Hint: two-steps: define P(x) = x-1 if x>0, undefined otherwise. Show P(x) is recursive (using minimalization). THEN use P(x) to define B(x,y).

  16. Definition • The recursive functions are all functions that can be defined starting with the starter set and using a finite number of applications of composition, primitive recursion and minimalization. • A recursive function is total if it is defined for all of N.

  17. Claim • All functions implemented by Turing machines are recursive. • Harder direction. Use Godel numbering. Will not give complete proof. • All recursive functions can be implemented by a Turing machine. • Easier direction. • Build TM for starter sets. Need a fix-up function to get things in proper format for next step. • Describe process for doing composition, primitive recursion, and minimalization.

More Related