LSTS is a programming language and proof assistant. 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.
LSTS is now bundled by default with the Lambda Mountain compiler.
git clone https://github.com/andrew-johnson-4/lambda-mountain.git
cd lambda-mountain
make install
The default LSTS backend compiles to C with little or no overhead or runtime dependencies. Previously, the compiler generated x86-Linux objects directly, however this was approximately 3x slower than the C backend. We will revisit the direct targets to generate fully certified builds. Until then, C is the default backend.
Terms are Lambda Calculus expressions with some extensions.
1;
"abc";
2 + 3;
"[" + (for x in range(1,25) yield x^3).join(",") + "]";
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.
type Even: Integer
where self % 2 | 0;
type Odd: Integer
where self % 2 | 1;
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.
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
Runtime and performance are the primary constraint on theorem proving. To address these concerns we employ several strategies somewhat unique to LSTS:
- aggressive search-space pruning
- Punning is key here: "well designed puns can lead to asymptotically different inference performance"
- full control over every instruction for control-freak style performance tuning
- (not implemented yet) parallel inference: the specialization rule is highly amenable to parallel execution
The language here is based on System F-sub with the following inference rules added.