A paper with this title is presented at ICFP 2023. This directory contains the artifact accompanying the paper.
The first two steps are alternatives: either you start from the
zipfile (step 1) or you use the provided vm image (step 2).
After either step you should be in a directory called src and the
remaining steps assume that you issue commands from that directory.
Prerequisites with suggested steps for debian Linux. In particular, step 2 will take quite a while to complete.
- make should be installed, e.g., by
apt-get install make - agda-2.6.3 should be installed. I followed these instructions to do so for the image: https://agda.readthedocs.io/en/v2.6.3/getting-started/installation.html
The following robust procedure was pointed out by an anonymous reviewer.
Clone the standard library at hash <HASH>. A working value for
<HASH> is 4fe943.
Add main.agda-lib with the following contents:
include: .
depend: standard-library-<HASH>
Hence, you have to clone like so:
$ git clone https://github.com/agda/agda-stdlib.git agda-stdlib-<HASH>
$ cd agda-stdlib-<HASH>
$ git reset --hard <HASH>
$ mv standard-library.agda-lib standard-library-<HASH>.agda-lib
$ sed -i "s/name: standard-library-.*$/name: standard-library-<HASH>/g" standard-library-<HASH>.agda-libIf you are brave, you can clone the current HEAD of the master
branch of the agda standard library repository on github
(https://github.com/agda/agda-stdlib). You're on your own if something
breaks.
In any case, point agda to this cloned version of the standard library, rather than the
default distributed with agda.
To this end, assuming you cloned the
standard library in the directory /home/artifact do this
(potentially adding -<HASH>):
cd
mkdir .agda
echo standard-library > defaults
echo /home/artifact/agda-stdlib/standard-library.agda-lib > librariesTo get agda in your executable path do this:
export PATH=~/.cabal/bin:$PATHIf you are here, you already unzipped the artifact. To prepare for
type checking it remains to change to the src directory:
cd src- start the image and log in as the
artifactuser
cd wsession/srcmake type-checkThis step type checks the files that correspond to the different versions of the session type library.
ST-finite-nonbranching.lagdacontains the material from section 2 of the paper FINITE NON-BRANCHING SESSION TYPES as well as the material from section 3 *SELECTION AND CHOICE"ST-recursive.lagdacontains the material on recursive session types covered in section 4 GOING IN CIRCLESST-monadic.lagdacorresponds to section 5 GOING MONADICST-indexed-contextfree.lagdacorresponds to section 6 CONTEXT-FREE SESSION TYPESST-multichannel.lagdacorresponds to section 7 HANDLING MULTIPLE CHANNELSST-multichannel-finite-branching-recursionis the extension of multichannel session types to finite branching and recursion that was proposed as an exercise to the reader in section 7 of the submitted version: In particular, we restrict to binary branching and leave the extension to finitary branching as well as the addition of recursion as an exercise to the reader. This was done on request of a reviewer and a proper description is included in the final paper.EX-multichannel.lagdacontains the main program for an actual executable that builds on top of the multichannel material in section 7.
Caution: the reviewers had issues with running the agda compiler, MAlonzo, in this step. It is known to work on several x86-based Linux boxes as well as on my Intel Core i9-based MacBook Pro. There were issues with M1-based Macs (even when running inside qemu): all files get compiled, but then the linker fails, one time with memory allocation and another time with a bad parameter to the linker.
There are two substeps: first compile the program and then run it.
make EX-multichannel(Expect reams of output on the first round.)
The result of compilation is an executable called EX-multichannel.
To run it, you say
./EX-multichannelThe program consists of a server and a client that communicate on one channel. The important command structures are
systemcreates a new channel and hands one end to theclientand its other end to theserverserverreceives two integers on channelzero, compares them for being less than or equal, and sends the result back on channelzero. It closes the channel and generates a boolean value (that gets ignored).clientsends two integers (42 and 17) on channelzero(the other end of the channel available to theserver), receives the boolean answer on channelzero, closes the channel, and passes the boolean answer as its final value.mainstarts thesystem, picks up the boolean returned from theclient, and turns it into a string that is output on the console. If the program is not changed, the output will befalse.