advanced topics in theoretical computer science
play

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

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


  1. Advanced Topics in Theoretical Computer Science Part 3: Recursive functions (4) 13.12.2012 Viorica Sofronie-Stokkermans Universit¨ at Koblenz-Landau e-mail: sofronie@uni-koblenz.de 1

  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

  3. 3. Recursive functions • Introduction/Motivation • Primitive recursive functions �→ P • P = LOOP • µ -recursive functions �→ F µ • F µ = WHILE • Summary 3

  4. Reminder: Goal Show that P = LOOP Idea: To show that P ⊇ LOOP we have to show that every LOOP computable function can be expressed as a primitive recursive function. For this, we will encode the contents of arbitrarily many registers in one natural number (used as input for this primitive recursive function). For this encoding we will use G¨ odelisation. We will use the fact that G¨ odelisation is primitive recursive. To show that P ⊆ LOOP we have to show that: – all atomic primitive recursive functions are LOOP computable, and – LOOP is closed under composition of functions and primitive recursion. 4

  5. P = LOOP Theorem ( P = LOOP). The set of all LOOP computable functions is equal to the set of all primitive recursive functions Proof (Idea) 1. P ⊆ LOOP 1a: We showed that all atomic primitive recursive functions are LOOP computable 1b: We showed that LOOP is closed under composition of functions 1c: We showed that LOOP is closed under primitive recursion 5

  6. P = LOOP Theorem ( P = LOOP). The set of all LOOP computable functions is equal to the set of all primitive recursive functions Proof (Idea) 2. LOOP ⊆ P Let P be a LOOP program which: • uses registers x 1 , . . . , x l • has m loop instructions We construct a primitive recursive function f P which “simulates” P ˙ ¸ n ′ 1 , . . . , n ′ f ( � n 1 , . . . , n l , h 1 , . . . , h m � ) = l , h 1 , . . . , h m if and only if: P started with n i in register x i terminates with n ′ i in x i (1 ≤ i ≤ l ). In h j it is “recorded” how long loop j should still run. 6

  7. P = LOOP Proof (ctd) At the beginning and at the end of the simulation of P we have h 1 = 0, . . . , h m = 0. Assume that we can construct a primitive recursive function f P which ˙ ¸ “simulates” P , i.e. f ( � n 1 , . . . , n l , h 1 , . . . , h m � ) = n ′ 1 , . . . , n ′ l , h 1 , . . . , h m if and only if: P started with n i in register x i terminates with n ′ i in x i (1 ≤ i ≤ l ). The function computed by the LOOP program P is then primitive recursive, since: g ( n 1 , . . . , n l ) = ( f P ( � n 1 , . . . , n l , 0, 0, . . . � )) l +1 7

  8. P = LOOP Proof (ctd) Construction of f P : 2a: P is x i := x i + 1 f P ( n ) = � ( n ) 1 , . . . , ( n ) i − 1 , ( n ) i + 1, ( n ) i +1 , . . . � P is x i := x i − 1 f P ( n ) = � ( n ) 1 , . . . , ( n ) i − 1 , ( n ) i − 1, ( n ) i +1 , . . . � 8

  9. P = LOOP Proof (ctd) Construction of f P : 2a: P is x i := x i + 1 f P ( n ) = � ( n ) 1 , . . . , ( n ) i − 1 , ( n ) i + 1, ( n ) i +1 , . . . � P is x i := x i − 1 f P ( n ) = � ( n ) 1 , . . . , ( n ) i − 1 , ( n ) i − 1, ( n ) i +1 , . . . � 2b: P is P 1 ; P 2 f P = f P 2 ◦ f P 1 i . e . f P ( n ) = f P 2 ( f P 1 ( n )) 9

  10. P = LOOP Proof (ctd) Construction of f P : 2c: P is loop x i do P 1 end Let f P 1 be the p.r. function which computes what P 1 computes. Initialize the j -th loop: ˙ ¸ f 1 ( n ) = ( n ) 1 , . . . , ( n ) l , ( n ) l +1 , . . . ( n ) l + j − 1 , ( n ) i , ( n ) l + j +1 , . . . Let the j -th loop run: 8 < if ( n ) l + j = 0 n f 2 ( n ) = ˙ ¸ f P 1 ( f 2 ( . . . , ( n ) l + j − 1, . . . )) otherwise : Then: f P ( n ) = f 2 ( f 1 ( n )) = ( f 2 ◦ f 1 )( n ) 10

  11. P = LOOP Proof (ctd) Construction of f P : 2c: P is loop x i do P 1 end Let f P 1 be the p.r. function which computes what P 1 computes. Initialize the j -th loop: ˙ ¸ f 1 ( n ) = ( n ) 1 , . . . , ( n ) l , ( n ) l +1 , . . . ( n ) l + j − 1 , ( n ) i , ( n ) l + j +1 , . . . f 1 = n ∗ p ( l + j ) ( n ) i . if ( n ) l + j = 0 before the loop is executed Let the j -th loop run: 8 < if ( n ) l + j = 0 n f 2 ( n ) = f P 1 ( f 2 ( n DIV p ( l + j ))) otherwise : Then: f P = f 2 ◦ f 1 11

  12. P = LOOP Proof (ctd) We show that f 2 is primitive recursive. Let F : N × N → N be defined by: F ( n , 0) = n F ( n , m + 1) = f P 1 ( F ( n , m )) Then F ∈ P . It can be checked that f 2 ( n ) = F ( n , D ( n , l + j )). Therefore, f 2 ∈ P . Since f 1 , f 2 are primitive recursive, so is f P = f 2 ◦ f 1 . 12

  13. 3. Recursive functions • Introduction/Motivation • Primitive recursive functions �→ P • P = LOOP • µ -recursive functions �→ F µ • F µ = WHILE • Summary 13

  14. 3. Recursive functions • Introduction/Motivation • Primitive recursive functions �→ P • P = LOOP • µ -recursive functions �→ F µ • F µ = WHILE • Summary 14

  15. µ -recursive Functions Definition ( µ Operator) 8 if g ( n , i 0 ) = 0 i 0 > > > > > < and for all 0 ≤ j < i 0 f ( n ) = µ i ( g ( n , i ) = 0) = g ( n , j ) defined and � = 0 > > > > > : undefined otherwise The smallest i such that g ( n , i ) = 0 (undefined if no such i exists or when g is undefined before taking the value 0) 15

  16. µ -recursive Functions Notation: f ( n ) = µ i ( g ( n , i ) = 0) ... without arguments: f = µ g 16

  17. µ -recursive Functions Definition ( µ -recursive Functions) • Atomic functions: The functions – Null 0 – Successor +1 π k – Projection (1 ≤ i ≤ k ) i b are µ -recursive. • Composition: The functions obtained by composition from µ - recursive functions are µ -recursive. • Primitive recursion: The functions obtained by primitive recursion from µ -recursive recursive functions are µ -recursive. • µ Operator: The functions obtained by applying the µ operator from µ -recursive recursive functions are µ -recursive. 17

  18. µ -recursive Functions Definition ( µ -recursive Functions) • Atomic functions: The functions – Null 0 – Successor +1 π k – Projection (1 ≤ i ≤ k ) i are µ -recursive. • Composition: The functions obtained by composition from µ - recursive functions are µ -recursive. • Primitive recursion: The functions obtained by primitive recursion from µ -recursive recursive functions are µ -recursive. • µ Operator: The functions obtained by applying the µ operator from µ -recursive recursive functions are µ -recursive. 18

  19. µ -recursive Functions Definition ( µ -recursive Functions) • Atomic functions: The functions – Null 0 – Successor +1 π k – Projection (1 ≤ i ≤ k ) i are µ -recursive. • Composition: The functions obtained by composition from µ - recursive functions are µ -recursive. • Primitive recursion: The functions obtained by primitive recursion from µ -recursive recursive functions are µ -recursive. • µ Operator: The functions obtained by applying the µ operator from µ -recursive recursive functions are µ -recursive. 19

  20. µ -recursive Functions Definition ( µ -recursive Functions) • Atomic functions: The functions – Null 0 – Successor +1 π k – Projection (1 ≤ i ≤ k ) i are µ -recursive. • Composition: The functions obtained by composition from µ - recursive functions are µ -recursive. • Primitive recursion: The functions obtained by primitive recursion from µ -recursive recursive functions are µ -recursive. • µ Operator: The functions obtained by applying the µ operator from µ -recursive recursive functions are µ -recursive. 20

  21. µ -recursive Functions Definition ( µ -recursive Functions) • Atomic functions: The functions – Null 0 – Successor +1 π k – Projection (1 ≤ i ≤ k ) i are µ -recursive. • Composition: The functions obtained by composition from µ - recursive functions are µ -recursive. • Primitive recursion: The functions obtained by primitive recursion from µ -recursive recursive functions are µ -recursive. • µ Operator: The functions obtained by applying the µ operator from µ -recursive recursive functions are µ -recursive. 21

  22. µ -recursive Functions Notation: = Set of all total µ -recursive functions F µ F part = Set of all µ -recursive functions µ (total and partial) 22

  23. µ -recursive Functions F part ⊆ WHILE part Theorem. F µ ⊆ WHILE and µ 23

  24. µ -recursive Functions F part ⊆ WHILE part Theorem. F µ ⊆ WHILE and µ Proof (Idea) We already proved that P = LOOP ⊂ WHILE. It remains to show that the µ operator can be “implemented” as a WHILE program. 24

  25. µ -recursive Functions F part ⊆ WHILE part Theorem. F µ ⊆ WHILE and µ Proof (Idea) We already proved that P = LOOP ⊂ WHILE. It remains to show that the µ operator can be “implemented” as a WHILE program (below: informal notation) i := 0; while g ( n , i ) � = 0 do i := i + 1 end 25

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend