Advanced Topics in Theoretical Computer Science Part 3: Recursive - - PowerPoint PPT Presentation

advanced topics in theoretical computer science
SMART_READER_LITE
LIVE PREVIEW

Advanced Topics in Theoretical Computer Science Part 3: Recursive - - PowerPoint PPT Presentation

Advanced Topics in Theoretical Computer Science Part 3: Recursive Functions (1) 21.11.2018 Viorica Sofronie-Stokkermans Universit at Koblenz-Landau e-mail: sofronie@uni-koblenz.de 1 Contents Recapitulation: Turing machines and Turing


slide-1
SLIDE 1

Advanced Topics in Theoretical Computer Science

Part 3: Recursive Functions (1) 21.11.2018 Viorica Sofronie-Stokkermans Universit¨ at Koblenz-Landau e-mail: sofronie@uni-koblenz.de

1

slide-2
SLIDE 2

Contents

  • Recapitulation: Turing machines and Turing computability
  • Register machines (LOOP, WHILE, GOTO)
  • Recursive functions
  • The Church-Turing Thesis
  • Computability and (Un-)decidability
  • Complexity
  • Other computation models: e.g. B¨

uchi Automata, λ-calculus

2

slide-3
SLIDE 3
  • 3. Recursive functions
  • Introduction/Motivation
  • Primitive recursive functions

→ P

  • P = LOOP
  • µ-recursive functions

→ Fµ

  • Fµ = WHILE
  • Summary

3

slide-4
SLIDE 4

Recursive functions

Motivation Functions as model of computation (without an underlying machine model) Idea

  • Simple (“atomic”) functions are computable
  • “Combinations” of computable functions are computable

(We consider functions f : Nk → N, k ≥ 0)

4

slide-5
SLIDE 5

Recursive functions

Motivation Functions as model of computation (without an underlying machine model) Idea

  • Simple (“atomic”) functions are computable
  • “Combinations” of computable functions are computable

(We consider functions f : Nk → N, k ≥ 0) Questions

  • Which are the atomic functions?
  • Which combinations are possible?

5

slide-6
SLIDE 6

Recursive functions: Atomic functions

The following functions are primitive recursive and µ-recursive:

6

slide-7
SLIDE 7

Recursive functions: Atomic functions

The following functions are primitive recursive and µ-recursive: The constant null 0 : N0 → N with 0() = 0

7

slide-8
SLIDE 8

Recursive functions: Atomic functions

The following functions are primitive recursive and µ-recursive: The constant null 0 : N0 → N with 0() = 0 Successor function +1 : N1 → N with + 1(n) = n + 1 for all n ∈ N

8

slide-9
SLIDE 9

Recursive functions: Atomic functions

The following functions are primitive recursive and µ-recursive: The constant null 0 : N0 → N with 0() = 0 Successor function +1 : N1 → N with + 1(n) = n + 1 for all n ∈ N Projection function πk

i : Nk → N with πk i (n1, . . . , nk) = ni

9

slide-10
SLIDE 10

Recursive functions

Notation: We will write n for the tuple (n1, . . . , nk), k ≥ 0.

10

slide-11
SLIDE 11

Recursive functions: Composition

Composition: If the functions: g : Nr → N r ≥ 1 h1 : Nk → N, . . . , hr : Nk → N k ≥ 0 are primitive recursive resp. µ-recursive, then f : Nk → N defined for every n ∈ Nk by: f (n) = g(h1(n), . . . , hr(n)) is also primitive recursive resp. µ-recursive. Notation without arguments: f = g ◦ (h1, . . . , hr)

11

slide-12
SLIDE 12

Primitive recursive functions

Until now:

  • Atomic functions (Null, Successor, Projections)
  • Composition

Next:

  • Primitive recursion

Definition of primitive recursive functions

12

slide-13
SLIDE 13

Primitive recursive functions

Primitive recursion If the functions g : Nk → N (k ≥ 0) h : Nk+2 → N are primitive recursive, then the function f : Nk+1 → N with f (n, 0) = g(n) f (n, m + 1) = h(n, m, f (n, m)) is also primitive recursive.

13

slide-14
SLIDE 14

Primitive recursive functions

Primitive recursion If the functions g : Nk → N (k ≥ 0) h : Nk+2 → N are primitive recursive, then the function f : Nk+1 → N with f (n, 0) = g(n) f (n, m + 1) = h(n, m, f (n, m)) is also primitive recursive. Notation without arguments: f = PR[g, h]

14

slide-15
SLIDE 15

Primitive recursive functions

Definition (Primitive recursive functions)

  • Atomic functions: The functions

– Null – Successor +1 – Projection πk

i

(1 ≤ i ≤ k) are primitive recursive.

  • Composition: The functions obtained by composition from primitive

recursive functions are primitive recursive.

  • Primitive recursion: The functions obtained by primitive recursion

from primitive recursive functions are primitive recursive.

15

slide-16
SLIDE 16

Primitive recursive functions

Definition (Primitive recursive functions)

  • Atomic functions: The functions

– Null – Successor +1 – Projection πk

i

(1 ≤ i ≤ k) are primitive recursive.

  • Composition: The functions obtained by composition from primitive

recursive functions are primitive recursive.

  • Primitive recursion: The functions obtained by primitive recursion

from primitive recursive functions are primitive recursive.

16

slide-17
SLIDE 17

Primitive recursive functions

Definition (Primitive recursive functions)

  • Atomic functions: The functions

– Null – Successor +1 – Projection πk

i

(1 ≤ i ≤ k) are primitive recursive.

  • Composition: The functions obtained by composition from primitive

recursive functions are primitive recursive.

  • Primitive recursion: The functions obtained by primitive recursion

from primitive recursive functions are primitive recursive. Notation: P = The set of all primitive recursive functions

17

slide-18
SLIDE 18

Arithmetical functions: definitions

f (n) = n + c f (n) = n f (n, m) = n + m f (n, m) = n − 1 f (n, m) = n − m f (n, m) = n ∗ m

18

slide-19
SLIDE 19

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0

19

slide-20
SLIDE 20

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0 f (n) = (+1)(...((+1)

  • c times

(n)))

20

slide-21
SLIDE 21

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0 f = (+1) ◦ · · · ◦ (+1)

  • c times

21

slide-22
SLIDE 22

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0 f = (+1) ◦ · · · ◦ (+1)

  • c times

Identity f : N → N, with f (n) = n

22

slide-23
SLIDE 23

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0 f = (+1) ◦ · · · ◦ (+1)

  • c times

Identity f = π1

1

23

slide-24
SLIDE 24

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0 f = (+1) ◦ · · · ◦ (+1)

  • c times

Identity f = π1

1

f (n, m) = n + m

24

slide-25
SLIDE 25

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0 f = (+1) ◦ · · · ◦ (+1)

  • c times

Identity f = π1

1

f (n, m) = n + m f (n, 0) = n f (n, m + 1) = (+1)(f (n, m))

25

slide-26
SLIDE 26

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0 f = (+1) ◦ · · · ◦ (+1)

  • c times

Identity f = π1

1

f (n, m) = n + m f (n, 0) = n f (n, m + 1) = (+1)(f (n, m)) g(n) = n g = π1

1

h(n, m, k) = +1(k) h = (+1) ◦ π3

3

26

slide-27
SLIDE 27

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0 f = (+1) ◦ · · · ◦ (+1)

  • c times

Identity f = π1

1

f (n, m) = n + m f (n, 0) = n f (n, m + 1) = (+1)(f (n, m)) g(n) = n g = π1

1

h(n, m, k) = +1(k) h = (+1) ◦ π3

3

f = PR[π1

1, (+1) ◦ π3 3]

27

slide-28
SLIDE 28

Arithmetical functions: definitions

f (n) = n + c, for c ∈ N, c > 0 f = (+1) ◦ · · · ◦ (+1)

  • c times

Identity f = π1

1

f (n, m) = n + m f = PR[π1

1, (+1) ◦ π3 3]

28

slide-29
SLIDE 29

Arithmetical functions: definitions

f (n) = n − 1

29

slide-30
SLIDE 30

Arithmetical functions: definitions

f (n) = n − 1 f (0) = 0 f (n + 1) = n

30

slide-31
SLIDE 31

Arithmetical functions: definitions

f (n) = n − 1 f (0) = 0 f (n + 1) = n g() = 0 g = 0 h(n, k) = n h = π2

1

f = PR[0, π2

1]

31

slide-32
SLIDE 32

Arithmetical functions: definitions

f (n) = n − 1 f = PR[0, π2

1]

f (n, m) = n − m

32

slide-33
SLIDE 33

Arithmetical functions: definitions

f (n) = n − 1 f = PR[0, π2

1]

f (n, m) = n − m f (n, 0) = n f (n, m + 1) = f (n, m) − 1 g(n) = n g = π1

1

h(n, m, k) = k − 1 h = (−1) ◦ π3

3

f = PR[π1

1, (−1) ◦ π3 3]

33

slide-34
SLIDE 34

Arithmetical functions: definitions

f (n) = n − 1 f = PR[0, π2

1]

f (n, m) = n − m f = PR[π1

1, (−1) ◦ π3 3]

f (n, m) = n ∗ m

34

slide-35
SLIDE 35

Arithmetical functions: definitions

f (n) = n − 1 f = PR[0, π2

1]

f (n, m) = n − m f = PR[π1

1, (−1) ◦ π3 3]

f (n, m) = n ∗ m f (n, 0) = 0 f (n, m + 1) = f (n, m) + n g(n) = 0 g = 0 h(n, m, k) = k + n h = + ◦ (π3

3, π3 1)

f = PR[0, + ◦ (π3

3, π3 1)]

35

slide-36
SLIDE 36

Arithmetical functions: definitions

f (n) = n − 1 f = PR[0, π2

1]

f (n, m) = n − m f = PR[π1

1, (−1) ◦ π3 3]

f (n, m) = n ∗ m f = PR[0, + ◦ (π3

3, π3 1)]

36

slide-37
SLIDE 37

Re-ordering/Omitting/Repeating Arguments

Lemma The set of primitive recursive functions is closed under:

  • Re-ordering
  • Omitting
  • Repeating
  • f arguments when composing functions.

37

slide-38
SLIDE 38

Re-ordering/Omitting/Repeating Arguments

Lemma The set of primitive recursive functions is closed under:

  • Re-ordering
  • Omitting
  • Repeating
  • f arguments when composing functions.

Proof: (Idea) A tuple of arguments n′ = (ni1, . . . , nik ) obtained from n = (n1, . . . , nk) by re-ordering, omitting or repeating components can be represented as: n′ = (πk

i1(n), . . . , πk ik (n))

38

slide-39
SLIDE 39

Additional Arguments

  • Lemma. Assume f : Nk → N is primitive recursive.

Then, for every p ∈ N, the function f ′ : Nk × Np → N defined for every n ∈ Nk and every m ∈ Np by: f ′(n, m) = f (n) is primitive recursive.

39

slide-40
SLIDE 40

Additional Arguments

  • Lemma. Assume f : Nk → N is primitive recursive.

Then, for every p ∈ N, the function f ′ : Nk × Np → N defined for every n ∈ Nk and every m ∈ Np by: f ′(n, m) = f (n) is primitive recursive. Proof: Case 1: k = 0, i.e. f is a constant. Then f 1 : Nk × N → N with f 1(n, m) = f (n) for all m ∈ N can be expressed by primitive recursion as follows: f 1(0) = f f 1 = PR[f , π2

2]

f 1(n + 1) = f 1(n) = π2

2(n, f 1(n))

By iterating this construction p times we obtain extensions f 2, f 3, . . . , f p with 2, 3, . . . p additional arguments. The function f ′ is f p. Case 2: k = 0. Let n = (n1, . . . , nk, m1, . . . , mp) Then f ′(n) = f (πk+p

1

(n), . . . , πk+p

k

(n)) = f ◦ (πk+p

1

, . . . , πk+p

k

).

40