1 / 29

Tetsuo Yokoyama 1 Holger Bock Axelsen 2 Robert Glück 2

Reversible Flowchart Languages and the Structured Reversible Program Theorem. Tetsuo Yokoyama 1 Holger Bock Axelsen 2 Robert Glück 2 1 Graduate School of Information Science Nagoya University 2 Department of Computer Science University of Copenhagen. [ICALP2008]. GRACE BDX’08 . Overview.

ifama
Download Presentation

Tetsuo Yokoyama 1 Holger Bock Axelsen 2 Robert Glück 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Reversible Flowchart Languages and the Structured Reversible Program Theorem Tetsuo Yokoyama1 Holger Bock Axelsen2 Robert Glück2 1Graduate School of Information ScienceNagoya University 2Department of Computer ScienceUniversity of Copenhagen [ICALP2008] GRACE BDX’08

  2. Overview • Reversible unstructured/structured flowcharts • Reversible structured program theorem • Reversible flowcharts are r-Turing complete • Injectivizing irreversible flowcharts • Conclusion

  3. Reversible flowcharts 1 (machine code)‏ = altered stuff stuff

  4. Reversible flowcharts 2 • Steps must be reversible • x := y is not allowed, previous value unknown • x ^= y (short for x := xXORy) is allowed, previous value computable • In general, reversible updates [CSR07,CF08] • Assertions are added to join points • Removes non-determinism from the merging of control flow • Not injective in general (like expressions in tests)‏ • Well-formed iff unique entry and exit arcs

  5. Structured reversible flowcharts (high-level programming)‏ = new stuff stuff

  6. Aside: Inversion Local and fast

  7. Overview • Reversible unstructured/structured flowcharts • Reversible structured program theorem • Reversible flowcharts are r-Turing complete • Injectivizing irreversible flowcharts • Conclusion

  8. Why structured programs (again)? • “Goto considered harmful” also for reversible programming • Original Böhm-Jacopini proof not valid in reversible setting • Reversible programming is largely uncharted land, and has unfamiliar features

  9. Structured reversible program theorem • Theorem: For every (unstructured) reversible flowchart program, there is a functionally equivalent structured reversible flowchart program. • Proof:Simluate control flow across one node at a time. Label each of n arcs by li, assuming entry arc is l1 and exit arc is ln. Then sequentially test whether control is on an arc, executing the subsequent node if applicable.

  10. Structured reversible program theorem: Main loop xi : true if control flow is on arc li

  11. Structured reversible program theorem: Step Pi,jxi ^= true ; xj^= true Moves control from arc lito arc lj

  12. Structured reversible program theorem: Selection

  13. Structured reversible program theorem: Assertion Q.E.D.

  14. Overview • Reversible unstructured/structured flowcharts • Reversible structured program theorem • Reversible flowcharts are r-Turing complete • Injectivizing irreversible flowcharts • Conclusion

  15. r-Turing completeness • Definition: A programming language is r-Turing completeiff it can simulate any reversible Turing machinecleanly, without garbage/history stack.

  16. Aside: Cleanliness • Why clean simulation? Because injective and injectivized functions are different! • Example: Reversibly multiplying primes p1* p2 is easy with garbage (say, p1,) but equivalent to factoringif clean (because RTMs are time reversible.) • Lesson: Do not confuse Bennett’s injectivizedmachines withgeneral RTMs!

  17. Reversible Turing machines • Definition: A Turing machine is reversible iff it is fwd and bwd deterministic. • Notation:Quadruple format for • symbolrules: <q1,s1,s2,q2> • moverules: <q1,/,d,q2> [Bennett73]

  18. r-Turing completeness of RFCL • Theorem: Reversible flowcharts are r-Turing complete. • Proof:Simulate tape as pair of (here infinite, but finite works) stacks and a single value for the symbol under the r/w head. Addbooleansfor the states and test for rule applicability sequentially.

  19. r-Turing completeness: Tape r/w Tape s Stacks right left

  20. r-Turing completeness: Main loop

  21. r-Turing completeness: symbol rule Qq1,q2q ^= q1 ; q ^= q2 Ss1,s2s ^= s1; s ^= s2

  22. r-Turing completeness: move rule M-pushs right ; pop s left M+pushs left ; pop s right Q.E.D.

  23. Overview • Reversible flowcharts • Reversible structured program theorem • Reversible flowcharts are r-Turing complete • Injectivizing irreversible flowcharts • Conclusion

  24. Injectivizing irreversible flowcharts • Problem: In reversible languages exactly the injective computable functions are computable • Solution:Transform the program into an injective reversible version that computes the same function along with some garbage data • Only necessary for non-injective functions • History: Landauer embedding, Bennett's method

  25. Injectivization theorem • Theorem: For every classical flowchart program computing f(x) as output, there is a reversible flowchart computing f(x) as part of its output. • Proof:Add a historystack h to the state. For every irreversible operation we save the data necessary for bwd determinism on this stack.

  26. Injectivization: Join point

  27. Injectivization: Step • Steps are assumed to be assignments of the form x := e • Replace x := e with push x h; x ^= e[top h / x] Q.E.D.

  28. Overview • Reversible flowcharts • Reversible structured program theorem • Reversible flowcharts are r-Turing complete • Injectivizing irreversible flowcharts • Conclusion

  29. Conclusion • Reversible flowchartsintroduced • Structure is free, even for reversible programs • Injectivization is possible, giving Turing completeness in practice • r-Turing completeness, as powerful as reversible programming can get wrt computability • [ICALP08] : T Yokoyama, HB Axelsen, R Glück: “Reversible Flowchart Languages and the Structured Reversible Program Theorem”, Automata, Languages and Programming (Proc.), LNCS 5126, pp 258-270, 2008

More Related