theory of computation: lecture 11

36
CS 5000: Theory of Computation Lecture 11 Vladimir Kulyukin Department of Computer Science Utah State University

Upload: vladimir-kulyukin

Post on 01-Jul-2015

734 views

Category:

Education


4 download

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.html

TRANSCRIPT

Page 1: Theory of Computation: Lecture 11

CS 5000: Theory of Computation

Lecture 11

Vladimir KulyukinDepartment of Computer Science

Utah State University

Page 2: Theory of Computation: Lecture 11

Outline● Review● More Examples of Showing Functions to be Primitive

Recursive● Primitive Recursive Predicates● Compound Predicates

Page 3: Theory of Computation: Lecture 11

Review

Page 4: Theory of Computation: Lecture 11

Review: X! is Primitive Recursive

( ) ( )( )

( ) ( )( )

( ) ( )( ) ( )212221

2121 ,,,

where,,1

0

xxuxxusxxg

xhxgxh

xnsh

⋅=

=+

=

Page 5: Theory of Computation: Lecture 11

More Examples of Showing Functions to be Primitive Recursive

Page 6: Theory of Computation: Lecture 11

Example 1

Show that xy is primitive recursive.

Page 7: Theory of Computation: Lecture 11

Example 1

( )( ) xxxyxf

xxfyy ⋅==+

==+ 1

0

1,10,

Page 8: Theory of Computation: Lecture 11

Example 1

( ) ( ) ( )( )

( ) ( ) ( )( )( ) ( ) ( )321

33321

32321 ,,,,,, where

,,,,1, becomes 1,:Case cursiveRe

0, becomes 00,:Case Base

xxxuxxxuxxxgxyxhygyxhyxf

xnsxhxf

⋅==++

==

Page 9: Theory of Computation: Lecture 11

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

=⋅=⋅

=⋅==+

=⋅=⋅=⋅==+

==

Page 10: Theory of Computation: Lecture 11

Example 2

( ) 1 if 10 if 0

:recursive primitive isfunction r predecesso that theShow

>−=

=xxx

xp

Page 11: Theory of Computation: Lecture 11

Example 2

( )( )

( )( ) ( )( )( ) ( ) ,,

where,,100

:derivation Formal

100

:insight Informal

212121 xxuxxgthtgth

h

ttpp

==+

=

=+=

Page 12: Theory of Computation: Lecture 11

Example 3

( )

( ) ( )

( ) ( )

( )( )xppxpp

xpxpx

xpxpx

yxpyx

xx

=

=

+−=

−=+−

=

−=+−

−=+−

=−

•••

••

••

0

10111

010

1

0

recursive primitive isfunction minusdot that theShow

Page 13: Theory of Computation: Lecture 11

Example 3

( )( )( ) ( )( ) ( )

( ) 230313

0012

02122232

==

−=−

===

=

−=

−=

−=−

••

••••

pp

pppppp

pppppp

Page 14: Theory of Computation: Lecture 11

Example 4

Show that |x-y| is primitive recursive

Page 15: Theory of Computation: Lecture 11

Example 4

−+

−=−

+

••

xyyxyx3.

recursive primitive is .2

recursive primitive is .1

Page 16: Theory of Computation: Lecture 11

Primitive Recursive Predicates

Page 17: Theory of Computation: Lecture 11

Example 5

≠=

=0 if 00 if 1

)(

recursive primitive is )( that Show

xx

x

x

α

α

Page 18: Theory of Computation: Lecture 11

Example 5

( )( ) ( )( ) ( ) ( )121 , where,,1

10:srecurrence Formal

0)1(1)0(

:srecurrence Informal

xnxxgthtgthh

t

==+=

=+=

αα

Page 19: Theory of Computation: Lecture 11

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

Page 20: Theory of Computation: Lecture 11

Example 6

xx•−= 1)(

:solutionelegant moreA

α

Page 21: Theory of Computation: Lecture 11

Primitive Recursive Predicate 1

Show that x = y is primitive recursive.

Page 22: Theory of Computation: Lecture 11

Primitive Recursive Predicate 1

( )

≠=

=yxyx

yxd if 0 if 1

,

Page 23: Theory of Computation: Lecture 11

Primitive Recursive Predicate 1

( )( ) ( )||,

because recursive, primitive is ,yxyxd

yxd−= α

Page 24: Theory of Computation: Lecture 11

Primitive Recursive Predicate 2

Show that x ≤ y is primitive recursive

Page 25: Theory of Computation: Lecture 11

Primitive Recursive Predicate 2

( ) 1 ifonly and if 0 ifonly and if

=−=−

yxyxyx

α

Page 26: Theory of Computation: Lecture 11

Theorem 5.1 (Ch. 3): Compound Predicates

.& and ,, are so then, tobelong that predicates

are , If class. PRC a be Let

QPQPPCQPC

∨¬

Page 27: Theory of Computation: Lecture 11

Proof 5.1 (Ch. 3)

( )

( )QPQPQPQP

PP

¬∧¬¬=∨⋅=∧

.3 .2 .1 α

Page 28: Theory of Computation: Lecture 11

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

Page 29: Theory of Computation: Lecture 11

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

∨∧¬

Page 30: Theory of Computation: Lecture 11

Corollary 5.3 (Ch. 3)

class. PRC a are functions computable because True,:Proof

.,, are so then ,predicates computable are and If:Claim

QPQPPQP

∨∧¬

Page 31: Theory of Computation: Lecture 11

Primitive Recursive Predicate 3

recursive primitive is that Show yx <

Page 32: Theory of Computation: Lecture 11

Primitive Recursive Predicate 3

( )xyyx ≤¬< as same theis

Page 33: Theory of Computation: Lecture 11

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

=

Page 34: Theory of Computation: Lecture 11

Proof 5.4 (Ch. 3)

( ) ( ) ( )( ) ( )( )nn

nnn

xxPxxhxxPxxgxxf

,...,,..., ,...,,...,,...,

11

111

α⋅+⋅=

Page 35: Theory of Computation: Lecture 11

Reading Suggestions

● Ch. 3, Computability, Complexity, and Languages, 2nd Edition, by Davis, Weyuker, Sigal

Page 36: Theory of Computation: Lecture 11

Feedback

Errors, comments to [email protected]