Fundamentele Informatica 3 voorjaar 2014 - - PowerPoint PPT Presentation

fundamentele informatica 3
SMART_READER_LITE
LIVE PREVIEW

Fundamentele Informatica 3 voorjaar 2014 - - PowerPoint PPT Presentation

Fundamentele Informatica 3 voorjaar 2014 http://www.liacs.nl/home/rvvliet/fi3/ Rudy van Vliet kamer 124 Snellius, tel. 071-527 5777 rvvliet(at)liacs(dot)nl college 15, 19 mei 2014 10. Computable Functions 10.3. G odel Numbering 10.4. All


slide-1
SLIDE 1

Fundamentele Informatica 3

voorjaar 2014 http://www.liacs.nl/home/rvvliet/fi3/ Rudy van Vliet kamer 124 Snellius, tel. 071-527 5777 rvvliet(at)liacs(dot)nl college 15, 19 mei 2014

  • 10. Computable Functions

10.3. G¨

  • del Numbering

10.4. All Computable Functions are µ-Recursive 10.5. Other Approaches to Computability

1

slide-2
SLIDE 2

A slide from lecture 13: Example 10.13. The nth Prime Number PrNo(0) = 2 PrNo(1) = 3 PrNo(2) = 5 Prime(n) = (n ≥ 2) ∧ ¬(there exists y such that y ≥ 2 ∧ y ≤ n − 1 ∧ Mod(n, y) = 0)

2

slide-3
SLIDE 3

A slide from lecture 13: Example 10.13. The nth Prime Number Let P(x, y) = (y > x ∧ Prime(y)) Then PrNo(0) = 2 PrNo(k + 1) = mP(PrNo(k), (PrNo(k))! + 1) is primitive recursive, with h(x1, x2) = . . .

3

slide-4
SLIDE 4

A slide from lecture 14: Definition 10.15. µ-Recursive Functions The set M of µ-recursive, or simply recursive, partial functions is defined as follows.

  • 1. Every initial function is an element of M.
  • 2. Every function obtained from elements of M by composition
  • r primitive recursion is an element of M.
  • 3. For every n ≥ 0 and every total function f : Nn+1 → N in M,

the function Mf : Nn → N defined by Mf(X) = µ y[f(X, y) = 0] is an element of M.

4

slide-5
SLIDE 5

A slide from lecture 14: Theorem 10.16. All µ-recursive partial functions are computable.

  • Proof. . .

5

slide-6
SLIDE 6

A slide from lecture 14: Definition 10.17. The G¨

  • del Number of a Sequence of Natural Numbers

For every n ≥ 1 and every finite sequence x0, x1, . . . , xn−1 of n natural numbers, the G¨

  • del number of the sequence is the

number gn(x0, x1, . . . , xn−1) = 2x03x15x2 . . . (PrNo(n − 1))xn−1 where PrNo(i) is the ith prime (Example 10.13).

6

slide-7
SLIDE 7

A slide from lecture 14: Example 10.18. The Power to Which a Prime is Raised in the Factorization of x Function Exponent : N2 → N defined as follows: Exponent(i, x) =

  • the exp. of PrNo(i) in x’s prime fact.

if x > 0 if x = 0

7

slide-8
SLIDE 8

Configuration of Turing machine determined by

  • state
  • position on tape
  • tape contents

8

slide-9
SLIDE 9

A slide from lecture 4: Assumptions:

  • 1. Names of the states are irrelevant.
  • 2. Tape alphabet Γ of every Turing machine T is subset
  • f infinite set S = {a1, a2, a3, . . .}, where a1 = ∆.

9

slide-10
SLIDE 10

A slide from lecture 4: Definition 7.33. An Encoding Function Assign numbers to each state: n(ha) = 1, n(hr) = 2, n(q0) = 3, n(q) ≥ 4 for other q ∈ Q. Assign numbers to each tape symbol: n(ai) = i. Assign numbers to each tape head direction: n(R) = 1, n(L) = 2, n(S) = 3.

10

slide-11
SLIDE 11

Now different numbering Let T = (Q, Σ, Γ, q0, δ) be Turing machine States: ha hr q0 . . . . 1 2 . . . sT with sT = . . . Tape symbols: ∆ . . . . . . . tsT with tsT = . . .

11

slide-12
SLIDE 12

Now different numbering Let T = (Q, Σ, Γ, q0, δ) be Turing machine States: ha hr q0 . . . . 1 2 . . . sT with sT = |Q| + 1 Tape symbols: ∆ . . . . . . . tsT with tsT = |Γ| tapenumber(∆ab∆a∆) = 20315270111130 . . . confignumber = 2q3P5tapenumber

12

slide-13
SLIDE 13

10.4. All Computable Functions are µ-Recursive

13

slide-14
SLIDE 14

We must show that f : Nn → N defined by f(X) = ResultT(fT(InitConfig(n)(X))) is µ-recursive.

14

slide-15
SLIDE 15

Step 1 The function InitConfig(n) : Nn → N

15

slide-16
SLIDE 16

Exercise 10.34. Show using mathematical induction that if tn(n)(x1, . . . , xn) is the tape number containing the string ∆1x1∆1x2∆ . . . ∆1xn then tn(n) : Nn → N is primitive recursive. Use nr(∆) = 0 and nr(1) = 1.

16

slide-17
SLIDE 17

Exercise 10.34. Show using mathematical induction that if tn(n)(x1, . . . , xn) is the tape number containing the string ∆1x1∆1x2∆ . . . ∆1xn then tn(n) : Nn → N is primitive recursive. Suggestion: In the induction step, show that tn(m+1)(X, xm+1) = tn(m)(X) ∗

xm+1

  • j=1

PrNo(m + m

i=1 xi + j)

Use nr(∆) = 0 and nr(1) = 1.

17

slide-18
SLIDE 18

Step 2 The predicate IsConfigT defined by IsConfigT(m) = (m is configuration number for T)

18

slide-19
SLIDE 19

Step 2 (continued) The function IsAcceptingT defined by IsAcceptingT(m) =

  • if m represents accepting config. of T

1

  • therwise

19

slide-20
SLIDE 20

Step 2 (continued) The function IsAcceptingT defined by IsAcceptingT(m) =

  • if IsConfigT(m) ∧ Exponent(0, m) = 0

1

  • therwise

20

slide-21
SLIDE 21

Step 3 The function ResultT. . .

21

slide-22
SLIDE 22

Step 3 The function ResultT ResultT(m) =

  • HighestPrime(Exponent(2, m))

if IsConfigT(m)

  • therwise

22

slide-23
SLIDE 23

Exercise 10.22. Show that the function HighestPrime introduced in Section 10.4 is primitive recursive. HighestPrime(k) =

  • if k ≤ 1

max{i | Exponent(i, k) > 0} if k ≥ 2

23

slide-24
SLIDE 24

Step 4 State(m) = Exponent(0, m) Posn(m) = Exponent(1, m) TapeNumber(m) = Exponent(2, m) Symbol(m) = Exponent(Posn(m), TapeNumber(m))

24

slide-25
SLIDE 25

Step 4 NewState(m) = . . . NewSymbol(m) = . . . NewPosn(m) = . . . NewTapeNumber(m) = . . .

25

slide-26
SLIDE 26

Exercise 10.35. Show that the function NewTapeNumber discussed in Section 10.4 is primitive recursive. Suggestion: Determine the prime factor of TapeNumber(m) that may change by a move of the Turing machine, when the tape head is at position Posn(m).

26

slide-27
SLIDE 27

Step 5 The function MoveT : N → N defined by MoveT(m) =

    

gn(NewState(m), NewPosn(m), NewTapeNumber(m)) if IsConfigT(m)

  • therwise

27

slide-28
SLIDE 28

Step 6 The function MovesT : N2 → N defined by MovesT(m, 0) =

  • m

if IsConfigT(m)

  • therwise

MovesT(m, k + 1) =

  • MoveT(MovesT(m, k))

if IsConfigT(m)

  • therwise

28

slide-29
SLIDE 29

Step 7 The function NumberOfMovesToAcceptT : N → N defined by NumberOfMovesToAcceptT(m) = µ y[IsAcceptingT(MovesT(m, y)) = 0]

29

slide-30
SLIDE 30

Step 7 The function NumberOfMovesToAcceptT : N → N defined by NumberOfMovesToAcceptT(m) = µ y[IsAcceptingT(MovesT(m, y)) = 0] The function fT : N → N defined by fT(m) = MovesT(m, NumberOfMovesToAcceptT(m))

30

slide-31
SLIDE 31

We must show that f : Nn → N defined by f(X) = ResultT(fT(InitConfig(n)(X))) is µ-recursive.

31

slide-32
SLIDE 32

Theorem 10.20. Every Turing computable partial function from Nn to N is µ-recursive. The Rest of the Proof. . .

32

slide-33
SLIDE 33

A slide from lecture 14: Definition 10.15. µ-Recursive Functions The set M of µ-recursive, or simply recursive, partial functions is defined as follows.

  • 1. Every initial function is an element of M.
  • 2. Every function obtained from elements of M by composition
  • r primitive recursion is an element of M.
  • 3. For every n ≥ 0 and every total function f : Nn+1 → N in M,

the function Mf : Nn → N defined by Mf(X) = µ y[f(X, y) = 0] is an element of M.

33

slide-34
SLIDE 34

10.5. Other Approaches to Computability

Let

  • G = (V, Σ, S, P) be unrestricted grammar
  • f be partial function from Σ∗ to Σ∗

Then G is said to compute f, if there are A, B, C, D ∈ V , such that for every x and y in Σ∗ f(x) = y if and only if AxB ⇒∗ CyD

34

slide-35
SLIDE 35

Exercise. Describe an unrestricted grammar that computes the function f : N → N defined by f(x) = 2x. Both the input x and the answer 2x are unary numbers.

35

slide-36
SLIDE 36

Computer programs vs. Turing machines Computer programs vs. µ-recursive functions

36

slide-37
SLIDE 37

En verder. . . Tentamen: vrijdag 6 juni 2014, 14:00–17:00

  • Vragenuur. . . ?

37