Repository navigation
Open
Labels
milestoneThe tracking issue of a milestoneThe tracking issue of a milestone
Milestone
Description
This milestone writes engine R, the reference type checker. Engine R is a transcription of type_checker.cpp and inductive.cpp of the official kernel. After this milestone, rulean checks proofs. It gives the release v0.3.0.
Spec: docs/spec/14-milestones.md, M2. See also 05, 06 and 09.
Acceptance
- All 235 Arena tests with a fixed outcome give the correct verdict.
- The 30 Arena tests with the outcome "either" match the
v4.35profile. (Build the Arena either tests and check their verdicts in CI #39) - Mathlib is accepted, at any speed.
- R1 and R2 are proved for engine R.
- rulean is submitted to the Lean Kernel Arena.
Checklist
- Universe levels: normal form, equivalence and the order (05.6) (Add the universe level functions of rulean-core #27)
- Expression operations: instantiate, abstract, lift and the loose bound variable range (Add the expression operations of rulean-core #28)
- Engine R: type inference (Add the environment and the type checker of engine R #30)
- Engine R: weak head normal form with the official reduction order (Add the environment and the type checker of engine R #30)
- Engine R: definitional equality with lazy delta, eta, proof irrelevance and unit-like types (Add the environment and the type checker of engine R #30)
- Nat and String literal extensions with primitive pinning (05.8) (Add primitive pinning to engine R #34)
- Declarations: axiom, definition, theorem, opaque and quotient (05.9, 06.5) (Add the declaration checks of engine R #31)
- Inductive types: the checks of 06.2 (Add the inductive checks of engine R #32)
- Nested inductive types (06.3) (Add nested inductive types to engine R #33)
- Recursor generation and comparison with the input (06.6) (Add the inductive checks of engine R #32, Add nested inductive types to engine R #33)
- Unsafe quarantine (05.10) (Add the declaration checks of engine R #31, Add tests for the unsafe quarantine rules #37, Add rulean check with engine R, profiles and the JSON report #35)
- The
v4.35profile (05.2) (Add rulean check with engine R, profiles and the JSON report #35) -
rulean checkwith exit codes and the JSON report (Add rulean check with engine R, profiles and the JSON report #35) - The Arena wrapper and the Arena tests in CI (Add the Arena entry and check the Arena verdicts in CI #36)
- R1 and R2 for engine R
Metadata
Metadata
Assignees
Labels
milestoneThe tracking issue of a milestoneThe tracking issue of a milestone
Activity
Add the universe level functions of rulean-core (#27)
tamnd commentedon Nov 21, 2026
PR #27 is merged. It adds the universe level functions of
rulean-core: the normal form, equivalence, theis_geqorder, instantiation and the check for undefined parameters. The functions followlevel.cppof the official kernel v4.35.0. The next PR is #28, the expression operations.Add the expression operations of rulean-core (#28)
tamnd commentedon Nov 21, 2026
PR #28 is merged. It adds the expression operations of engine R as a transcription of
instantiate.cpp,abstract.cpp,expr.cppandexpr_eq_fn.cppof the official kernel v4.35.0. The store hash of a binder node now does not mix the binder name or the binder info, so alpha-equivalent terms have equal hashes. The next PR is #30, which adds the environment and the type checker.tamnd commentedon Nov 21, 2026
#30 is merged. It adds the environment and the type checker of engine R. The checker infers types, reduces terms to weak head normal form in the official order, and decides definitional equality with lazy delta reduction, eta, structure eta, proof irrelevance, unit-like types and the literal extensions. The three engine R items are ticked. The declaration checks in #31 come next.
Add the environment and the type checker of engine R (#30)
Add the declaration checks of engine R (#31)
tamnd commentedon Nov 21, 2026
#31 is merged. It adds the declaration checks of engine R: axioms, definitions, theorems, opaque constants, mutual blocks of unsafe or partial definitions and the quotient constants. A rejected declaration does not change the environment. The declarations item is ticked. The inductive checks in #32 come next.
Add the inductive checks of engine R (#32)
tamnd commentedon Nov 21, 2026
PR #32 is merged. Engine R now has the inductive checks of spec 06.2, as a transcription of
add_inductiveininductive.cppof the official kernel v4.35.0. The checker checks the types and the constructors, the uniform parameters, strict positivity, the universe bound of the fields, the elimination level and the K flag. It makes the recursors and compares them with the export. The recursor item stays open until #33 adds the auxiliary recursors of nested types.Add nested inductive types to engine R (#33)
tamnd commentedon Nov 21, 2026
Merged #33. Engine R now checks nested inductive types (spec 06.3). The checker builds the auxiliary mutual block, checks it with the rules of 06.2, generates the recursors and compares them with the recursors of the input (06.6). All 225 local Arena tests give the expected verdict, and the full Init prelude is accepted. The next step is #34, which adds primitive pinning (05.8).
Add primitive pinning to engine R (#34)
2 remaining items
Release v0.0.3 (#38)
tamnd commentedon Nov 21, 2026
Merged #37. It adds tests for the quarantine rules of spec 05.10: an unsafe inductive type skips strict positivity, and a theorem that refers to an unsafe or partial constant is rejected. The quarantine array of the report is in #35, so I will tick the quarantine item when #35 is merged.
tamnd commentedon Nov 21, 2026
Release v0.0.3 is out: https://github.com/tamnd/rulean/releases/tag/v0.0.3. It has nested inductives (#33), primitive pinning (#34) and the quarantine tests (#37). The release workflow passed and attached 5 assets.
Add rulean check with engine R, profiles and the JSON report (#35)
tamnd commentedon Nov 21, 2026
#35 is merged.
rulean checknow runs engine R on an export. It selects the semantics profile from the Lean version of the export, and--profilesets the profile. The exit codes are the codes of spec 09.3, and--report FILEwrites the JSON report ofdocs/report.schema.json. Unsafe and partial constants go to the quarantine list of the report. Thev4.35profile covers Lean 4.35 and 4.36. An export from another Lean version gives decline.Add the Arena entry and check the Arena verdicts in CI (#36)
tamnd commentedon Nov 21, 2026
#36 is merged.
scripts/arena-run.shis the Arena entry of rulean, anddocs/arena/rulean.yamlis the draft of the entry. ThearenaCI job runsscripts/arena-check.shon all tests of the Arena tarball. All 225 tests give the expected verdict. #39 adds the 30 tests with the outcome "either", which are not in the tarball.Build the Arena either tests and check their verdicts in CI (#39)
tamnd commentedon Nov 21, 2026
#39 is merged. The new
arena eitherCI job builds the 30 Arena tests that have the outcome "either" with Lean v4.36.0 and checks them with thev4.35profile. The job builds 30 of 30 tests. 28 of 28 pinned tests give the expected verdict, and the 2 tests with no pinned verdict are not run. #39 also puts back the released 0.0.3 section of the CHANGELOG, which an earlier rebase changed.Put the terms of a declaration check in the scratch tier (#40)
tamnd commentedon Nov 21, 2026
#40 is merged. Engine R now checks axioms, definitions, theorems and opaque constants in the scratch tier of spec 04.8. The full Init prelude now takes 54 s and 964 MB, and before it took 93.5 s and 3.45 GB. Std now takes 60 s and 1.6 GB, and before it took 192 s and 4.55 GB. All 225 tests of the Arena tarball give the expected verdict. This is a step toward the Mathlib item, which needs the store to stay inside the memory of a normal machine.
Read the export one line at a time (#41)
tamnd commentedon Nov 21, 2026
#41 is merged.
rulean checknow reads the export one line at a time and computes the SHA-256 digest at the same time, so the export is not in memory as a whole. All 225 tests of the Arena tarball give the expected verdict. The first url test also works on a local build: con-leche, built from its pinned commit and sent to rulean through a pipe, has the hash of the Arena results and is accepted. The check takes 198 s for 36747 declarations, but the peak memory is 7.7 GB, which is too much for Mathlib. I am looking at this now.Build the Arena url tests and check them through a pipe (#42)
tamnd commentedon Nov 21, 2026
#42 is merged.
scripts/arena-build.pynow builds the six Arena tests with aurlfield, and--check RULEANsends each export to rulean through a pipe. con-leche is accepted in this mode. The Mathlib export, built from commit fc4f59e5 with the Mathlib cache, has the hash of the Arena results. The Mathlib check is running now on a local build of main.