In the same way that Markdown compiles to HTML which is then interpreted by web browsers into pixels on a screen, I find it fascinating to consider the logical next step: the runtime environment in which "legal code" runs.

A contract is really a function of (world state) -> (booleans for parties in breach), and lawyers excel at traversing the function space of possible contracts based on simulations of possible world states, making them optimizers over those function spaces. Their "speculative execution" and ability to cull parts of that search space are based on having efficient caches of case law; we literally train lawyers to be optimal caches by having them take bar examinations, because even with databases at these professionals' fingertips, the latency with which they can simulate contract space given novel information (in trial, in live conversations with clients) is a core competency of the profession.

I wonder if some of the tooling and philosophies being developed in the machine learning world can be applied to great effect in this context...

You might be interested in Merigoux et al 2021, "A Modern Compiler for the French Tax Code" [1]!

[1]: https://arxiv.org/pdf/2011.07966.pdf

--> https://github.com/MLanguage/mlang

"Compiler for the M language, used to compute the income tax of French taxpayers"