theory of computation (fall 2014): primitive recursively closed classes & definition by cases;...

32
Theory of Computation Primitive Recursively Closed Classes & Definition by Cases, Summations & Products, Bounded Quantification, Bounded Quantification & Primitive Recursive Predicates Vladimir Kulyukin www.vkedco.blogspot.com

Upload: vladimir-kulyukin

Post on 13-Dec-2014

193 views

Category:

Science


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Theory of Computation

Primitive Recursively Closed Classes & Definition by Cases, Summations & Products, Bounded

Quantification, Bounded Quantification & Primitive Recursive Predicates

Vladimir Kulyukin

www.vkedco.blogspot.com

Page 2: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Outline

● Primitive Recursively Closed Classes & Definition by Cases● Summations & Products● Bounded Quantification● Bounded Quantification & Primitive Recursive Predicates

Page 3: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Primitive Recursively Closed Classes & Definition by Cases

Page 4: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

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

xxh

xxPxxgxxf

CPhg

C

n

n

nnn

Page 5: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Proof 5.4 (Ch. 3)

nn

nnn

xxPxxh

xxPxxgxxf

,...,,...,

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

11

111

Recall that * and + have been shown to be primitive recursive and a primitive recursive function belongs to every PRC class. This is Theorem 3.3 (Ch. 3).

Page 6: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Interpretation of Theorem 5.4 (Ch. 3)

Theorem 5.4 (Ch. 3) shows that it is possible to write if-then-else statements from the functions that we have defined previously and we know to be in the same PRC class.

if ( P(x1, …, xn) ) { return g(x1, …, xn);

}else {

return h(x1, …, xn);}

Page 7: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Corollary 5.5 (Ch. 3)

.Then

otherwise. ,...,

,..., if ,...,

...

,..., if ,...,

,...,

Let .,..., all and 1 allfor

,0,...,,...,let and , to

belong ,..., predicates and ,,...,

functionsary -let class, PRC a be Let

1

11

1111

1

1

11

11

Cf

xxh

xxPxxg

xxPxxg

xxf

xxmji

xxPxxPC

PPhgg

nC

n

nmnm

nn

n

n

njni

mm

Page 8: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Proof 5.5 (Ch. 3)

otherwise ,...,

,..., if ,...,

...

,..., if ,...,

,...,

.1Consider 3). (Ch. 5.4 Theoremby trueisstatement

the,1 If .on induction by statement thisprove We

1

1111

1111

1

n

nmnm

nn

n

xxh

xxPxxg

xxPxxg

xxf

m

mm

Page 9: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Proof 5.5 (Ch. 3)

induction.by ,,...,Then

otherwise. ,...,

,..., if ,...,

...

,..., if ,...,

,...,

And 3). (Ch. 5.4 Theoremby ,,...,Then

otherwise. ,...,

,..., if ,...,,...,Let

:one as functions last two therewrite We

1

1''

11

1111

1

1''

1

11111

''

Cxxf

xxh

xxPxxg

xxPxxg

xxf

Cxxh

xxh

xxPxxgxxh

n

n

nmnm

nn

n

n

n

nmnmn

Page 10: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Corollary 5.5 (Ch. 3): Practical Interpretation We can write if-then-else-if statements from previously defined functions in the same PRC

class:

if ( P1(x1, …, xn) ) {return g1(x1, …, xn);

}else if ( P2(x1, …, xn) ) {

return g2(x1, …, xn);}…else {

return h(x1, …, xn);}

Page 11: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Summations & Products

Page 12: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Theorem 6.1 (Ch. 3)

.),...,,(),...,,(

and

),...,,(),...,,(

functions thedo sothen

,),...,,( If class. PRC a be Let

011

10

1

1

y

tnn

n

y

tn

n

xxtfxxyh

xxtfxxyg

CxxtfC

Page 13: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Proof 6.1

We can use the definition of the PRC class. We know that C is a PRC class. We know that f is in C. If we can derive g and h from f using composition and recursion, g and h will, by definition, be in C.

Page 14: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Proof 6.1 (Ch. 3)

).,...,,1(),...,,(),...,,1(

);,...,,0(),...,,0(

:,...,,,...,,for srecurrence the writeusLet

111

11

011

nnn

nn

y

tnn

xxtfxxtgxxtg

xxfxxg

xxtfxxyg

Page 15: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Proof 6.1 (Ch. 3)

),...,,1(),...,,(),...,,1(

),...,,0(),...,,0(

:),...,,(),...,,(for srecurrence the writenow usLet

111

11

011

nnn

nn

y

tnn

xxtfxxthxxth

xxfxxh

xxtfxxyh

Page 16: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Starting Summation at 1

),...,,1(),...,,(),...,,1(

0),...,,0(

:srecurrence adjust thecan We

.),...,,(),...,,(

:1at summingstart want to weSuppose

111

1

111

nnn

n

y

tnn

xxtfxxtgxxtg

xxg

xxtfxxyg

Page 17: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Starting Product at 1

),...,,1(),...,,(),...,,1(

1),...,,0(

:follows as srecurrence adjust thecan We

.),...,,(),...,,(

:1at productsstart want to that weSuppose

111

1

111

nnn

n

y

tnn

xxtfxxthxxth

xxh

xxtfxxyh

Page 18: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Corollary 6.2 (Ch. 3)

.),...,,(),...,,(

);,...,,(),...,,(

:functions thesedo sothen

PRC, is and ),...,,( If

111

11

1

1

y

tnn

n

y

tn

n

xxtfxxyh

xxtfxxyg

CCxxtf

Page 19: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Bounded Quantification

Page 20: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Bounded Universal Quantifier: Definition

.0for ,1,...,,

ifonly and if TRUE 1 is ,...,,

1

1

yixxiP

xxtPt

n

ny

Page 21: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Bounded Existential Quantifier: Definition

.,0 oneleast at for ,1,...,,

ifonly and if (TRUE) 1 is ,...,,

1

1

yixxiP

xxtPt

n

ny

Page 22: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Theorem 6.3 (Ch. 3)

).,...,,()( and ),...,,()( predicates thedo so

thenC, class PRC some tobelongs),...,,( predicate some If

11

1

nyny

n

xxtPtxxtPt

xxtP

Page 23: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Proof 6.3 (Ch. 3)

1,...,,),...,,()(

:follows asproduct theof terms

intion quantifica universal bounded definecan We

011

y

tnny xxtPxxtPt

Page 24: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Proof 6.3 (Ch. 3)

0,...,, ),...,,()(

:follows assummation theof terms

intion quantifica lexistentia bounded definecan We

011

y

tnny xxtPxxtPt

Page 25: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Corollary of Theorem 6.3 (Ch. 3)

.),...,,(&)()(),...,,(

;),...,,()(),...,,()(

:follows as

tionquantifica boundedstrict -non of in terms expressed becan it

because tion,quantifica boundedstrict for validis 6.3 Theorem

11

11

nyny

nyny

xxtPyttxxtPt

xxtPyttxxtPt

Page 26: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Bounded Quantification &

Primitive Recursiveness

Page 27: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Bounded Quantification & Primitive Recursiveness

● We can now use the results on bounded quantification to show even more functions to be primitive recursive

● Bounded quantification furnishes us iterative tools that we can use to check if a predicate is true for every number in a range or for some number in a range

● We can also use the negation of a bounded quantified statement to show that there is no number for which some predicate is true

Page 28: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Y | X is Primitive Recursive

recursive primitive

is ) ofdivisor a is or divides ( | that Show xyxyxy

Page 29: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Y | X is Primitive Recursive

xtytxy x |

Page 30: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

prime(x) is Primitive Recursive

.|1&1

)prime(

as expressed becan thisFormally, itself.

and 1 other than divisors no hasit and

1an greater th isit if prime isnumber A

xtxtttx

x

x

Page 31: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Longer List of Primitive Recursive Functions

.

8.

,lcm 15. 7.

,gcd 14. 6.

prime 13. 5.

| 12. 4.

11. ! 3.

10. 2.

9. .1

x

yxyx

yxyx

xxp

yxx

yxx

yxyx

yxyx

y

Page 32: Theory of Computation (Fall 2014): Primitive Recursively Closed Classes & Definition by Cases; Summation & Products; Bounded Quantification; Bounded Quantification & Primitive Recursive

Reading Suggestions

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