reversible programming languages capturing complexity
play

Reversible Programming Languages Capturing Complexity Classes Lars - PowerPoint PPT Presentation

Welcome! RC 2020. Oslo in Norway. RC 2020. Welcome! Reversible Programming Languages Capturing Complexity Classes Lars Kristiansen Department of Informatics, University of Oslo Department of Mathematics, University of Oslo THE SYNTAX OF RBS X


  1. Welcome! RC 2020. Oslo in Norway. RC 2020. Welcome! Reversible Programming Languages Capturing Complexity Classes Lars Kristiansen Department of Informatics, University of Oslo Department of Mathematics, University of Oslo

  2. THE SYNTAX OF RBS X ∈ Variable ::= X 1 | X 2 | X 3 | . . . X + | X − | ( X to X ) | com ; com com ∈ Command ::= | loop X { com } The syntax of the language RBS . The variable X in the loop command is not allowed to occur in the loop’s body.

  3. THE SYNTAX OF RBS X ∈ Variable ::= X 1 | X 2 | X 3 | . . . X + | X − | ( X to X ) | com ; com com ∈ Command ::= | loop X { com } The syntax of the language RBS . The variable X in the loop command is not allowed to occur in the loop’s body. Why RBS . . . ?

  4. THE SYNTAX OF RBS X ∈ Variable ::= X 1 | X 2 | X 3 | . . . X + | X − | ( X to X ) | com ; com com ∈ Command ::= | loop X { com } The syntax of the language RBS . The variable X in the loop command is not allowed to occur in the loop’s body. Why RBS . . . ? . . . R eversible B ottomless S tack programs . . .

  5. EXAMPLE PROGRAM Program: Comments: (* X 1 = � m , 0 ∗ ] *) X 1 to X 9 ; (* the top elements of X 9 is m *) X + 2 ; (* X 1 = � 0 ∗ ] and X 2 = � 1 , 0 ∗ ] *) loop X 9 { (* repeat m times *) X 1 to X 3 ; X 2 to X 1 ; (* swap the top elements of X 1 and X 2 *) X 3 to X 2 } The program accepts every even number and rejects every odd number.

  6. Each program variable X i holds a bottomless stack � x 1 , . . . , x n , 0 ∗ ] .

  7. Each program variable X i holds a bottomless stack � x 1 , . . . , x n , 0 ∗ ] . x 1 , . . . , x n are natural numbers

  8. Each program variable X i holds a bottomless stack � x 1 , . . . , x n , 0 ∗ ] . x 1 , . . . , x n are natural numbers x 1 is the top element of the stack

  9. Each program variable X i holds a bottomless stack � x 1 , . . . , x n , 0 ∗ ] . x 1 , . . . , x n are natural numbers x 1 is the top element of the stack a stack has no bottom: � x 1 , . . . , x n , 0 ∗ ] = � x 1 , . . . , x n , 0 , 0 , 0 , . . . ]

  10. Each program variable X i holds a bottomless stack � x 1 , . . . , x n , 0 ∗ ] . x 1 , . . . , x n are natural numbers x 1 is the top element of the stack a stack has no bottom: � x 1 , . . . , x n , 0 ∗ ] = � x 1 , . . . , x n , 0 , 0 , 0 , . . . ] � 0 ∗ ] is called the zero stack

  11. The command ( X to Y ) moves the top element of the stack held by X to the top of stack held by Y ,

  12. The command ( X to Y ) moves the top element of the stack held by X to the top of stack held by Y , that is { X = � x 1 , . . . , x n , 0 ∗ ] ∧ Y = � y 1 , . . . , y m , 0 ∗ ] } ( X to Y ) { X = � x 2 . . . , x n , 0 ∗ ] ∧ Y = � x 1 , y 1 , . . . , y m , 0 ∗ ] }

  13. The command ( X to Y ) moves the top element of the stack held by X to the top of stack held by Y , that is { X = � x 1 , . . . , x n , 0 ∗ ] ∧ Y = � y 1 , . . . , y m , 0 ∗ ] } ( X to Y ) { X = � x 2 . . . , x n , 0 ∗ ] ∧ Y = � x 1 , y 1 , . . . , y m , 0 ∗ ] } ( Y to X ) { X = � x 1 , . . . , x n , 0 ∗ ] ∧ Y = � y 1 , . . . , y m , 0 ∗ ] }

  14. The command X + ( modified successor ) increases the top element of the stack held by X by 1 ( mod b ) , that is { X = � x 1 , . . . , x n , 0 ∗ ] } X + { X = � x 1 +1 ( mod b ) , x 2 . . . , x n , 0 ∗ ] } .

  15. The command X − ( modified predecessor ) decreases the top element of the stack held by X by 1 ( mod b ) , that is { X = � x 1 , . . . , x n , 0 ∗ ] } X − { X = � x 1 − 1 ( mod b ) , x 2 . . . , x n , 0 ∗ ] } .

  16. Fix a natural number b > 1 . To count modulo b . . . 2 , 3 , 4 , . . . , b − 1 , 0 , 1 , 2 . . . , b − 1 , 0 , 1 , 2 , . . . is a reversible operation.

  17. Fix a natural number b > 1 . To count modulo b . . . 2 , 3 , 4 , . . . , b − 1 , 0 , 1 , 2 . . . , b − 1 , 0 , 1 , 2 , . . . is a reversible operation. 0 becomes the successor of b − 1 b − 1 becomes the predecessor of 0

  18. A program will be executed in base b > 1 . How is this b determined?

  19. A program will be executed in base b > 1 . How is this b determined? The input to a program is a single natural number m .

  20. A program will be executed in base b > 1 . How is this b determined? The input to a program is a single natural number m . When the execution of the program starts, we have by convention X 1 = � m , 0 ∗ ] where m is the input. All other variables ( X 2 , X 3 , . . . ) hold the zero stack � 0 ∗ ] .

  21. A program will be executed in base b > 1 . How is this b determined? The input to a program is a single natural number m . When the execution of the program starts, we have by convention X 1 = � m , 0 ∗ ] where m is the input. All other variables ( X 2 , X 3 , . . . ) hold the zero stack � 0 ∗ ] . The base of execution b is set to b := max( m + 1 , 2) and is kept fixed during the entire execution.

  22. Under this regime, the operations X + and X − become the inverse of each other.

  23. Under this regime, the operations X + and X − become the inverse of each other. We have { X = � x 1 , . . . , x n , 0 ∗ ] } X + ; X − { X = � x 1 , x 2 . . . , x n , 0 ∗ ] } .

  24. Under this regime, the operations X + and X − become the inverse of each other. We have { X = � x 1 , . . . , x n , 0 ∗ ] } X + ; X − { X = � x 1 , x 2 . . . , x n , 0 ∗ ] } . We have { X = � x 1 , . . . , x n , 0 ∗ ] } X − ; X + { X = � x 1 , x 2 . . . , x n , 0 ∗ ] } .

  25. The command C 1 ; C 2 work as expected.

  26. The command C 1 ; C 2 work as expected. This is the standard composition of the commands C 1 and C 2 , that is, first C 1 is executed, then C 2 is executed.

  27. The command loop X { C } executes the command C repeatedly k times in a row where k is the top element of the stack held by X .

  28. The command loop X { C } executes the command C repeatedly k times in a row where k is the top element of the stack held by X . Note that the variable X is not allowed to occur in C and, moreover, the command will not modify the stack held by X .

  29. Definition. We define the reverse command of C , written C R , inductively over the structure C : i ) R = X − ( X + i i ) R = X + ( X − i ( X i to X j ) R = ( X j to X i ) ( C 1 ; C 2 ) R = C R 2 ; C R 1 ( loop X i { C } ) R = loop X i { C R } .

  30. Theorem Let C be a program, and let X 1 , . . . , X n be the variables occurring in C . Furthermore, let m be any natural number. We have { X 1 = � m , 0 ∗ ] ∧ � n i =2 X i = � 0 ∗ ] } C; C R { X 1 = � m , 0 ∗ ] ∧ � n i =2 X i = � 0 ∗ ] }

  31. Theorem Let C be a program, and let X 1 , . . . , X n be the variables occurring in C . Furthermore, let m be any natural number. We have { X 1 = � m , 0 ∗ ] ∧ � n i =2 X i = � 0 ∗ ] } C; C R { X 1 = � m , 0 ∗ ] ∧ � n i =2 X i = � 0 ∗ ] } The theorem is proved by induction over the structure of C . A detailed proof can be found in my paper.

  32. The considerations above show that we have a programming language that is reversible in a very strong sense.

  33. The considerations above show that we have a programming language that is reversible in a very strong sense. The next theorem says something about the expressive power of this reversible language.

  34. Theorem S = ETIME What does this theorem say?

  35. Theorem What is S ? S = ETIME What is ETIME ? What does this theorem say?

  36. Theorem What is S ? S = ETIME What is ETIME ? Let me explain S first. What does this theorem say?

  37. Theorem S = ETIME S is the class of problems decidable by an RBS program. What does this theorem say?

  38. Theorem S = ETIME An RBS program C accepts the natural number m if C executed with input m terminates with 0 at the top of the stack hold by X 1 , otherwise, C rejects m . What does this theorem say?

  39. Theorem A problem is simply a set of natural S = ETIME numbers. What does this theorem say?

  40. Theorem A problem is simply a set of natural S = ETIME numbers. An RBS program C decides the problem A if C accepts all m that belong to A and What does this rejects all m that do not belong to A . theorem say?

  41. Theorem S = ETIME S is the class of problems decidable by an RBS program. What does this theorem say?

  42. Theorem ETIME is the class of problems decidable S = ETIME by a deterministic Turing machine in time O (2 kn ) for some constant k (recall that n denotes the length of the input). What does this theorem say?

  43. Theorem The theorem gives a so-called implicit S = ETIME characterization of the complexity class ETIME . What does this theorem say?

  44. Theorem The theorem gives a so-called implicit S = ETIME characterization of the complexity class ETIME . Please, let me elaborate. What does this theorem say?

  45. Reversible Computing and Implicit Computational Complexity In my paper I share some thoughts on the relationship between implicit computational complexity and reversible computing .

  46. Reversible Computing and Implicit Computational Complexity In my paper I share some thoughts on the relationship between implicit computational complexity and reversible computing . Complexity classes like ETIME , P , FP , NP , LOGSPACE , PSPACE , and so on, are defined by imposing explicit resource bounds on a particular machine model, namely the Turing machine.

Recommend


More recommend