Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ef55/stainless-stlc
System F in Stainless
https://github.com/ef55/stainless-stlc
lambda-calculus stainless system-f verified
Last synced: 3 months ago
JSON representation
System F in Stainless
- Host: GitHub
- URL: https://github.com/ef55/stainless-stlc
- Owner: Ef55
- Created: 2021-11-25T15:59:50.000Z (about 3 years ago)
- Default Branch: system-f
- Last Pushed: 2022-12-25T13:18:38.000Z (about 2 years ago)
- Last Synced: 2024-04-18T16:52:46.984Z (8 months ago)
- Topics: lambda-calculus, stainless, system-f, verified
- Language: Scala
- Homepage:
- Size: 6.87 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Verified ~~STLC~~ System F in Stainless
Implementation of System F in [Scala](http://scala-lang.org/), formally verified using [Stainless](https://github.com/epfl-lara/stainless).
A few of the proved properties:
- Type judgment uniqueness;
- Preservation;
- Progress for Call-by-Value reduction strategy.## Verification
The implementation can be verified using stainless:
```
$ cd src/main/scala/verified
$ stainless
```We strongly recommend using the `--compact` flag as well as a timeout of at least 2 seconds. A Stainless configuration file is [provided](src/main/scala/verified/stainless.conf) with those settings (the timeout is set to 5 seconds for good measure).
## Evaluator
A command-line lambda evaluator can be run using:
```
$ sbt run
```The evaluator uses [De Bruijn notation](https://en.wikipedia.org/wiki/De_Bruijn_notation) and uses the following symbols:
| Symbol name | Symbol | ASCII alternative |
|------------------------|:------:|:-------------------:|
| lambda | λ | `\` |
| Lambda | Λ | `/\` |
| Type arrow | ⇒ | `=>` |
| Universal quantifier | ∀ | `\/` |
| Fixpoint combinator | "Fix" | `§` |The syntax for types is:
| Construct name | Syntax |
|---------------------|------------------|
| Type variable | A number |
| Ground type | A string |
| Function type | `type ⇒ type` |
| Universal type | `∀. type` |The syntax for terms is:
| Construct name | Syntax |
|---------------------|------------------|
| Var | A number |
| Abs | `λtype. term` |
| App | `term term` |
| Fix | `Fix term` |
| TAbs | `Λ. term` |
| TApp | `term [type]` |Example:
```
$ sbt runPlease enter a lambda-term to evaluate:
$ (/\.\0=>0.0)[T]\T.0
⊢ ((Λ.λ0⇒0. 0) [T]) λT. 0 : T⇒T
Reduction:
((Λ.λ0⇒0. 0) [T]) λT. 0 -->
(λT⇒T. 0) λT. 0 -->
λT. 0 -->/
```## Examples
A few examples/test cases can be run using:
```
$ sbt test
```