Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrew-johnson-4/lsts
Large Scale Type Systems (programming language)
https://github.com/andrew-johnson-4/lsts
assisted-reasoning ast category-theory compiler dependent-types error-reporting lambda-calculus lambda-calculus-interpreter language lexer lint lsts parser proof-assistant refinement-types rust theorem-prover type-checking
Last synced: 4 days ago
JSON representation
Large Scale Type Systems (programming language)
- Host: GitHub
- URL: https://github.com/andrew-johnson-4/lsts
- Owner: andrew-johnson-4
- License: mit
- Created: 2021-09-10T02:12:03.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-04T05:46:48.000Z (9 months ago)
- Last Synced: 2024-05-22T19:33:43.215Z (6 months ago)
- Topics: assisted-reasoning, ast, category-theory, compiler, dependent-types, error-reporting, lambda-calculus, lambda-calculus-interpreter, language, lexer, lint, lsts, parser, proof-assistant, refinement-types, rust, theorem-prover, type-checking
- Language: Rust
- Homepage: https://andrew-johnson-4.github.io/lsts-tutorial/
- Size: 1.16 MB
- Stars: 99
- Watchers: 4
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![Crates.IO](https://img.shields.io/crates/v/LSTS.svg)](https://crates.rs/crates/LSTS)
[![Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/lsts/latest/lsts/)
[![Read the Docs](https://img.shields.io/badge/book-reference-blue)](https://andrew-johnson-4.github.io/lsts-tutorial/)LSTS is a proof assistant and maybe a programming language.
Proofs in LSTS are built by connecting terms, type definitions, and quantified statements.
Terms can be evaluated to obtain Values.
Types describe properties of Terms.
Statements describe relations between Terms and Types.Runtime and performance are the primary constraint on theorem proving.
To address these concerns we employ two strategies somewhat unique to LSTS:
* aggressive search-space [pruning](https://github.com/andrew-johnson-4/lambda-mountain/wiki/Type-System)
* Punning is key here: ["well designed puns can lead to asymptotically different inference performance"](https://github.com/andrew-johnson-4/lambda-mountain/wiki#%CE%BB-name-origin)
* [full control over every instruction](https://github.com/andrew-johnson-4/lambda-mountain) for control-freak style performance tuning
* (not implemented yet) parallel inference: the specialization rule is highly amenable to parallel execution### Installation
LSTS is now bundled by default with the [Lambda Mountain](https://github.com/andrew-johnson-4/lambda-mountain) compiler.
```
git clone https://github.com/andrew-johnson-4/lambda-mountain.git
cd lambda-mountain
make install
```### Terms
Terms are Lambda Calculus expressions with some extensions.
```lsts
1;
"abc";
2 + 3;
"[" + (for x in range(1,25) yield x^3).join(",") + "]";
```### Types
Type definitions define logical statements that are then attached to Terms.
All valid Terms have at least one Type. Some Terms may have more than one Type.
Types may define invariant properties.
These invariant properties impose preconditions and postconditions on what values may occupy that Type.
Values going into a Type must satisfy that Type's preconditions. Values coming out of a Term are then known to have satisfied each Type's invariants.```lsts
type Even: Integer
where self % 2 | 0;
type Odd: Integer
where self % 2 | 1;
```### Statements
Statements connect logic to form conclusions. Each Statement has a Term part and a Type part.
Statements, when applied, provide new information to the Type of a Term. When a Statement is applied, it must match the pattern of its application context.
An application context consists of a Term and a Type, which is then compared to the Term and Type of the Statement.
These Term x Type relations form the basis of strict reasoning for LSTS.```lsts
forall @inc_odd x: Odd. Even = x + 1;
forall @dec_odd x: Odd. Even = x - 1;
forall @inc_even x: Even. Odd = x + 1;
forall @dec_even x: Even. Odd = x - 1;((8: Even) + 1) @inc_even : Odd
```### Logic Backend
The language here is based on [System F-sub](https://en.wikipedia.org/wiki/System_F) with the following inference rules added.
$$abstraction \quad \frac{\Gamma \vdash a:A \quad \Gamma \vdash b:B \quad \Gamma \vdash x:X \quad \Gamma \vdash y:Y \quad λ⟨a.b⟩⟨x.y⟩}{\Gamma \vdash λ⟨a.b⟩⟨x.y⟩:(A \to B) + (X \to Y)}$$
$$application \quad \frac{\Gamma \vdash f:(A \to B) + (C \to D) + (X \to Y) \quad \Gamma \vdash x:A + X \quad f(x)}{\Gamma \vdash f(x):B + Y}$$
### Further Reading
* [Wiki](https://github.com/andrew-johnson-4/LSTS/wiki)