Circular proofs as session-typed processes: Code/Artifact
Description
Artifact accompanying the paper Circular proofs as session-typed processes: A local validity condition in the LMCS journal. A preprint of the paper is also available on arXiv.
This artifact is a simple experimental implementation of subsingleton logic, extended with temporal and ergometric types as well as constraints over natural numbers in Presburger arithmetic and termination checking. This is the subsingleton version of recent ICFP, LICS and LMCS papers, see
- Parallel Complexity Analysis with Temporal Session Types
- Work Analysis with Resource-Aware Session Types
- Circular proofs as session-typed processes: A local validity condition
The termination checker implements the system in [Circular proofs as session-typed processes: A local validity condition].
We included the artifact as a .zip file (ss.zip). It is also available on Bitbucket. We also included the implementation of the examples in Circular proofs as session-typed processes: A local validity condition as:
- example4_Loop.ss
- example5_Block.ss
- example6_Copy.ss
- example7_BitNegate.ss
- example8_CoBitNegate.ss
- example9_PingPong.ss
- example13_ProducerIdle.ss
- example15_BitCount.ss
- example17_SuccCopy.ss
- example19_Bit1Ctr.ss
The full set of examples is included in ss.zip.
Contributors:
- Ankush Das
- Farzaneh Derakhshan
- Frank Pfenning
Building ss
Requires Standard ML, mlton to build binaries
For building a binary (with mlton):
% cd src
% make ss
% ./ss ../examples/icfp18/sec7i.ss
% ./ss -h
or for interactive top level (with SML/NJ):
% sml
- CM.make "sources.cm";
- Top.ss "../examples/icfp18/sec7i.ss";
% make clean
For regression testing:
% make ss-test
% ./ss-test ../tests/*/*.ss ../examples/*/*.ss
% ./ss-test -h
Examples
- icfp18/*.ss - mostly temporal, see http://www.cs.cmu.edu/~fp/papers/icfp18.pdf
- lics18/*.ss - mostly ergometric, see http://www.cs.cmu.edu/~fp/papers/lics18.pdf
- binarith/*.ss - binary arithmetic
- modarith/*.ss - modular binary arithmetic
- turing/*.ss - some primitive recursive functions as Turing machines
- lmcs22/*.ss - termination, see https://arxiv.org/abs/1908.01909
Tests
- types/*.ss - testing the type checker
- termination/*.ss - testing the termination checker
- ztests/*/*.ss - tests that fail due to various restriction and sources of incompleteness
Options to ./ss
-q quiet (verbosity = 0)
-v verbose (verbosity = 1)
-d debug (verbosity = 2)
-h help
--time=none only explicit delays/work (default)
--time=free both sends and receives are free
--time=recv every receive costs one clock tick
--time=send every send costs one clock tick
--time=recvsend every receive and send costs one clock tick
--work=none only explicit delays/work (default)
--work=free both sends and receives are free
--work=recv every receive costs one unit of work
--work=send every send costs one unit of work
--work=recvsend every receive and send costs one unit of work
--syntax=implicit will perform time or work reconstruction (default)
--syntax=explicit will not perform time or work reconstruction
--terminate=none perform no termination checking (default)
--terminate=equi will perform termination checking on equirecursive code
--terminate=iso will perform termination checking on isorecursive code
Currently, the implementation cannot perform both time and work reconstruction on the same source: with
--syntax=implicit
either time or work must be
none
Termination checking
The termination checker (implementing the system in Circular proofs as session-typed processes: A local validity condition) uses backtracking, trying various priority orders, so it may explicitly reject some orderings before ultimately either succeeding or failing. These intermediate "error" messages explicitly exhibit some information about why the program is not valid for an attempted order.
The switch
--terminate=equi
means that the termination checker performs on the equirecursive code by silently converting it to an isorecursive implementation, while
--terminate=iso
means that the termination checker performs on the isorecursive code.
See the files
examples/misc/pluse.ss
and
examples/lmcs22/example6_Copy.ss
for examples, respectively.
Grammar
typed cut
[<type>]
or untyped cut
||
are right associative and bind more tightly than
;
For example
L.a ; L.b ; f || R.c ; g
=> L.a ; (L.b ; (f || (R.c ; g)))
L.a ; L.b ; <-> [A] R.c ; g
=> L.a ; (L.b ; (<-> [A] (R.c ; g)))
In arithmetic expressions, operator precedence is as follows.
* > + = -
All operators are left associative.
Note: right now, the order of branches must match the order of the alternatives in the external or internal choice type
A typed cut may be annotated with the potential of the process on the left.
For example
f [|{3}- bits] g
indicates
3
units of potential should be passed to
f
Comment syntax
% ... \n
(* ... *) (multiline, properly nested)
Syntax
<id_start> = [a-zA-Z_$?!']
<id> = <id_start> (<id_start> | [0-9])*
<nat> = ([0-9])*
<binop> = + | - | *
<arith> = <nat> | <id> | <arith> <binop> <arith> | (<arith>)
<rel> = > | >= | = | <= | <
<prop> = <arith> <rel> <arith>
<idx> ::= { <arith> }
<con> ::= { <prop> }
<type> ::= 1
| + { <choices> }
| & { <choices> }
| ( [<idx>] ) <type> % Next
| ` <type> % Next, from cost model
| [ ] <type> % Always
| < > <type> % Eventually
| | [<idx>] > <type> % Provide potential <arith> (default: 1)
| < [<idx>] | <type> % Obtain potential <arith> (default: 1)
| <id> <idx_seq>
| ? <con>. <type> % Provider send 'proof' of <prop>
| ! <con>. <type> % Provider receives 'proof' of <prop>
<idx_seq> ::= | <idx> <idx_seq>
<choices> ::= <label> : <type>
| <label> : <type>, <choices>
<type_opt> ::= <type>
| .
<turnstile> ::= |- % zero potential
| | <idx> - % with potential <arith>
<dir> ::= L | R
<sr> ::= ! | ?
<exp> ::= <exp> [ [<turnstile>] <type> ] <exp> % typed cut
| <exp> || <exp> % spawn, left exp must be <id>
| <->
| <dir>.<label> ; <exp>
| case<dir> ( <branches> )
| closeR
| waitL ; <exp>
| <id> <idx_seq>
| assert<dir> <con> ; <exp>
| impossible<dir> <con>
| assume<dir> <con> ; <exp>
| ( <exp> )
| delay [<idx>] ; <exp> % delay by one clock tick
| tick ; <exp> % one clock tick in cost model
| when<dir> ; <exp> % wait for 'now' message
| now<dir> ; <exp> % send 'now' message
| work [<idx>] ; <exp> % spend one token
| get<dir> [<idx>] ; <exp> % receive one token
| pay<dir> [<idx>] ; <exp> % send one token
% not implemented
% | unfold<sr><dir> ; <exp> % send or receive unfold
<branches> ::= <label> => <exp>
| <label> => <exp> | <branches>
<var> ::= _ | <id>
<var_seq> ::=
| { <var> } <var_seq>
| { <var> | <prop> } <var_seq>
<decl> ::= type <id> <var_seq> = <type>
| eqtype <id> <idx_seq> = <id> <idx_seq>
| proc <id> <var_seq> : [ <type_opt> <turnstile> ] <type>
| proc <id> <var_seq> = <exp>
| exec <id>
<outcome> ::= error
| success
| approx success
| approx error
<pragma> ::= #options <command line option>\n
| #test <outcome>\n
<prog> ::= <pragma>* <decl>*
Files
README.md
Files
(389.3 kB)
| Name | Size | |
|---|---|---|
|
md5:1b90afe51da6096efb1a7de46053077c
|
375 Bytes | Download |
|
md5:f616bc44bbb41169dd53d1568d6e0b95
|
863 Bytes | Download |
|
md5:b1b559bd7148195e5564e80b39c21e4b
|
406 Bytes | Download |
|
md5:2094982cbdbae6695c80767d0b0ea938
|
683 Bytes | Download |
|
md5:4539efb2863428bfc0cf0c0891a106a8
|
144 Bytes | Download |
|
md5:acb3c879d98e7a33bc80b26d5ee50300
|
246 Bytes | Download |
|
md5:4e71e0ea38134fdfbdcaa731166d09ce
|
242 Bytes | Download |
|
md5:43952365aee7399d93faf0d42f09f624
|
271 Bytes | Download |
|
md5:8f64243753ab4d2e57ebe77dd010694b
|
297 Bytes | Download |
|
md5:c528be7831c94672fb923485290507d0
|
493 Bytes | Download |
|
md5:4b1f8b890b4f77fdff4893d892df284b
|
7.1 kB | Preview Download |
|
md5:b58d9a70d414ae328bcc36129661ce9c
|
378.2 kB | Preview Download |
Additional details
Related works
- Is cited by
- Preprint: arXiv:1908.01909 (arXiv)