Logic Production Systems
Logic Production Systems, LPS for short, is a language for programs that act over time: a contract, a process, a game, a robot’s rules. An LPS program describes a world that changes. The program says which facts hold at each moment, which events change those facts, how the program should react to what happens, and what must never be the case. LPS2 runs such a program cycle by cycle, shows what happened, and explains why.
LPS was created by Robert Kowalski and Fariba Sadri at Imperial College London. LPS2 is a new implementation that succeeds the original one and runs its programs. It was built by Logical Contracts with Kowalski and Jacinto Dávila, and it is open source under the Apache 2.0 licence since October 2026.
What you get
- Programs in English, or in LPS’s own notation. A program can be written in Logical English, with sentences for events, facts, causal laws and constraints, or in LPS’s own written form, which also opens the programs of the original implementation unchanged.
- The run, shown. A timeline of which fact held when and which events happened in each cycle; the changes made in any one cycle; the run drawn as a diagram of states; a 2D and a 3D scene, drawn from the program’s own drawing rules.
- Explanations. Right-click a fact or an event to ask why it happened, or why not. The answer names the rule, the event and the line of the program.
- Planning. A program can state a goal and leave the engine to find the actions, within the same constraints.
- Legal view. For a contract, a page that says who may do what, drawn from the program each time.
- Language models as agents. Through the Model Context Protocol, a standard way for language models to use tools, a language model can open a program as a world and ask whether an action is allowed before taking it. The answer comes from the program’s constraints and names the constraint.
- A browser-only version. The whole editor can also run with no server at all, in the visitor’s own browser tab.
Try it
In your browser. Open https://lps2.logicalcontracts.com/ide, choose an example from the Examples menu, and press Run. The wolf, goat and cabbage puzzle is a good first one: the puzzle is stated, not solved, and LPS2 finds the crossings itself. No account is needed. The Help menu holds the tutorial, the guide to the editor and the language reference.
On your own machine. You need SWI-Prolog and Node.js:
git clone https://github.com/LogicalContractsOrg/lps2.git
cd lps2/ui && npm install && npm run build
cd .. && ./lps ide
The editor is then at http://localhost:3060/. To run programs written in Logical English, point LPS2 at a copy of Logical English 2, as the README says.
Open source. https://github.com/LogicalContractsOrg/lps2 (Apache 2.0), with the documentation, the examples and a conformance suite checked against the original implementation.
Videos
Short narrated recordings of the editor at work. All are on our YouTube channel.
| Video | Length |
|---|---|
| Smart contracts on LPS: a Solidity token and a Daml contract | 8:12 |
| Interactive fiction on LPS | 7:22 |
| Introducing interactive fiction on LPS | 5:01 |
| Solidity on LPS | 5:22 |
| Daml in Logical English | 3:42 |
| Drools in Logical English | 3:34 |
| Miniscript in Logical English | 3:36 |
| Epilog in Logical English | 2:49 |
What is licensed
Everything above is open. Three things are not: Deploy as Solidity, which writes a program back out as an Ethereum contract; the reader of Drools rule files; and the translators that open Solidity, Daml, Epilog, L4 and Drools programs as Logical English. They are part of the Logical English Translators, and the hosted editor offers them to visitors who hold that licence.
