Visualizations
A handful of components produce visualizations of L4 expressions.
simple ladder SVGs
In 2020, simple Boolean-only decision logic was visualized with a library inspired by ladder logic Boolean circuit diagrams. See the original specification in Google Drive
The tiny versions show up in the sidebar and look like this.
The fuller versions contain text and look like this.
See also SVGLadder.hs
in AnyAll
interactive ladder HTML
Subsequently, interns Jules and Zeming wrote an interactive version in HTML.
This draws the interactive, clickable diagrams at the bottom of the web interview.
- smucclaw/ladder-diagram repo
- There are also docs available for this, via
npm install jsdoc -g
npm run docs
Representation
This represents boolean circuits with this AST. Their AllQuantifier
name is a bit misleading: it's not ∀.
Atomic propositions can be True, False, or Unknown.
expression tree explorer ('mathlang vis')
Our redoubtable interns further wrote code to fold (show/hide) subexpressions of MathLang:
https://github.com/smucclaw/usecases/tree/mathlang-vis-horizontal
To try it out and click through the graph and fill in the questions:
npm i
npm run watch-ts
npm run start
Representation
Boolean logic with arithmetic and exceptions.
See the AST.
The MathlangVis
class renders this tree by converting each NodeTemplate
into HTML elements.
Visualization is coupled with evalaution in this project.
Petri Net stuff
https://github.com/smucclaw/dsl/blob/main/lib/haskell/natural4/src/LS/XPile/Petri.hs
According to Meng (16 May 2024):
- Context: This was meant to be a visualization for the state transition parts / deontics-handling parts of L4.
- Status: Although we still want to offer visualizations for the state transition-y parts in the next iteration of L4, we don't need to stick to Petri Nets. We are free to move to something else, if there are better alternatives.
- Prior Art: one of the earliest papers in the field of computable contracts, Ronald Lee 1998, chose the Petri Net formalism.