# CS 5000 Lecture 1 by chenshu

VIEWS: 3 PAGES: 19

• pg 1
```									  CS 5000: Lecture 37

Department of Computer Science
Utah State University
Outline
• A Computational Theory of Simulation
Review: Universality Theorem

Theorem 3.1(Universality Theorem): For each n  0,
the function Φ ( n ) x1 ,...,xn , y  is partially computable.
Review: Snapshots

s  (i,  ), 1  i  n  1.
i is the number of the instruction to be executed.
 is a state of the program.
s is terminal if i  n  1.
Step-Counter Predicate

STP( n )  x1 ,...,xn , y, t 
1. Program y halts on inputs x1 ,...,xn in
t or fewer steps.
2. There is a computation of program
y on inputs x1 ,...,xn such that
the length of that computation is  t  1.
Theorem 3.2 (Ch. 4):
Step-Counter Theorem

For n  0, the predicate STP( n) x1 ,...,xn , y, t 
is primitive recursive.
Proof 3.2

i,   is encoded as      i, z .
Z  0, x1 ,0, x2 ,....
Proof 3.2: Extracting Instruction
Components
Let y be a program number.Then y  1
is the number of its sourcecode.So
 y  1i    a, b, c . Then wehave :

LABEL i, y   l  y  1i .
VAR i, y   r r  y  1i   1.
INSTRi, y   l r  y  1i .

LABEL' i, y   l r  y  1i   2.
Proof 3.2: Skipping Instruction

Let x  i, z be a snapshot.

When should weskip the next instruction?
1. When it is of the typeV  V and its
number is  the length of the program.
2. When it is of the type IFV  0 GOTO L
and V  0.
Proof 3.2: Skipping Instruction

Let x  i, z be a snapshot.

When should weskip the next instruction?
1. When it is of the typeV  V and its
number is  the length of the program.

INSTRl  x , y   0 & l  x   Lt  y  1.
Proof 3.2: Skipping Instruction

Let x  i, z be a snapshot.

When should weskip the next instruction?
2. When it is of the type IFV  0 GOTO L
and V  0 or it is of the typeV  V  1
and V  0. Formally, we have :

INSTRl x , y   2 &  pVARl  x , y  | r x 
Proof 3.2: Skipping Instruction

Let x  i, z be a snapshot.

When should weskip the next instruction?

SKIPx, y  
INSTRl x , y   0 & l x   Lt y  1
INSTRl x , y   2 &  pVARl  x , y  | r x .
Proof 3.2: Increment, Decrement,
Branch
Let x  i, z be a snapshot.

INCR x, y   INSTRl  x , y   1.
DECR x, y   INSTRl  x , y   2 &
pVARl  x , y  | r  x .
BRANCH x, y  
INSTRl x , y   2 &
pVARl  x , y  | r x  &
i  Lt  y 1 LABEL i, y   LABEL' l x , y .
Proof 3.2: Successor State

 l x   1, r x  , if SKIPx, y 

 l x   1, r x   pVARl  x , y  , if INCRx, y 

 l x   1, r x  / pVARl  x , y   , if DECR x, y 

SUCC x, y   
 min LABEL i, y   LABEL' l x  y , r x  ,
 i  Lt  y 1
if BRANCH x, y 

 Lt  y  1  1, r x  , otherwise.

Proof 3.2: Initial Snapshot

n
INIT(n)
x1 ,...,xn     1,   p2i 
Xi

i 1
Proof 3.2: Terminal Snapshot

TERM x, y   l x   Lt  y  1
Proof 3.2: Snapshots

SNAP n   x1 ,..., xn , y,0   INIT n   x1 ,..., xn 
SNAP n   x1 ,..., xn , y, i  1 
SUCC SNAP         n 
x1 ,..., xn , y, i , y 
Proof 3.2: Primitive Recursiveness

STP x1 ,...,xn , y, t  
n 

TERMSNAP x1 ,...,xn , y, t , y 
n 