Logical English
Logical English is a way of writing rules in English that a computer can run. A program is a set of sentences. Each sentence follows a pattern, called a template, which the author declares at the top of the program: a person is eligible for a refund if the person bought the goods within 30 days. A lawyer, an underwriter or a caseworker can read the program as it is written. The same sentences are also a logic program, so the computer can answer questions about them, and give the reasons for each answer.
Logical English was designed by Robert Kowalski at Imperial College London, building on four decades of work on logic programming and on legal reasoning, among it the British Nationality Act as a logic program (1986). Logical English 2 is the current implementation, by Logical Contracts with Kowalski and Jacinto Dávila. It is open source under the Apache 2.0 licence.
What you get
- Rules that read as English and run. Templates, rules, facts, dates, numbers, lists and tables, in five languages (English, Portuguese, Spanish, French and Italian).
- Every answer with its explanation. Each answer comes with the chain of rules and facts that led to it. A question that fails is explained too: which condition was not met, and why not.
- Tests inside the program. A scenario is a set of facts with the answers the author expects. The editor runs every scenario and reports which expectations hold.
- Citations. A rule can say which passage of which document it encodes, and the explanation shows the passage.
- Views. Screens for the people who use the rules, written as Logical English sentences and drawn by the editor: a claim form, a classification desk, a questionnaire.
- Assistants. A language model, with your own key, that writes and repairs programs in the editor. The Contract Assistant, part of the licensed Logical English Translators, turns a contract, its schedules and its cases into a tested program that cites the contract.
- For programs that act over time, the sister system Logic Production Systems runs Logical English with events, obligations and a timeline.
Try it
In your browser. Open https://le2.logicalcontracts.com and choose Open the editor. Nothing is installed and no account is needed. The Examples menu holds programs to open and run; the Help menu holds the tutorial, the guide to the editor and the language reference.
On your own machine. Install SWI-Prolog, then:
git clone https://github.com/LogicalContractsOrg/LogicalEnglish2.git
cd LogicalEnglish2
swipl -g "use_module(classic_web_api), start_api_server(3050)"
The editor is then at http://localhost:3050/editor/. The repository’s README says the rest.
Open source. https://github.com/LogicalContractsOrg/LogicalEnglish2 (Apache 2.0), with the documentation, the examples and the test suite. The first implementation, Logical English 1, is at https://github.com/LogicalContractsOrg/LogicalEnglish, with the publications.
Public models
Two models of real regulation are among the examples, each rule citing the passage it encodes, and each with the cases it was checked against:
- Customs classification: chapters 39, 61 and 62 of the United States tariff schedule, run on the facts of published Customs rulings.
- Medicare coverage of medical equipment: all 58 of the Medicare contractors’ coverage determinations for durable medical equipment, run on claims.
Both are provided as they are, without warranty, and are not legal, tax, customs or medical advice. Each says so in its own text.
Videos
Short narrated recordings of the editor at work. All are on our YouTube channel.
| Video | Length |
|---|---|
| Insurance in Logical English: a Socotra product and Medicare coverage | 7:45 |
| Rules as code in Logical English: Blawx, Epilog and LegalRuleML | 7:51 |
| Oracle Intelligent Advisor and OIPA users to Logical English | 8:31 |
| Underwriting guidelines you can run | 4:49 |
| L4 in Logical English and LPS | 4:27 |
| Tariff classification in Logical English | 4:57 |
| Medicare DMEPOS coverage in Logical English | 4:25 |
| Oracle Intelligent Advisor to Logical English | 4:39 |
| A Socotra product in Logical English | 3:40 |
| LegalRuleML in Logical English | 3:27 |
| OIPA in Logical English | 3:04 |
| Blawx in Logical English | 2:58 |
| s(CASP) in Logical English | 2:59 |
Extensions
Two licensed products extend the open system: the Logical English Translators, which read the programs of twelve other rule systems into Logical English, and write some of them back, and which include the LE Contract Assistant, which drafts a tested program from a contract. And the InsurLE language extensions, for contract and statute text that is written with which, unless and numbered conditions. See Logical English Extensions.
