2.2 Coding and Counting Programs Flashcards

1
Q

How do we encode finite data structures into the natural numbers

A

Define a bijective function between something and N

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

While programs compute functions from …. to ….

A

Z^n→Z^m

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do we map Z to N?

A

2x if x ≥ 0

-2x - 1 else

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do we code pairs as single numbers?

A

∅(n,m) =2^n (2m+1) - 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do we code lists?

A

f[] = 0

f( s : l ) = 2^n(2f(l) + 1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do we show we can count (enumerate) while programs?

A

A bijection between while statements and N

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a Godel number?

A

given a while program S, γ(S) is its Godel number

γ: Stm → N

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The set of while programs is…

A

Countably infinite

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do we create a universal while program?

A

Write a program to compute the translations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly