Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bpowers/liquid-types
Logically Qualified Data Types - automatically infer refinement types
https://github.com/bpowers/liquid-types
Last synced: 3 months ago
JSON representation
Logically Qualified Data Types - automatically infer refinement types
- Host: GitHub
- URL: https://github.com/bpowers/liquid-types
- Owner: bpowers
- License: apache-2.0
- Created: 2016-09-19T17:10:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-08-24T20:59:00.000Z (over 3 years ago)
- Last Synced: 2024-05-22T20:32:18.374Z (8 months ago)
- Language: Rust
- Homepage:
- Size: 297 KB
- Stars: 15
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
- awesome-rust-formalized-reasoning - Logically Qualified Data Types - implementation of liquid types on an implicitly-typed variant of ML. (Projects / Verification)
README
Logically Qualified Data Types
==============================This repository contains an implementation in Rust of [liquid
types](http://goto.ucsd.edu/~rjhala/liquid/liquid_types.pdf) on an
implicitly-typed variant of ML.BUILD
-----This projects requires having the [z3 theorem
prover](https://github.com/Z3Prover/z3/wiki) library in your library search path.RUN
---As an example, `examples/max3.ml` defines a function max and applies it
to two arguments:```ML
let max = fun x -> fun y -> if x > y then x else y in max 1 -3
```You can infer liquid types for this program by
running:```sh
$ target/debug/liquid-types examples/max3.ml
```This will spit out debugging information about the liquid environment
(Γ) and subtyping constraints, the liquid type templates we start with
(a), and the liquid type templates after we've iteratively weakened
them (min_a), along with the refined types produced by running liquid
type inference.For example, the type inferred for max above is:
```
max_a1: F(x_a2: {ν: Int | 0 ≤ ν} → F(y_a3: {ν: Int | true} → {ν: Int | 0 ≤ ν ∧ x_a2 ≤ ν ∧ y_a3 ≤ ν}))
```(the `_a$N` suffix on variables can be ignored, it is added during A-normalization)
There are additional programs in the `examples/` directory, and feel
free to try your own! If you hit any problems, please open an
[issue](/../../issues/new).IMPLEMENTED
-----------Most of the paper is implemented, including:
- The liquid type inference algorithm, including constraint generation and iterative weakening.
- lexing/parsing/interpreting a subset of an implicitly-typed ML-like language
- Hindley-Milner type inference
- A-normalization
- Alpha renamingNOT IMPLEMENTED
---------------- Specifying Q (the set of liquid type templates) on the command line - to change Q edit the definition in main.rs.
- Higher order polymorphic functions.
- Types -- instantiation or polymorphism, only built-in `bool` and `int` types are available.
- Pending substitutions in liquid type parameters.
- Liquid type inference for arrays, array operations like `sub`, `set` and the built-in function `len`.QUIRKS
------Subtraction: - make sure there are spaces around `-` like in `k -
1`. `k-1` doesn't currently work (it is lexed as two tokens, `k` and
`-1`).LICENSE
-------Dual-licensed under the MIT and Apache licenses, as is Rust + the
[LALRPOP](https://github.com/nikomatsakis/lalrpop) parser generator.
The lexer is heavily borrowed from LALRPOP.