Here to write code? The developer site is at lextml.dev
LexTML

Open research initiative · Design v0.2

The whole law of a legal order, written as one typed, testable program.

LexTML, the Lex Typed Meta-Language, is a design for a programming language that encodes the decision logic of law in full: what can be computed, what an official decides, and what calls for judgement. No compiler exists yet. The design is published first, so that lawyers and scientists can challenge it before any code is written.

Design
version 0.2
Compiler
not built yet
Open hypotheses
97
First pilot
Ukrainian tax law

Why

Why another language for law

  1. Law already runs as software, written far from the text. Encoding it faithfully exposes mistakes: the Catala project found a bug in an existing implementation of French family benefits while formalising them.

  2. Existing languages cover the part of law that is computation. Much of law is something else: an official’s decision, an open standard such as “reasonable”, a precedent, a collision between two norms.

  3. The aim is full coverage, not full automation. Every provision gets a typed representation. Only some get a deterministic answer. The rest get a structured, testable procedure whose output is advice with a trace.

The idea

How it works

  1. Logic only

    A program holds the logic of decision-making. Legal text stays outside and is referenced by an identifier and an edition.

  2. One program per legal order

    Legal institutions are classes, norms are methods, and each method is assembled from clauses bound to their sources.

  3. The legal order describes itself

    Sources, powers, ranking and conflict rules are written as norms in the same language. There are no dialects per country or legal family.

  4. Exceptions, ambiguity and discretion are explicit

    An exception stated by the text is its own construct. An ambiguous text can carry alternative readings. Every decision clause says whether it is a duty or a discretion.

  5. Judgement as advice

    An open standard becomes named criteria assessed by a model. The model is recorded with each result, and the output is advice with measured reliability.

  6. Lawyers validate without reading code

    Tests are part of the program. Lawyers check it through tests, traces and references to the text.

Three kinds of result

Computed
Worked out deterministically from the rules and the facts, with a trace to its sources.
Decided
A named actor picks one of a closed set of outcomes on stated grounds.
Advisory
For an open standard such as “reasonable”, a person decides, advised by a score, a rationale and measures of stability.

A result is never more trustworthy than what it depends on. An advisory result reaches a binding output only through a recorded adoption step by a named role.

Limits

What is not proven

LexTML is a design, not a product. Its limits are stated as plainly as its ideas.

  • Every known limitation is held as an open hypothesis with a test and a workaround. Version 0.2 lists 97 of them.

  • Nothing has been tested on real law yet. The first pilot will do that.

  • There is no formal grammar. The syntax in the documents is a placeholder.

  • Whether an automated or assisted decision is lawful is a question for each jurisdiction, and it is open.

Take part

Where your expertise is needed

The design has to hold for legal systems its authors do not know. That work needs you.

  • Legal theory and comparative law

    Does the core fit your legal family? Test whether a legal order’s ranking of sources and its conflict rules can be written as norms, and where that fails for customary or religious law.

  • A specific legal system

    Bring your legal order. Describe its sources, powers and conflict rules, and lead or review its encoding. Each legal order has its own repository.

    Ukrainian legal order
  • Legal practice

    Practising lawyers and tax specialists validate encoded norms through tests and traces, and say whether that is enough without reading code.

  • AI and law, formal methods, programming languages

    Challenge the treatment of exceptions, alternative readings, precedent and the flow of trust between kinds of result. Point to prior work that was missed.

  • Public administration and legislative drafting

    Show how duty and discretion, decision records and registers work in practice, and what would make a result usable by an official.

Join the community

Call for discussion

Seven questions for readers

  1. Kinds of result

    Is the split into computed, decided and advisory results, with an enforced flow of trust between them, the right backbone for law as a whole?

  2. Self-description

    Can a legal order’s ranking of sources and its conflict rules be written as norms without distorting them?

  3. Exceptions and readings

    Do a text-stated exception with a declared effect and burden, and bounded alternative readings, match how lawyers reason about departures and ambiguity?

  4. Validation

    Would practising lawyers accept validating a program through tests, traces and references to the text, without reading code?

  5. Judgement calls

    Is criteria-based model advice with recorded reliability a defensible treatment of open standards, or should they stay outside the program?

  6. Hypotheses

    Which of the 97 does existing evidence already confirm or refute?

  7. Prior work

    What has been missed?

Pilots

Where the design will be tested

  1. Ukrainian tax law

    The first pilot, chosen for its importance and complexity. Status: planned. The inventory of the domain is the next step.

  2. US trade-secret law

    The second pilot: a domain built on precedent, to test the same language on case law.

  3. A third pilot, with a community partner, on a legal order centred on custom

    It is not planned yet, and a partner is sought. If that could be you, say so in the form.

Read

Documents

Three documents, published under CC BY 4.0 in one repository. Comments and proposals are welcome there as issues and discussions.

  • Language Specification v0.2

    The design, a syntax sketch, and the registers of decisions and hypotheses.

  • Implementation Guide v0.2

    Recommended practice that the language does not enforce: test levels, judgement models, registers, and how lawyers validate.

  • Pilot Plan v0.2

    The pilots, the working order, and the step at which each hypothesis is tested.

Open the repository

Join

Join the community

Take part in the work

I would like to

1000 characters at most

Mailing list

Updates when a new version of the documents or a pilot result is published.

Want to build the compiler instead? Go to lextml.dev