theory of computation: lecture 11
DESCRIPTION
1) Showing functions to be primitive recursive 2) Primitive recursive predicates 3) Computable predicates 4) Compound predicates 5) Class home page is at http://vkedco.blogspot.com/2011/08/theory-of-computation-home.htmlTRANSCRIPT
CS 5000: Theory of Computation
Lecture 11
Vladimir KulyukinDepartment of Computer Science
Utah State University
Outline● Review● More Examples of Showing Functions to be Primitive
Recursive● Primitive Recursive Predicates● Compound Predicates
Review
Review: X! is Primitive Recursive
( ) ( )( )
( ) ( )( )
( ) ( )( ) ( )212221
2121 ,,,
where,,1
0
xxuxxusxxg
xhxgxh
xnsh
⋅=
=+
=
More Examples of Showing Functions to be Primitive Recursive
Example 1
Show that xy is primitive recursive.
Example 1
( )( ) xxxyxf
xxfyy ⋅==+
==+ 1
0
1,10,
Example 1
( ) ( ) ( )( )
( ) ( ) ( )( )( ) ( ) ( )321
33321
32321 ,,,,,, where
,,,,1, becomes 1,:Case cursiveRe
0, becomes 00,:Case Base
xxxuxxxuxxxgxyxhygyxhyxf
xnsxhxf
⋅==++
==
Example 1: Checking Our Solution
( ) ( )( )
( ) ( )( ) ( )( ) ( )( )( )
( ) ( )( ) ( )( ) ( )( )( ) 2
33
32
33
32
1,
,1,,1,1,,1,1,,111,
10,,0,,0,0,,0,0,,010,
10,
xxxxxhxxhuxxhuxxhgxh
xxxxhxxhuxxhuxxhgxh
xnsxh
=⋅=⋅
=⋅==+
=⋅=⋅=⋅==+
==
Example 2
( ) 1 if 10 if 0
:recursive primitive isfunction r predecesso that theShow
>−=
=xxx
xp
Example 2
( )( )
( )( ) ( )( )( ) ( ) ,,
where,,100
:derivation Formal
100
:insight Informal
212121 xxuxxgthtgth
h
ttpp
==+
=
=+=
Example 3
( )
( ) ( )
( ) ( )
( )( )xppxpp
xpxpx
xpxpx
yxpyx
xx
=
−
=
+−=
−=+−
=
−=+−
−=+−
=−
•
•••
••
••
•
0
10111
010
1
0
recursive primitive isfunction minusdot that theShow
Example 3
( )( )( ) ( )( ) ( )
( ) 230313
0012
02122232
==
−=−
===
=
−=
−=
−=−
••
••••
pp
pppppp
pppppp
Example 4
Show that |x-y| is primitive recursive
Example 4
−+
−=−
−
+
••
•
xyyxyx3.
recursive primitive is .2
recursive primitive is .1
Primitive Recursive Predicates
Example 5
≠=
=0 if 00 if 1
)(
recursive primitive is )( that Show
xx
x
x
α
α
Example 5
( )( ) ( )( ) ( ) ( )121 , where,,1
10:srecurrence Formal
0)1(1)0(
:srecurrence Informal
xnxxgthtgthh
t
==+=
=+=
αα
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
Example 6
xx•−= 1)(
:solutionelegant moreA
α
Primitive Recursive Predicate 1
Show that x = y is primitive recursive.
Primitive Recursive Predicate 1
( )
≠=
=yxyx
yxd if 0 if 1
,
Primitive Recursive Predicate 1
( )( ) ( )||,
because recursive, primitive is ,yxyxd
yxd−= α
Primitive Recursive Predicate 2
Show that x ≤ y is primitive recursive
Primitive Recursive Predicate 2
( ) 1 ifonly and if 0 ifonly and if
=−=−
≤
yxyxyx
α
Theorem 5.1 (Ch. 3): Compound Predicates
.& and ,, are so then, tobelong that predicates
are , If class. PRC a be Let
QPQPPCQPC
∨¬
Proof 5.1 (Ch. 3)
( )
( )QPQPQPQP
PP
¬∧¬¬=∨⋅=∧
=¬
.3 .2 .1 α
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
Corollary 5.2 (Ch. 3)
class. PRC a are functions recursive primitive because True,:Proof
.,, are so then ,predicates recursive primitive are and If :Claim
QPQPPQP
∨∧¬
Corollary 5.3 (Ch. 3)
class. PRC a are functions computable because True,:Proof
.,, are so then ,predicates computable are and If:Claim
QPQPPQP
∨∧¬
Primitive Recursive Predicate 3
recursive primitive is that Show yx <
Primitive Recursive Predicate 3
( )xyyx ≤¬< as same theis
Theorem 5.4 (Ch. 3): Definition by Cases
( ) ( ) ( )( )
( ) .,...,Then
otherwise. ,...,,..., if ,...,
,...,
Let . tobelong predicate theand , ,functions Let the class. PRC a be Let
1
1
111
Cxxf
xxhxxPxxg
xxf
CPhgC
n
n
nnn
∈
=
Proof 5.4 (Ch. 3)
( ) ( ) ( )( ) ( )( )nn
nnn
xxPxxhxxPxxgxxf
,...,,..., ,...,,...,,...,
11
111
α⋅+⋅=
Reading Suggestions
● Ch. 3, Computability, Complexity, and Languages, 2nd Edition, by Davis, Weyuker, Sigal
Feedback
Errors, comments to [email protected]