Skip to content

Overview of the current system

As the current user-facing documentation puts it,

while there is one generic L4 syntax, L4 really admits of different fragments, each with their own specialized semantics, corresponding to the various transpilers.

We'll systematically discuss each of these dialects / transpilers and their statuses when we discuss the codebase in more detail. But before doing that, let's briefly survey what I (YM) take to be the most currently functional components of the L4 ecosystem --- or, to put it another way, what one can currently do with L4.

To clarify, this page aims to introduce the L4 ecosystem by highlighting the the most interesting things that can be done with it, and its key dialects. It does not discuss in-the-weeds details about the codebases or their architecture --- see the Codebase section for that.

Starting from a Natural4 encoding of a set of legal rules, you can automatically:

  • parse the spreadsheet CSV into an internal representation: see codebase/natural4
  • generate a web form "expert system" that interviews an end-user and returns a result.
  • The simple version of this only deals with propositional logic.
  • The Logical English version deals with numbers and dates too
  • New infrastructure uses the mathlang codebase.
  • visualize the simple Boolean decision logic, which is the subject of constitutive rules,
  • as a black-and-white SVG ladder diagram
  • as an interactive HTML widget
  • visualize the state transition logic, which is the subject of regulative rules,
  • as a Petri Net
  • statically analyze the state transition logic
  • using Maude
  • test the rules against user-specified "unit tests" similar to Cucumber/Gherkin
  • this is on the roadmap and has not yet been built yet

The MathLang system and transpiler

The MathLang codebase is intended to produce a Javascript runtime suitable for in-browser execution of decision rules originally encoded in L4.

See:


Natural Language Generation

The current codebase for NLG is in natural4/src/LS/NLP/NLG.hs, and the grammars it is based on are in natural4/grammars.

The NLG codebase was used by the web form generation. The main goal was to convert the conditions in the rules into questions.

For a longer description, see NLG.

Status

This was in use for the PDPA use case and the Rodents and vermin demo, both from 2021/2022. In the insurance use case, we shifted to Logical English, and it didn't use the GF-based NLG at all.

We have ambitions to restart the NLG efforts—more in the dedicated page for NLG.

Natural L4 syntax specification

Finally, a specification of sorts of the Natural L4 syntax is available here.