Lean Kernel Arena / bugs/open-term-cache-context

Test "bugs/open-term-cache-context"

Expected: ✋ reject · Size: 1.7 KB · Lines: 32 · lean4export: 3.1.0 · Lean: 4.36.0 · 📄 Declaration · 🔗 Source

Proof of ∀ P : Prop, P via a type cache for open terms that ignores the types of the enclosing binders.

-- A := ∀ P : Prop, P,  B := ∀ P : Prop, P → P
theorem openDagContextLeakFalse : ∀ P : Prop, P :=
  (fun f : A → A =>
    (fun (g : A → A) (h : B → A) => h (fun P p => p))
      (fun x : A => f x) (fun y : B => f y))
  (fun z : A => z)

fun y : B => f y is ill typed. The bodies f x and f y are the same expression #1 #0, so the export shares one node between them, at the same binder depth. A checker that caches the inferred type of an open subterm by its identity and binder depth alone reuses the type computed under x : A when it meets the node under y : B, so h turns the trivial proof of B into a proof of A. The file has no axioms and no other declarations.

ocaml4lean accepted this export with the open-term inference of its perf/kernel-overhaul branch (yoonwoojeong/ocaml4lean#7). Found while reading that branch.

Checker Result ⏱️ 🧠
nano-lean ✋ 0.459 ms 11.5 MB
gruszka ✋ 1.75 ms 39.7 MB
sokonanoda ✋ 0.660 ms 28.0 MB
rpylean ✋ 0.860 ms 9.0 MB
pestka ✋ 1.93 ms 13.7 MB
kefir ✋ 0.447 ms 5.5 MB
palladium ✋ 0.538 ms 18.7 MB
con-ron ✋ 29.6 ms 43.0 MB
kefir-wasm ✋ 108 ms 83.0 MB
con-agua ✋ 20.1 ms 11.3 MB
nanobruijn ✋ 0.493 ms 3.4 MB
nanoda ✋ 0.493 ms 3.1 MB
con-leche ✋ 3.95 ms 21.0 MB
pestka-wasm ✋ 85.4 ms 103.9 MB
tenet-jvm ✋ 99.3 ms 64.4 MB
official-nightly ✋ 33.4 ms 108.6 MB
eink0rn ✋ 1.26 ms 10.6 MB
official ✋ 32.2 ms 93.3 MB
ind-models ✋ 100 ms 94.4 MB
tenet ✋ 115 ms 45.2 MB
tenet-hs ✋ 1.09 ms 7.7 MB
kiota ✋ 0.602 ms 11.1 MB
ocaml4lean ✋ 12.8 ms 21.4 MB
logos-kernel ✋ 0.408 ms 4.3 MB
evmlean ✋ 1.06 s 273.0 MB
mini ✋ 33.9 ms 73.2 MB
overfull ✋ 3.44 s 45.5 MB
lean4cobol ✋ 1.90 ms 13.3 MB
lean4lean ✋ 28.1 ms 88.1 MB
canonical-min 🚫 550 ms 1.1 GB
nanoclo ✋ 0.632 ms 31.6 MB
vow-lean-kernel 🚫 113 ms 14.3 MB
lazylean ✋ 1.08 ms 21.1 MB
metalean-slow ✋ 29.7 ms 65.5 MB
metalean-fast ✋ 29.7 ms 66.2 MB
nanoclo-fortran ✋ 0.678 ms 4.3 MB
mathgraph ✋ 0.628 ms 29.6 MB