Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

1,122 views

Published on

2) Every primitive recursive function is computable

3) Showing functions to be primitive recursive

No Downloads

Total views

1,122

On SlideShare

0

From Embeds

0

Number of Embeds

251

Shares

0

Downloads

0

Comments

0

Likes

2

No embeds

No notes for slide

- 1. CS 5000: Theory of Computation Lecture 10 Vladimir Kulyukin Department of Computer Science Utah State University
- 2. Outline● Review● Class of Primitive Recursive Functions is Primitive Recursively Closed● Every Primitive Recursive Function is Computable● More Examples of Showing Functions to be Primitive Recursive
- 3. Review
- 4. Review: Initial Functions1. The successor function : s( x) = x + 12. The null function : n( x) = 03. The projection function : u ( x1 ,..., xn ) = xi ,1 ≤ i ≤ n n i
- 5. Review: Primitive Recursively Closed● A class of total functions C is a primitive recursively closed (PRC) class if – The initial functions are in C – Any function obtained from the functions already in C by composition or primitive recursion is also in C
- 6. Review: Class of Computable Functions is PRC• There are two parts to this proof: 1. The initial functions are computable so they satisfy the first condition of the PRC definition 2. We use theorems 1.1 (Ch. 3), 2.1 (Ch. 3), and 2.2 (Ch. 3) to show that any function that is obtained from the initial functions through composition, primitive recursion, or any combination thereof also computable: in other words, composition, primitive recursion, and any combination thereof preserves computability
- 7. Review: Primitive Recursive FunctionA function is called primitive recursive if it can be obtainedfrom the initial functions (successor, null constant, andprojection) by a finite number of applications of compositionor recursion
- 8. Review: Showing that a Function is P.R. There are two strategies:1. Obtain the function from the initial functions through composition or primitive recursion (first principles reasoning that works on fairly simple functions)2. Use the knowledge that some functions are already primitive recursive in combination with composition or primitive recursion (this is a more generic method)
- 9. Corollary 3.2 (Ch. 3)The class of primitive recursive functions is PRC
- 10. Proof 3.2● The three initial functions are trivially primitive recursive (because they obtained from themselves by zero applications of composition and recursion)● Any function obtained from the initial functions by a finite number of applications of composition and primitive recursion is primitive recursive, by definition● So the class of primitive recursive functions is PRC
- 11. Theorem 3.3 (Ch. 3)A function is primitive recursive if and only if it belongs to every PRC class
- 12. Proof 3.3• We need to show: 1. If a function is primitive recursive, it belongs to every PRC class 2. If a function belongs to every PRC class, it is primitive recursive
- 13. Proof 3.3 (Part 1)1. Assume that a function f is primitive recursive and let C be some PRC class2. f is either an initial function or is obtained from the initial functions by a finite number of applications of composition and primitive recursion3. If f is an initial function, it is in every PRC class, by definition, so f is in C4. If f is obtained from the initial functions by a finite number of applications of composition and primitive recursion. In other words, there is a list of functions f1, f2, …, fn, such that f = fn and each fi in the list is either initial function or is obtained from the initial functions by a finite number of compositions and recursions. Thus, since C is PRC, every f in the list, including f, is also in C
- 14. Proof 3.3 (Part 2)1. Assume that a function f belongs to every PRC class2. The class of primitive recursive functions is PRC3. Therefore, f must be in the class of primitive recursive functions, which makes it primitive recursive
- 15. Corollary 3.4 (Ch. 3)Every primitive recursive function is computable
- 16. Proof 3.41. Assume that f is primitive recursive2. By corollary Theorem 3.3 (Ch. 3), f is in every PRC class3. By Theorem 3.1 (Ch. 3), the class of computable functions is PRC4. Therefore, f is in the class of computable functions and is computable
- 17. Showing Functions to be Primitive Recursive
- 18. Example 1Show that f(x,y) = x · y is primitive recursive
- 19. Example 1● Basic insight: to compute x · y, add x to itself y times● Here are the recurrences from Definition 2 of primitive recursion: – f(x, 0) = 0 – f(x, t+1) = f(x, t) + x● Let us play with these recurrences: – f(2, 0) = 0. Works! – f(2, 1) = f(2, 0) + 2 = 0 + 2 = 2. Works! – f(3, 2) = f(3, 1) + 3 = f(3, 0) + 3 + 3 = 0 + 3 + 3 = 6. Works!
- 20. Example 1: Using Formal DefinitionBase Case :f ( x,0 ) = 0 becomes h( x,0 ) = n( x )
- 21. Example 1: Using Formal DefinitionRecursive Case :f ( x, t + 1) = f ( x, t ) + x becomesh( x, t + 1) = u ( t , h( x, t ) , x ) + x 3 2Or, more formally,h( x, t + 1) = g ( t , h( x, t ) , x ) , where ( 3 2 3 3 )g ( x1 , x 2 , x3 ) = f u ( x1 , x 2 , x3 ) , u ( x1 , x 2 , x3 ) , wheref ( x1 , x 2 ) = x1 + x 2
- 22. Example 1: Using Formal DefinitionCombining the base and recursive cases, we get :h ( x ,0 ) = n ( x )h( x, t + 1) = g ( t , h( x, t ) , x ) , where ( 3 2 3 3 )g ( x1 , x 2 , x3 ) = f u ( x1 , x 2 , x3 ) ,u ( x1 , x 2 , x3 ) , wheref ( x1 , x 2 ) = x1 + x 2
- 23. Example 1: Checking Our Solutionx ⋅ 0 : h( x,0 ) = n( x ) = 0 = x ⋅ 0 (x ⋅ 1 : h( x,0 + 1) = g ( 0, h( x,0 ) , x ) = f u ( 0, h( x,0 ) , x ) ,u ( 0, h( x,0 ) , x ) 3 2 3 3 )= h( x,0 ) + x = n( x ) + x = 0 + x = x ⋅ 1 (x ⋅ 2 : h( x,1 + 1) = g (1, h( x,1) , x ) = f u (1, h( x,1) , x ) ,u (1, h( x,1) , x ) 3 2 3 3 ) (= h( x,1) + x = g ( 0, h( x,0 ) , x ) + x = f u ( 0, h( x,0 ) , x ) ,u ( 0, h( x,0 ) , x ) 3 2 3 3 )+ x = h( x,0 ) + x + x = n( x ) + x + x = 0 + x + x = x ⋅ 2
- 24. Example 2Show that f(x) = x! is primitive recursive
- 25. Example 2● Basic insight: view x! as a composition of multiplication and s(x) both of which are primitive recursive● We use Definition 1 to write the recurrences: – f(0) = 1 – f(x+1) = s(x) · f(x)● Let us play with these recurrences: – f(0) = 1. Works! – f(1) = f(0+1) = s(0) · f(0) = 1 · 1 = 1. Works! – f(2) = f(1+1) = s(1) · f(1) = 2 · 1 = 2. Works!
- 26. Example 2: Using Formal DefinitionBase Case :f ( 0 ) = 0 becomes h( 0 ) = s ( n( x ) )
- 27. Example 1: Using Formal DefinitionRecursive Case :f ( x + 1) = s ( x ) ⋅ f ( x ) becomesh( x + 1) = g ( x, h( x ) ) , where g ( x1 , x 2 ) = f ( u12 ( x1 , x 2 ) , u 2 ( x1 , x 2 ) ) 2and f ( x1 , x 2 ) = s( x1 ) ⋅ x 2
- 28. Example 2: Using Formal DefinitionCombining the base and recursive cases, we get :h( 0 ) = s ( n( x ) )h( x + 1) = g ( x, h( x ) ) , where ( 2 1 )g ( x1 , x 2 ) = s u ( x1 , x 2 ) ⋅ u ( x1 , x 2 ) 2 2
- 29. Example 2: Checking Our Solution0!: h( 0 ) = s( n( x ) ) = s ( 0 ) = 1 ( )1!: h( 0 + 1) = g ( 0, h( 0 ) ) = s u 1 ( 0, h( 0 ) ) ⋅ u 2 ( 0, h( 0 ) ) = s ( 0 ) ⋅ h( 0 ) 2 2= 1⋅ 1 = 1 ( )2!: h(1 + 1) = g (1, h(1) ) = s u 1 (1, h(1) ) ⋅ u 2 (1, h(1) ) = s (1) ⋅ h(1) 2 2= 2⋅1= 2 ( )3!: h( 2 + 1) = g ( 2, h( 2 ) ) = s u 1 ( 2, h( 2 ) ) ⋅ u 2 ( 2, h( 2 ) ) = 2 2s ( 2 ) ⋅ h( 2 ) = 3 ⋅ 2 = 6
- 30. Reading Suggestions nd● Ch. 3, Computability, Complexity, and Languages, 2 Edition, by Davis, Weyuker, Sigal
- 31. FeedbackErrors, comments to vladimir.kulyukin@gmail.com

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment