Lean Kernel Arena / lazylean

Checker "lazylean"

Language: C++ C++ · Version: 0.3.0 · 📄 Declaration · 🔗 Source

lazylean — a Lean 4 kernel in C++ whose reduction engine is a lazy abstract machine in the style of the Coq kernel's cClosure, rather than Lean's substitution-based whnf.

  • The type-checking algorithm is Lean's own (is_def_eq, lazy delta reduction with reducibility hints, proof irrelevance, eta, K-like recursors, Nat/String literals with GMP), cross-checked against lean4lean; recursors are re-derived from the inductive specification and compared with the exported ones.
  • Weak-head normalisation runs a Krivine machine: closures over environments, call-by-need thunks overwritten with their value when first forced, constant C++ stack, reference-counted memory proportional to the live data.
  • Lean's compiled match/brecOn wrapper chains are fused once per definition, and structurally recursive definitions get Coq-style fixpoint rules that the kernel verifies with is_def_eq before using them.
  • Lean.reduceBool/reduceNat (native reduction) are declined.
  • Declarations are checked by worker processes forked after the export has been parsed, so the parse and the interned terms are shared rather than repeated; the export's declaration order is verified first, so that no worker can be shown a constant introduced after the one it is checking.

Written by Claude (Anthropic), directed by Chris Emery.

Soundness (rightfully rejected tests)

94 ✅ 3 ❌ 0 🚫

Completeness (rightfully accepted tests)

145 ✅ 1 ❌ 4 🚫

Corner cases (no outcome prescribed)

28 ✅ 2 🚫

Test Expected Result ⏱️ 🧠
cedar 👍 ⌛ — —
con-leche 👍 👍 1.73 min (÷2.1) 1.1 GB (÷6.2)
cslib 👍 ⌛ — —
init 👍 👍 37.2 s (-44%) 416.3 MB (-30%)
init-prelude 👍 👍 105 ms (÷3.6) 28.7 MB (÷3.5)
mathlib 👍 ⌛ — —
navier-stokes-euler 👍 👍 6.65 min (-41%) 1.8 GB (-29%)
reachability 👍 👍 3.24 s (÷7.3) 192.9 MB (÷8.7)
std 👍 ⌛ — —
36 11.3 s 14.6 GB
closure-level-subst ✋ ✋ 1.13 ms 21.2 MB
const-level-arity ✋ ✋ 1.07 ms 21.3 MB
constlevels ✋ ✋ 1.33 ms 21.2 MB
ctor-num-fields ✋ ✋ 1.52 ms 21.1 MB
eta-ctor-alias ✋ ✋ 1.18 ms 21.2 MB
inductive-forged-all ✋ ✋ 1.09 ms 21.2 MB
k-rec-conv ✋ ✋ 1.31 ms 21.4 MB
large-elim-param ✋ ✋ 1.19 ms 21.2 MB
large-elim-prop-bool ✋ ✋ 1.36 ms 21.1 MB
level-imax-leq ✋ ✋ 1.13 ms 21.2 MB
level-imax-normalization ✋ ✋ 1.18 ms 21.2 MB
loose-bvar-value ✋ ✋ 1.07 ms 21.2 MB
nat-log2-not-native 👍 👍 2.41 ms 21.5 MB
nat-log2-not-native-bad ✋ ✋ 3.21 ms 21.6 MB
nat-rec-k-lie ✋ ✋ 1.15 ms 21.4 MB
nat-rec-rules ✋ ✋ 1.16 ms 21.4 MB
nat-shift-huge 👍 ✋ 11.8 ms 23.2 MB
nested-name-capture ✋ ✋ 1.18 ms 21.1 MB
nested-rec-hijack ✋ ✋ 1.34 ms 21.3 MB
nested-rec-rule-nfields ✋ ✋ 1.86 ms 21.3 MB
nested-unused-param ✋ ✋ 2.46 ms 22.2 MB
open-term-cache-context ✋ ✋ 1.08 ms 21.1 MB
orphan-rec ✋ ✋ 1.07 ms 21.4 MB
pi-closure-context ✋ ✋ 1.07 ms 21.3 MB
proj-non-structure ✋ ✋ 1.13 ms 21.1 MB
proj-of-imax-prop ✋ ✋ 1.33 ms 21.2 MB
proj-of-param-prop ✋ ✋ 1.26 ms 21.2 MB
proj-of-stuck-prop ✋ ✋ 8.94 ms 23.2 MB
proj-of-subst-prop ✋ ✋ 9.11 ms 23.2 MB
quot-bad-type ✋ ✋ 11.2 s 14.6 GB
rec-k-lie ✋ ✋ 1.12 ms 21.1 MB
rec-missing-ih ✋ ✋ 9.16 ms 23.1 MB
rec-of-subst-prop ✋ ✋ 9.27 ms 23.2 MB
rec-rule-proof-irrel ✋ 👍 1.50 ms 21.2 MB
rec-rule-proof-irrel-nested ✋ 👍 1.69 ms 21.2 MB
rec-rule-wrong-arg ✋ ✋ 1.42 ms 21.2 MB
rec-type-proof-irrel ✋ 👍 1.51 ms 21.3 MB
str-lit-utf8 👍 👍 19.8 ms 22.9 MB
str-lit-utf8-bad ✋ ✋ 21.8 ms 23.6 MB
unit-rec-rule ✋ ✋ 1.11 ms 21.2 MB
1 43.9 ms 22.7 MB
alg-conv-trans-acc 🤷 ✋ 2.94 ms 22.7 MB
alg-conv-trans-acc-left 🤷 👍 2.90 ms 22.3 MB
alg-conv-trans-acc-right 🤷 👍 3.00 ms 22.2 MB
alg-conv-trans-quot 🤷 ✋ 1.22 ms 21.2 MB
alg-conv-trans-quot-left 🤷 ✋ 1.23 ms 21.0 MB
alg-conv-trans-quot-left-def 🤷 👍 1.24 ms 21.1 MB
alg-conv-trans-quot-right 🤷 👍 1.21 ms 21.1 MB
eta-ctor 🤷 ✋ 1.21 ms 21.1 MB
eta-rec-struct 🤷 ✋ 1.24 ms 21.1 MB
eta-rule-k 🤷 ✋ 1.18 ms 21.1 MB
eta-struct-major-and 🤷 ✋ 1.27 ms 21.1 MB
eta-struct-major-and-no-whnf 🤷 ⌛ — —
eta-struct-major-no-whnf 🤷 ⌛ — —
eta-unit-like-nested 🤷 ✋ 1.35 ms 21.1 MB
eta-unit-like-pi 🤷 ✋ 1.16 ms 21.0 MB
eta-unit-like-proof-field 🤷 ✋ 1.17 ms 21.3 MB
eta-unit-like-struct 🤷 ✋ 1.18 ms 21.1 MB
imax-nested-absorption 🤷 ✋ 1.06 ms 21.2 MB
imax-right-successor 🤷 ✋ 1.06 ms 21.3 MB
large-elim-maybe-prop 🤷 ✋ 1.10 ms 21.2 MB
let-value-type-mismatch 🤷 ✋ 1.06 ms 21.3 MB
nested-nonuniform-param 🤷 👍 1.27 ms 20.9 MB
nested-redex-aux 🤷 👍 2.13 ms 21.5 MB
positivity-whnf 🤷 ✋ 1.11 ms 21.1 MB
proj-maybe-prop 🤷 👍 1.20 ms 21.1 MB
proj-maybe-prop-past 🤷 👍 1.20 ms 21.2 MB
proof-param-ok 👍 👍 1.10 ms 21.2 MB
proof-param-swap 🤷 ✋ 1.09 ms 21.4 MB
subject-reduction-redex 🤷 👍 2.99 ms 22.4 MB
subject-reduction-reduct 🤷 ✋ 2.91 ms 22.4 MB
vanishing-occurrence 🤷 👍 1.17 ms 21.1 MB
10 12.8 ms 21.4 MB
extra-rec ✋ ✋ 1.07 ms 21.2 MB
inductive-undeclared-universe ✋ ✋ 1.09 ms 21.3 MB
level-index-out-of-order 👍 👍 1.05 ms 21.2 MB
nat-lit-add 👍 👍 1.57 ms 21.1 MB
nat-lit-add-bad ✋ ✋ 1.57 ms 21.4 MB
nat-lit-ble 👍 👍 1.62 ms 21.4 MB
nat-lit-sub 👍 👍 1.64 ms 21.3 MB
orphan-ctor ✋ ✋ 1.06 ms 21.1 MB
proj-of-prop ✋ ✋ 1.12 ms 21.2 MB
sparse-name-index 👍 👍 1.05 ms 21.4 MB
46 63.1 s (÷3.7) 3.1 GB
app-lam 👍 👍 2.36 s (÷2.1) 77.7 MB (÷19)
args-before-unfold 👍 👍 5.48 ms (÷7.4) 24.4 MB (÷3.8)
beta-ladder 👍 👍 668 ms (÷2.5) 47.1 MB (÷11)
church-numerals 👍 👍 17.0 ms (÷3.0) 30.8 MB (÷3.4)
discarded-argument 👍 👍 9.90 ms (÷17) 24.7 MB (÷3.7)
discarded-argument-match 👍 👍 36.1 ms (÷4.0) 23.5 MB (÷4.0)
folded-constant-first 👍 👍 4.84 ms (÷9.3) 24.7 MB (÷3.8)
folded-constant-last 👍 👍 4.84 ms (÷9.3) 26.6 MB (÷3.6)
fueled-chain 👍 👍 103 ms (-23%) 26.6 MB (÷3.8)
gf3-matrix-product 👍 👍 4.08 s (×2.2) 3.1 GB (-12%)
grind-field-kernel-cancel 👍 👍 5.36 s (÷4.8) 73.9 MB (÷5.1)
grind-ring-5 👍 👍 813 ms (÷2.7) 87.1 MB (÷2.9)
identical-nesting 👍 👍 1.19 ms (÷27) 21.2 MB (÷4.3)
irrelevance-before-evaluation 👍 👍 1.26 ms (÷26) 21.4 MB (÷4.3)
irrelevance-refutes 👍 👍 1.30 ms (÷25) 21.5 MB (÷4.3)
ite-taken-branch 👍 👍 7.16 s (÷2.7) 285.5 MB (÷6.0)
ite-taken-branch-bad ✋ ✋ 2.71 s (÷2.5) 369.7 MB (÷4.6)
let-fold 👍 👍 11.7 ms (÷5.4) 22.6 MB (÷4.2)
let-ladder 👍 👍 366 ms (÷2.8) 36.7 MB (÷9.0)
loop-unfolded-once 👍 👍 187 ms (÷2.8) 30.0 MB (÷3.4)
loop-unfolded-once-bad ✋ ✋ 214 ms (÷67) 31.2 MB (÷3.3)
magma-list-deep-n21 👍 👍 389 ms (÷6.9) 30.7 MB (÷22)
magma-list-deep-n36 👍 👍 5.22 s (÷6.8) 44.7 MB (÷178)
magma-list-pair-n21 👍 👍 5.26 s (÷3.5) 1.2 GB (÷3.4)
magma-list-pair-n7 👍 👍 443 ms (÷3.9) 109.0 MB (÷4.2)
magma-string-n4 👍 👍 1.84 s (-49%) 54.2 MB (÷2.8)
magma-string-pair-n9 👍 👍 3.40 s (÷2.4) 152.1 MB (÷6.6)
proj-app-lazy-delta 👍 👍 375 ms (÷5.5) 412.6 MB (-33%)
proj-applied-struct 👍 👍 3.93 s (÷3.6) 326.2 MB (÷4.5)
proj-applied-struct-arg-bad ✋ ✋ 3.87 s (-18%) 327.2 MB (÷4.4)
proj-applied-struct-bad ✋ ✋ 1.29 s (÷3.8) 324.3 MB (÷4.5)
proj-cheap-struct 👍 👍 2.82 ms (÷14) 21.6 MB (÷4.3)
proj-lazy-struct 👍 👍 1.95 ms (÷18) 21.6 MB (÷4.3)
proj-stuck-struct 👍 👍 2.07 ms (÷17) 21.6 MB (÷4.3)
prop-struct-projections 👍 👍 28.1 ms (÷3.7) 25.2 MB (÷3.8)
refute-cheap-first ✋ ✋ 10.1 ms (÷4.1) 25.4 MB (÷3.7)
refute-cheap-last ✋ ✋ 10.2 ms (÷18) 23.1 MB (÷4.0)
repeated-subproblem 👍 👍 1.37 ms (÷24) 21.1 MB (÷4.4)
shared-subterm 👍 👍 18.6 ms (÷3.3) 28.5 MB (÷3.5)
shift-cascade 👍 👍 88.1 ms (+74%) 31.5 MB (÷3.0)
short-circuit-and 👍 👍 2.66 s (÷6.6) 275.4 MB (÷5.6)
short-circuit-and-bad ✋ ✋ 975 ms (÷6.3) 275.1 MB (÷5.6)
unfold-before-literal 👍 👍 3.93 s (÷3.7) 326.4 MB (÷4.4)
unfold-before-literal-bad ✋ ✋ 1.29 s (÷3.8) 324.0 MB (÷4.5)
unfold-before-literal-fallback 👍 👍 3.93 s (÷3.7) 326.0 MB (÷4.5)
unroll-versus-evaluate 👍 👍 1.39 ms (÷25) 21.4 MB (÷4.3)
141 161 ms 22.0 MB
001_basicDef 👍 👍 1.05 ms 21.0 MB
002_badDef ✋ ✋ 1.05 ms 21.1 MB
003_arrowType 👍 👍 1.05 ms 21.0 MB
004_dependentType 👍 👍 1.05 ms 21.1 MB
005_constType 👍 👍 1.05 ms 21.2 MB
006_betaReduction 👍 👍 1.06 ms 21.2 MB
007_betaReduction2 👍 👍 1.06 ms 21.1 MB
008_forallSortWhnf 👍 👍 1.06 ms 20.9 MB
009_forallSortBad ✋ ✋ 1.07 ms 21.2 MB
010_nonTypeType ✋ ✋ 1.06 ms 21.1 MB
011_nonTypeAxiom ✋ ✋ 1.06 ms 21.1 MB
012_nonPropThm ✋ ✋ 1.05 ms 21.0 MB
013_thmProof 👍 👍 1.06 ms 21.1 MB
014_selfProof ✋ ✋ 1.06 ms 21.2 MB
015_levelComp1 👍 👍 1.05 ms 21.1 MB
016_levelComp2 👍 👍 1.05 ms 21.2 MB
017_levelComp3 👍 👍 1.05 ms 21.3 MB
018_levelParams 👍 👍 1.06 ms 21.1 MB
019_tut06_bad01 ✋ ✋ 1.06 ms 21.1 MB
020_levelComp4 👍 👍 1.05 ms 21.0 MB
021_levelComp5 👍 👍 1.05 ms 21.2 MB
022_imax1 👍 👍 1.05 ms 21.2 MB
023_imax2 👍 👍 1.05 ms 21.0 MB
024_levelMaxComm 👍 👍 1.05 ms 21.1 MB
025_levelMaxAssoc 👍 👍 1.05 ms 21.3 MB
026_levelMaxIdem 👍 👍 1.05 ms 21.1 MB
027_levelMaxAbsorb 👍 👍 1.05 ms 21.1 MB
028_inferVar 👍 👍 1.05 ms 21.2 MB
029_defEqLambda 👍 👍 1.06 ms 21.2 MB
030_peano1 👍 👍 1.10 ms 21.2 MB
031_peano2 👍 👍 1.14 ms 21.0 MB
032_peano3 👍 👍 1.16 ms 21.1 MB
033_letType 👍 👍 1.05 ms 21.2 MB
034_letTypeDep 👍 👍 1.06 ms 21.1 MB
035_letRed 👍 👍 1.06 ms 21.2 MB
036_empty 👍 👍 1.06 ms 21.1 MB
037_boolType 👍 👍 1.08 ms 21.0 MB
038_twoBool 👍 👍 1.11 ms 21.0 MB
039_andType 👍 👍 1.11 ms 21.3 MB
040_prodType 👍 👍 1.11 ms 21.1 MB
041_pprodType 👍 👍 1.11 ms 21.2 MB
042_pUnitType 👍 👍 1.07 ms 21.1 MB
043_eqType 👍 👍 1.11 ms 21.1 MB
044_natDef 👍 👍 1.09 ms 21.2 MB
045_rbTreeDef 👍 👍 1.49 ms 21.1 MB
046_inductBadNonSort ✋ ✋ 1.07 ms 21.1 MB
047_inductBadNonSort2 ✋ ✋ 1.06 ms 21.1 MB
048_inductLevelParam ✋ ✋ 1.06 ms 21.0 MB
049_inductTooFewParams ✋ ✋ 1.06 ms 21.1 MB
050_inductWrongCtorParams ✋ ✋ 1.07 ms 21.2 MB
051_inductWrongCtorResParams ✋ ✋ 1.08 ms 21.2 MB
052_inductWrongCtorResLevel ✋ ✋ 1.08 ms 21.2 MB
053_inductInIndex ✋ ✋ 1.07 ms 21.2 MB
054_indNeg ✋ ✋ 1.07 ms 21.1 MB
055_reduceCtorParam.mk 👍 👍 1.13 ms 21.2 MB
056_reduceCtorType.mk ✋ ✋ 1.08 ms 21.0 MB
057_indNegReducible ✋ ✋ 1.08 ms 21.1 MB
058_predWithTypeField 👍 👍 1.07 ms 21.2 MB
059_typeWithTypeField 👍 👍 1.08 ms 21.1 MB
060_typeWithTypeFieldPoly 👍 👍 1.08 ms 21.2 MB
061_typeWithTooHighTypeField.mk ✋ ✋ 1.07 ms 21.1 MB
062_emptyRec 👍 👍 1.06 ms 21.1 MB
063_boolRec 👍 👍 1.09 ms 20.9 MB
064_twoBoolRec 👍 👍 1.12 ms 21.0 MB
065_andRec 👍 👍 1.11 ms 21.0 MB
066_prodRec 👍 👍 1.12 ms 21.2 MB
067_pprodRec 👍 👍 1.13 ms 21.2 MB
068_punitRec 👍 👍 1.08 ms 21.0 MB
069_eqRec 👍 👍 1.12 ms 21.2 MB
070_nRec 👍 👍 1.10 ms 21.2 MB
071_rbTreeRef 👍 👍 1.55 ms 21.2 MB
072_boolPropRec 👍 👍 1.08 ms 21.2 MB
073_BogusRecursor ✋ ✋ 1.09 ms 21.2 MB
074_existsRec 👍 👍 1.13 ms 21.2 MB
075_typeSingletonRecReduction 👍 👍 1.19 ms 21.2 MB
076_sortElimPropRec 👍 👍 1.17 ms 21.2 MB
077_sortElimProp2Rec 👍 👍 1.19 ms 21.1 MB
078_boolRecEqns 👍 👍 1.25 ms 21.1 MB
079_prodRecEqns 👍 👍 1.25 ms 21.0 MB
080_nRecReduction 👍 👍 1.30 ms 21.1 MB
081_listRecReduction 👍 👍 1.49 ms 21.2 MB
082_RBTree.id_spec 👍 👍 2.59 ms 22.0 MB
083_And.right 👍 👍 1.13 ms 21.1 MB
084_Prod.snd 👍 👍 1.14 ms 21.0 MB
085_PProd.snd 👍 👍 1.14 ms 21.1 MB
086_PSigma.snd 👍 👍 1.17 ms 21.1 MB
087_projOutOfRange ✋ ✋ 1.12 ms 21.1 MB
088_projNotStruct ✋ ✋ 1.11 ms 21.0 MB
089_projProp1 👍 👍 1.20 ms 21.2 MB
090_projProp2 ✋ ✋ 1.21 ms 21.0 MB
091_projProp3 👍 👍 1.20 ms 21.3 MB
092_projProp4 ✋ ✋ 1.21 ms 21.1 MB
093_projProp5 ✋ ✋ 1.21 ms 21.0 MB
094_projProp6 ✋ ✋ 1.21 ms 21.0 MB
095_projDataIndexRec 👍 👍 1.16 ms 21.1 MB
096_projIndexData ✋ ✋ 1.30 ms 21.2 MB
097_projIndexData2 ✋ ✋ 1.31 ms 21.0 MB
098_projRed 👍 👍 1.24 ms 21.0 MB
099_ruleK 👍 👍 1.17 ms 21.1 MB
100_ruleKbad ✋ ✋ 1.19 ms 21.1 MB
101_ruleKAcc ✋ ✋ 1.37 ms 21.1 MB
102_aNatLit 👍 👍 1.09 ms 21.1 MB
103_natLitEq 👍 👍 1.16 ms 21.5 MB
104_proofIrrelevance 👍 👍 1.14 ms 21.0 MB
105_proofIrrelevanceBad ✋ ✋ 1.14 ms 21.1 MB
106_proofIrrelevanceWhnf 👍 👍 1.15 ms 21.1 MB
107_proofIrrelevanceUnderBinder 👍 👍 1.07 ms 21.0 MB
108_unitEta1 👍 👍 1.16 ms 21.2 MB
109_unitEta2 👍 👍 1.15 ms 21.1 MB
110_unitEta3 👍 👍 1.15 ms 21.2 MB
111_indexedUnitEta ✋ ✋ 1.18 ms 21.1 MB
112_structEta 👍 👍 1.31 ms 21.2 MB
113_indexedStructEta ✋ ✋ 1.21 ms 21.1 MB
114_funEta 👍 👍 1.14 ms 21.0 MB
115_funEtaDep 👍 👍 1.15 ms 21.1 MB
116_funEtaBad ✋ ✋ 1.15 ms 21.2 MB
117_reflOccLeft ✋ ✋ 1.12 ms 21.1 MB
118_reflOccInIndex ✋ ✋ 1.13 ms 21.2 MB
119_reduceCtorParamRefl.mk 👍 👍 1.14 ms 21.1 MB
120_reduceCtorParamRefl2.mk 👍 👍 1.14 ms 21.1 MB
121_rTreeRec 👍 👍 1.14 ms 21.0 MB
122_rtreeRecReduction 👍 👍 1.24 ms 21.0 MB
123_accRecType 👍 👍 1.24 ms 21.3 MB
124_accRecReduction 👍 👍 1.42 ms 21.1 MB
125_accRecNoEta ✋ ✋ 1.38 ms 21.2 MB
126_quotMkType 👍 👍 1.14 ms 21.1 MB
127_quotIndType 👍 👍 1.14 ms 21.2 MB
128_quotLiftType 👍 👍 1.14 ms 21.2 MB
129_quotSoundType 👍 👍 1.16 ms 21.0 MB
130_quotLiftReduction 👍 👍 1.20 ms 21.1 MB
131_quotIndReduction 👍 👍 1.19 ms 21.1 MB
132_dup_defs ✋ ✋ 1.05 ms 21.2 MB
133_dup_ind_def ✋ ✋ 1.06 ms 21.0 MB
134_dup_ctor_def ✋ ✋ 1.06 ms 21.3 MB
135_dup_rec_def ✋ ✋ 1.06 ms 21.3 MB
136_misnamed_rec_user ✋ ✋ 1.07 ms 20.9 MB
137_dup_rec_def2 ✋ ✋ 1.08 ms 21.1 MB
138_dup_ctor_rec ✋ ✋ 1.06 ms 21.4 MB
139_DupConCon ✋ ✋ 1.06 ms 21.1 MB
140_falseFromUnsafe ✋ ✋ 1.08 ms 21.3 MB
141_falseFromPartial ✋ ✋ 1.08 ms 21.2 MB