Author

Topic: The Janus playground (Read 54 times)

member
Activity: 691
Merit: 51
November 16, 2023, 01:47:25 PM
#1
Janus was the very first fully reversible programming language. You can practice coding in the reversible programming Janus here.

https://topps.di.ku.dk/pirc/janus-playground/

With Janus, you can write reversible programs for all sorts of tasks. For example, here is a small program that I wrote that transforms (X,y,z) to (X,y,Xy+z) where X is a matrix and y,z are vectors.

Code:
procedure mmult(int x[10][10],int y[10],int z[10])
local int i
local int j
from i=0 loop
from j=0 loop
z[i]+=x[i][j]*y[j]
j+=1
until j=10
j-=10
i+=1
until i=10
i-=10
z[1]+=1
delocal int j
delocal int i

procedure main()
int x[10][10]
int y[10]
int z[10]
int i
int j
from i=0 loop
y[i]+=13-i
from j=0 loop
x[i][j]+=i+j
j+=1
until j=10
j-=10
i+=1
until i=10
call mmult(x,y,z)
So it turns out that not only is the operation (X,y,z)-->(X,y,Xy+z) fully reversible, but this operation can easily be calculated reversibly.

I highly recommend programming in Janus to anyone who wants to understand reversible computing better.

The Janus programming language is more like a proof-of-concept that demonstrates that reversible programming is possible than a complete programming language. The Janus playground has a few limitations including the following:

1. Janus was designed for full reversibility instead of partial reversibility. In practice, energy efficient reversible computing will be partially reversible, so a programming language that can handle full reversibility along with partial reversibility would be better. There is a newer programming language for partial reversibility described here https://arxiv.org/abs/1605.08475. But I would rather have a playground or a sandbox where I can actually write reversible and partially reversible programs along with the paper than just a paper. If I just see a paper, I will not read the paper, but if I see the paper along with a sandbox, I will refer to the paper often so that I know how to write programs.

2. There are very few types to work with. For example, we can select to work with integers modulo 32 or to work with arbitrary precision integers. But what about 8 bit,16 bit,64 bit integers? What about floats? What about complex numbers or quaternions?

3. Janus has a limited collection of built in procedures. For example, in cryptography, I would like to rotate a 32 bit integer, but in Janus, there is no functionality for rotating a 32 bit integer. In the playground, they give us an example of the program for encrypting a block with the ChaCha20 cipher, but in this program, they had to program the rotation procedure manually. To make things worse, the rotation procedure features complicated operations such as multiplication,exponentiation, and division. This makes the program for ChaCha20 quite energy inefficient which is the opposite of what reversible computation is supposed to do.

Let's compare the Janus playground to a quantum computing playground. Right now, regular computers do a pretty good job at emulating energy efficient reversible computers (they just use a little bit more energy) which means that we can do all the software and algorithm testing for reversible computation right now. We cannot exactly do that for quantum computation. Right now, a classical computer can only do a very poor job at emulating a small dinky quantum computer. Reversible computing is also conceptually easier to understand, so there should be much more interest in reversible computing. I really do not know why anyone would want to completely skip a reversible computing playground to go straight to quantum computing. It makes absolutely no sense to me at all.

-Joseph Van Name Ph.D.

P.S. For those of you who want to test reversible computation without putting in all the effort into writing reversible programs, you can always play around with reversible cellular automata. For example, here is a reversible cellular automata playground that you can play around with without any experience with reversible computation: https://dmishin.github.io/js-revca/index.html
Jump to: