A total that means exactly 20
define total as the sum of 12 and 8. check total is equal to 20.
Named definitions keep the check readable without adding context-dependent language.
English-friendly · Lean-backed
Write a small, fixed form of English. See its structure. Make the meaning precise enough for Lean.
Plain is a working name.
This JavaScript model previews parsing and closed arithmetic. It does not run Lean or its kernel. It resolves earlier Plain definitions only, not constants from a Lean environment. The Lean sketch shows the intended translation. Browser limits: 8,000 input characters, 100 sentences, 64 nesting levels, and 10,000 calculated digits.
01 / Interface
A fixed vocabulary, explicit nesting, and useful errors. No guessing what the writer meant.
define name as expression.check proposition.number · name · the sum of A and B
the product of A and BA is equal to B
A is greater than B
A is less than Bboth (P) and (Q)
either (P) or (Q)
not (P)Overlap
Interface Library
Every phrase is a typed signature, not just a writing rule. Names are case-sensitive and follow [a-z][a-z0-9_]*.
Check it is about twenty.
check total is equal to 20.
02 / Implementation
Parsing chooses the structure. Type checking chooses what is meaningful. The kernel checks the proof.
Words, names, numerals, punctuation. Preserve the source location for every error.
One sentence produces one syntax tree. Missing or extra words are errors.
Resolve names and construct typed Lean expressions over Nat and propositions.
A closed check must produce a proof accepted by Lean’s kernel.
The browser model above is an explainer. The compiler’s acceptance gate is the actual Lean build. A successful preview is not a kernel-checked proof.
Lean 4.34.1 prototype validated: the build passes, with 2,865 generated syntax-tree round trips, 14 syntax-negative cases, and 6 compiler-rejection fixtures. Closed arithmetic and logic examples are kernel-checked using ordinary decide, with no sorry, added axioms, or native_decide.
The tests cover false checks, unknown names, wrong-type references, redefinitions, trailing prose, and hidden unknown names. These results do not constitute a formal proof of grammar unambiguity.
plain "define total as the sum of 12 and 8." plain "check total is equal to 20."
ApplicationImplementation A check is a useful requirement and a proof obligation.
03 / Application
Start with closed arithmetic specifications. Keep the facts, the names, and the exact claim in the same small document.
define total as the sum of 12 and 8. check total is equal to 20.
Named definitions keep the check readable without adding context-dependent language.
check both (total is greater than 10) and (total is less than 30).
Both conditions are written down. The conjunction is part of the syntax tree.
Natural numbers, arithmetic, comparisons, and Boolean-shaped propositions. No open-ended prose, world knowledge, units, quantified claims, or automatic interpretation of existing requirements. v0 has sum and product; no subtraction, division, negative numbers, or floats.
04 / Library
A phrase earns its place by having a precise signature and a Lean meaning.
Numerals and named definitions
Natthe sum of A and B · the product of A and B
Nat × Nat → Natis equal to · is less than · is greater than
Nat × Nat → Propboth … and … · either … or … · not …
And · Or · NotAdd phrases only when their types, semantics, and examples are explicit. A domain dictionary extends the library and the language interface together.
LibraryInterface A new phrase is an API change. “Either” means inclusive or.
Project map
The views describe the same project. They overlap wherever a language feature becomes a usable, checked building block.