Upcoming SlideShare
×

# Theory of Computation: Lecture 11: Primitive Recursive & Computable Predicates

914 views
849 views

Published on

1) Showing functions to be primitive recursive
2) Primitive recursive predicates
3) Computable predicates
4) Compound predicates

Published in: Science, Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
914
On SlideShare
0
From Embeds
0
Number of Embeds
268
Actions
Shares
0
3
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Theory of Computation: Lecture 11: Primitive Recursive & Computable Predicates

1. 1. CS 5000: Theory of Computation Lecture 11 Vladimir Kulyukin Department of Computer Science Utah State University
2. 2. Outline● Review● More Examples of Showing Functions to be Primitive Recursive● Primitive Recursive Predicates● Compound Predicates
3. 3. Review
4. 4. Review: X! is Primitive Recursiveh( 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
5. 5. More Examples of Showing Functions to be Primitive Recursive
6. 6. Example 1Show that xy is primitive recursive.
7. 7. Example 1f ( x ,0 ) = x = 1 0f ( x, y + 1) = x y+ 1 = x ⋅x y
8. 8. Example 1Base Case :f ( x,0 ) = 0 becomes h( x,0 ) = s ( n( x ) )Re cursive Case :f ( x, y + 1) becomes h( x, y + 1) = g ( y , h( x, y ) , x ) ,where g ( x1 , x 2 , x3 ) = u ( x1 , x 2 , x3 ) ⋅ u ( x1 , x 2 , x3 ) 3 2 3 3
9. 9. Example 1: Checking Our Solutionh ( x ,0 ) = s ( n ( x ) ) = 1h( x,0 + 1) = g ( 0, h( x,0 ) , x ) = u 2 ( 0, h( x,0 ) , x ) ⋅ u 3 ( 0, h( x,0 ) , x ) = 3 3h ( x ,0 ) ⋅ x = 1 ⋅ x = xh( x,1 + 1) = g (1, h( x,1) , x ) = u 2 (1, h( x,1) , x ) ⋅ u 3 (1, h( x,1) , x ) = 3 3h( x,1) ⋅ x = x ⋅ x = x 2
10. 10. Example 2Show that the predecessor function is primitive recursive : 0 if x = 0p( x ) =   x − 1 if x > 1
11. 11. Example 2Informal insight :p( 0) = 0p ( t + 1) = tFormal derivation :h( 0 ) = 0h( t + 1) = g ( t , h( t ) ), whereg ( x1 , x 2 ) = u12 ( x1 , x 2 )
12. 12. Example 3Show that the dot minus function is primitive recursive •x− 0 = x •  • x − ( y + 1) = p x − y    •  • x − ( 0 + 1) = p x − 0  = p( x )   •  •   • x − (1 + 1) = p x − 1 = p x − ( 0 + 1)  =       • p p x − 0   = p( p( x ) )   
13. 13. Example 3 •  •    •     • 2 − 3 = p 2 − 2  = p p 2 − 1  = p p  p 2 − 0   =          p( p( p( 2) ) ) = p ( p (1) ) = p ( 0 ) = 0 •  • 3 − 1 = p 3 − 0  = p ( 3) = 2  
14. 14. Example 4Show that |x-y| is primitive recursive
15. 15. Example 41. + is primitive recursive •2. − is primitive recursive  •   • 3. x − y =  x − y  +  y − x    
16. 16. Primitive Recursive Predicates
17. 17. Example 5Show that α ( x) is primitive recursive  1 if x = 0α ( x) =   0 if x ≠ 0
18. 18. Example 5Informal recurrences :α ( 0) = 1α (t + 1) = 0Formal recurrences :h( 0 ) = 1h( t + 1) = g ( t , h( t ) ) , where g ( x1 , x 2 ) = n( x1 )
19. 19. Motivation● Predicates are Boolean-valued functions – 1 is TRUE – 0 is FALSE● Since predicates are functions, it makes sense for us to ask which predicates are primitive recursive● It makes sense for us to build a repository of primitive recursive predicates
20. 20. Example 6A more elegant solution : •α ( x) = 1 − x
21. 21. Primitive Recursive Predicate 1Show that x = y is primitive recursive.
22. 22. Primitive Recursive Predicate 1  1 if x = yd ( x, y ) =   0 if x ≠ y
23. 23. Primitive Recursive Predicate 1d ( x, y ) is primitive recursive, becaused ( x , y ) = α ( | x − y |)
24. 24. Primitive Recursive Predicate 2Show that x ≤ y is primitive recursive
25. 25. Primitive Recursive Predicate 2x≤ y if and only ifx − y = 0 if and only if α ( x − y) = 1 
26. 26. Theorem 5.1 (Ch. 3): Compound Predicates Let C be a PRC class. If P, Q are predicates that belong to C , then so are ¬ P, P ∨ Q, and P & Q.
27. 27. Proof 5.1 (Ch. 3)1. ¬ P = α ( P )2. P ∧ Q = P ⋅ Q3. P ∨ Q = ¬ ( ¬ P ∧ ¬ Q )
28. 28. Theorem 5.1 (Ch. 3): Corollaries● Recall that we have shown that the classes of primitive recursive and computable functions are primitive recursively closed● Theorem 5.1 furnishes us with two important corollaries that help us reason about computational properties of compound predicates
29. 29. Corollary 5.2 (Ch. 3)Claim : If P and Q are primitive recursive predicates, then so are¬ P, P ∧ Q, P ∨ Q.Proof : True, because primitive recursive functions are a PRC class.
30. 30. Corollary 5.3 (Ch. 3)Claim : If P and Q are computable predicates, then so are¬ P, P ∧ Q, P ∨ Q.Proof : True, because computable functions are a PRC class.
31. 31. Primitive Recursive Predicate 3Show that x < y is primitive recursive
32. 32. Primitive Recursive Predicate 3x < y is the same as ¬ ( y ≤ x )
33. 33. Theorem 5.4 (Ch. 3): Definition by CasesLet C be a PRC class. Let the functionsg , h, and the predicate P belong to C. Let  g ( x1 ,..., xn ) if P ( x1 ,..., xn )f ( x1 ,..., xn ) =   h( x1 ,..., xn ) otherwise.Then f ( x1 ,..., xn ) ∈ C.
34. 34. Proof 5.4 (Ch. 3)f ( x1 ,..., x n ) = g ( x1 ,..., x n ) ⋅ P( x1 ,..., x n ) + h( x1 ,..., x n ) ⋅ α ( P( x1 ,..., x n ) )
35. 35. Reading Suggestions nd● Ch. 3, Computability, Complexity, and Languages, 2 Edition, by Davis, Weyuker, Sigal