All Projects → LPCIC → Elpi

LPCIC / Elpi

Licence: lgpl-2.1
Embeddable Lambda Prolog Interpreter

Programming Languages

prolog
421 projects

Projects that are alternatives of or similar to Elpi

Choco Solver
An open-source Java library for Constraint Programming
Stars: ✭ 518 (+311.11%)
Mutual labels:  constraints
Intellidroid
A targeted input generator for Android that improves the effectiveness of dynamic malware analysis.
Stars: ✭ 46 (-63.49%)
Mutual labels:  constraints
Sketch Constraints
📏 A plugin that integrates constraints in Sketch to lay out layers.
Stars: ✭ 1,300 (+931.75%)
Mutual labels:  constraints
Rein
Database constraints made easy for ActiveRecord.
Stars: ✭ 657 (+421.43%)
Mutual labels:  constraints
Tangramkit
TangramKit is a powerful iOS UI framework implemented by Swift. It integrates the functions with Android layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView
Stars: ✭ 984 (+680.95%)
Mutual labels:  constraints
Go Dberror
parsing postgres errors
Stars: ✭ 78 (-38.1%)
Mutual labels:  constraints
Mylinearlayout
MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITab…
Stars: ✭ 4,152 (+3195.24%)
Mutual labels:  constraints
React Form With Constraints
Simple form validation for React
Stars: ✭ 117 (-7.14%)
Mutual labels:  constraints
Cosyan
Transactional SQL based RDBMS with sophisticated multi table constraint logic.
Stars: ✭ 45 (-64.29%)
Mutual labels:  constraints
Emeus
Constraint-based layout manager for GTK+
Stars: ✭ 84 (-33.33%)
Mutual labels:  constraints
Dry Types
Flexible type system for Ruby with coercions and constraints
Stars: ✭ 678 (+438.1%)
Mutual labels:  constraints
Rbdl Orb
RBDL - Rigid Body Dynamics Library - ORB Version - The two main differences to the original rbdl is that this version has error handling and uses polymorphism for constraints
Stars: ✭ 33 (-73.81%)
Mutual labels:  constraints
Protoc Gen Validate
protoc plugin to generate polyglot message validators
Stars: ✭ 1,241 (+884.92%)
Mutual labels:  constraints
Semver
Work with Semantic Versions in Go
Stars: ✭ 608 (+382.54%)
Mutual labels:  constraints
Kvconstraintkit
An Impressive Auto Layout DSL for iOS, tvOS & OSX. & It is written in pure swift.
Stars: ✭ 91 (-27.78%)
Mutual labels:  constraints
Easyanchor
⚓️ Declarative, extensible, powerful Auto Layout
Stars: ✭ 432 (+242.86%)
Mutual labels:  constraints
Pulp
A python Linear Programming API
Stars: ✭ 1,080 (+757.14%)
Mutual labels:  constraints
Clpfd
Constraint Logic Programming over Finite Domains
Stars: ✭ 120 (-4.76%)
Mutual labels:  constraints
Snapkitextend
SnapKit的扩展,SnapKit类似于Masonry,但是其没有对Arry的设置和对等间距排列的布局等,此扩展是类似Masonry的写法对SnapKit的补充,同时补充九宫格布局方式
Stars: ✭ 110 (-12.7%)
Mutual labels:  constraints
Swiftautolayout
Write constraints in a concise, expressive, Swifty way.
Stars: ✭ 83 (-34.13%)
Mutual labels:  constraints

Actions Status

ELPI - Embeddable λProlog Interpreter

ELPI implements a variant of λProlog enriched with Constraint Handling Rules, a programming language well suited to manipulate syntax trees with binders.

ELPI is designed to be embedded into larger applications written in OCaml as an extension language. It comes with an API to drive the interpreter and with an FFI for defining built-in predicates and data types, as well as quotations and similar goodies that come in handy to adapt the language to the host application.

ELPI is free software released under LGPL vesion 2.1 or above.

How to install ELPI

ELPI is developed under Linux and is known to also work on MacOSX. The simplest way is to use OPAM and type

opam install elpi

This command gives you the command line tool elpi as well as the findlib -package elpi switch.

To install the development version of elpi directly from github you can type

opam pin add elpi https://github.com/LPCIC/elpi.git

You can also clone this repository and type make build.

Syntax highlight in Visual studio code

The extension for vscode is available in the market place, just look for Elpi.

Syntax highlight in vim

We recommend to add the following lines to ~/.vimrc

(click to expand)

"elpi
autocmd BufRead,BufNewFile *.elpi set filetype=lprolog

autocmd FileType lprolog syn match   lprologIdentifier  "\<\l[-a-zA-Z\.+*/\\^<>=`'
autocmd FileType lprolog syn region  lprologClause start="^\<\l[-a-zA-Z\.+*/\\^<>=`' end=" \|:-\|\."
autocmd FileType lprolog syn match lprologClauseSymbols ":-"
autocmd FileType lprolog syn match lprologClauseSymbols "\."
autocmd FileType lprolog hi def link lprologClauseSymbols Type

autocmd FileType lprolog syn keyword elpiKeyword mode macro type pred namespace rule constraint uvar shorten
autocmd FileType lprolog syn match elpiKeyword ":before"
autocmd FileType lprolog syn match elpiKeyword ":after"
autocmd FileType lprolog syn match elpiKeyword ":name"
autocmd FileType lprolog syn match elpiMacro "@\(\w\|-\)\+"
autocmd FileType lprolog syn match elpiSpill "{"
autocmd FileType lprolog syn match elpiSpill "}"
autocmd FileType lprolog syn region elpiQuotation start="{{" end="}}" contains=@elpiAntiQuotation
autocmd FileType lprolog hi def link elpiKeyword Keyword
autocmd FileType lprolog hi def link elpiMacro Special
autocmd FileType lprolog hi def link elpiSpill Special

Documentation

The language is quite compatible with standard λProlog and ELPI is known to be able to run most of the λProlog programs out there (see the list of known incompatibilities with the Teyjus system). Reading Programming with Higher-Order Logic by Miller and Nadathur is highly recommended and covers standard λProlog.

The extensions to λProlog implemented in ELPI are described in the ELPI file, built-in predicates are documented in builtin.

There is a short paper describing the implementation of the interpreter, in particular how it deals with binder mobility.

A longer paper describes, among other things, the part of the language for declaring and manipulating constraints.

For a lightweight introduction to Elpi one can look at the slides of the talk given at the ML Family workshop 2018 titled "Elpi: an extension language with binders and unification variables". The companion code of toyml that implements W (ML type inference) in Elpi is also available.

How to embed ELPI in your software

The easiest way of embedding ELPI is by linking it using findlib as in ocamlfind opt -package elpi mycode.ml -o myprogram. The API the host application can use to drive ELPI is documented in the API.mli file (html rendering). The Builtin.ml file contains example of (basic) built-in predicates declaration via ELPI's FFI.

The command line interface to ELPI is a very simple example of a client using ELPI as a library. More complex examples of embeddings of ELPI are coq-elpi and matita-elpi.

Why ELPI?

ELPI is a research project aimed at providing a programming platform for the so called elaborator component of an interactive theorem prover.

What's an elaborator and what's so special about it?

The elaborator of an interactive prover is the component in charge of turning a term as input by the user into a well typed one. In a prover like Coq it performs type inference and is typically extended by the user.

The elaborator manipulates terms with binders and holes (unification variables) representing missing piece of information. Some of them have to be filled in order to make the term well typed. Some others are filled in because the user has programmed the eleborator to do so, e.g. ad-hoc polymorphism.

Such software component is characterized by an high complexity coming from the interplay of binders, reduction and unification, the heuristics to make it work in practice and the user extensions to customize its behavior.

What problem does ELPI solve and how?

The programming language has the following features

  • Native support for variable binding and substitution, via an Higher Order Abstract Syntax (HOAS) embedding of the object language. The programmer needs not to care about De Bruijn indexes.
  • Native support for hypothetical context. When moving under a binder one can attach to the bound variable extra information that is collected when the variable gets out of scope. For example when writing a type-checker the programmer needs not to care about managing the typing context.
  • Native support for higher order unification variables, again via HOAS. Unification variables of the meta-language (λProlog) can be reused to represent the unification variables of the object language. The programmer does not need to care about the unification-variable assignment map and cannot assign to a unification variable a term containing variables out of scope, or build a circular assignment.
  • Native support for syntactic constraints and their meta-level handling rules. The generative semantics of Prolog can be disabled by turning a goal into a syntactic constraint (suspended goal). A syntactic constraint is resumed as soon as relevant variables gets assigned. Syntactic constraints can be manipulated by constraint handling rules (CHR).
  • Native support for backtracking. To ease implementation of search.
  • The constraint store is extensible. The host application can declare non-syntactic constraints and use custom constraint solvers to check their consistency.
  • Clauses are graftable. The user is free to extend an existing program by inserting/removing clauses, both at runtime (using implication) and at "compilation" time by accumulating files.

Most of these feature come with λProlog. Constraints and propagation rules are novel in ELPI.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].