https://github.com/ilya-klyuchnikov/mrsc
A toolkit for building multi-result supercompilers
https://github.com/ilya-klyuchnikov/mrsc
partial-evaluation supercompilation
Last synced: 10 months ago
JSON representation
A toolkit for building multi-result supercompilers
- Host: GitHub
- URL: https://github.com/ilya-klyuchnikov/mrsc
- Owner: ilya-klyuchnikov
- Created: 2011-04-23T17:57:21.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2021-10-23T10:18:04.000Z (over 4 years ago)
- Last Synced: 2025-04-30T21:09:52.530Z (about 1 year ago)
- Topics: partial-evaluation, supercompilation
- Language: Scala
- Homepage:
- Size: 2.03 MB
- Stars: 30
- Watchers: 5
- Forks: 5
- Open Issues: 41
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MRSC
MRSC is a toolkit for rapid design and prototyping of (multi-result) supercompilers.
MRSC 1.0 provides generic data structures and operations for building supercompilers
based on the concept of *graph of configurations*. A supercompiler is encoded as a set
of graph rewrite rules.
## Papers
The theory behind MRSC is described in the following papers:
* Ilya Klyuchnikov and Sergei Romanenko.
Multi-Result Supercompilation as Branching Growth of the Penultimate Level in Metasystem Transitions.
_Ershov Informatics Conference 2011_.
pdf (Revised version is in
LNCS 7162, pp. 210–226, 2012)
* Ilya Klyuchnikov and Sergei Romanenko.
MRSC: a toolkit for building multi-result supercompilers.
_Preprint 77. Keldysh Institute of Applied Mathematics, Moscow_. 2011.
pdf
## Code structure
MRSC is divided in a number of packages:
* `mrsc.core`
* Generic data structures (`SGraph` and `TGraph`) for representing a graph of configurations and operations
on them.
* An abstraction `GraphRewriteRules` for encoding the logic of supercompilation in terms of rewriting rules.
* The component `GraphGenerator` for incremental producing _all_ possible graphs of configurations
for a given set of rewriting rules.
* `mrsc.counters`
* Example of a very simple (but non-trivial!) supercompiler for counter systems (see below).
## Example: generating proofs of safety of cache-coherence protocols
The entry point to this example is `mrsc/counters/demo.scala` (just launch it to see results in the console).
The package `mrsc.counters` contains an example of building a traditional (single-result) supercompiler and a (novel)
multi-result supercompiler for counter systems. This example is inspired by works by Andrei Nemytykh, Alexei Lisitsa
and Andrei Klimov:
1. A. Lisitsa and A. Nemytykh. Verification as a parameterized testing (experiments with the SCP4 supercompiler).
Programming and Computer Software. vol. 33. 2007
2. Andrei V. Klimov, A Java Supercompiler and its Application to Verification of Cache-Coherence Protocols.
In: Perspectives of Systems Informatics: 7th International Andrei Ershov Memorial Conference, PSI 2009,
Novosibirsk, Russia, June 15-19, 2009. Revised Papers. Lecture Notes in Computer Science, volume 5947/2010,
pages 185-192. Springer Berlin / Heidelberg, 2010.
3. Andrei V. Klimov, Solving Coverability Problem for Monotonic Counter Systems by Supercompilation.
In: E.M. Clarke, I. Virbitskaite, A. Voronkov (eds.), Proceedings of the Ershov Informatics Conference (PSI 2011),
June 17 – July 01, 2011, Akademgorodok, Novosibirsk, Russia. Novosibirsk: Ershov Institute of Informatics Systems, 2011. P. 92-103.
4. SCP 4 : Verification of Protocols
5. The project JVer
The works [1, 2, 4, 5] use the following approach for verification of protocols: express a protocol and its safety
property as a Java of Refal program, supercompile a boolean expression stating the safety property of protocol -
from the structure of supercompiled expression it will follow the safety of protocol. Following [3], we
created a tiny language (of configurations) for encoding states of protocols (`mrsc/counters/language.scala`).
Then protocols are expressed in Scala directly - as a DSL over the language of configurations
(`mrsc/counters/protocols.scala`). There are two supercompilers in `mrsc/counters/rules.scala` encoded as graph
rewrite rules - traditional single-result one and multi-result one. These supercompilers build graphs of
configurations for a given protocol. Using a graph of configurations, we are able to produce a proof
of safety of a protocol for a proof assistant Isabelle
(`mrsc/counters/proof.scala`). Demo application in `mrsc/counters/demo.scala` puts all things together:
for a number of protocols traditional supercompiler is launched (as in [3]), multi-result supercompiler is launched and
the smallest graphs is then selected from a set of graphs generated by multi-result supercompiler.
The smallest graph is then residuated into a proof for Isabelle. More details are in an upcoming paper.
The output of demo is shown in [proofs.md](https://github.com/ilya-klyuchnikov/mrsc/blob/master/proofs.md).
## Tests and examples
By default, tests and samples output is note verbose (to prevent a garbage in output). However, if you really want
to see all details:
```
> project MRSCPfp
> set javaOptions += "-Dmrsc.verbose=true"
> testOnly mrsc.pfp.test.TicksEvaluationSuite
```