Test "corner-cases/vanishing-occurrence"
Expected: 🤷 either · Size: 7.4 KB · Lines: 110 · lean4export: 3.2.0 · Lean: 4.38.0-nightly-2026-12-03 · 📄 Declaration · 🔗 Source
Two inductive types whose constructor field mentions the type being declared only inside a beta-redex that weak head normalisation removes:
| node : (fun _ : Type => Nat) VanishPos → VanishPos
| node : (fun _ : Type => Nat) (VanishNeg → Nat) → VanishNeg
A checker that puts a constructor field in weak head normal form before
looking for occurrences finds Nat and accepts both (the tutorial's
reduceCtorParam shows the same reduction keeping an occurrence). Weak
head normalisation does not reduce below the head: when the vanishing
occurrence sits in the domain of an arrow inside the field, as in
corner-cases/positivity-whnf or the tutorial's indNegReducible, such a
checker rejects. The isRec flag in the export, on the other hand, comes
from a syntactic search, so the export says isRec = true for both types
although the only occurrence is reduced away before the positivity check.
A checker that looks for occurrences before reducing, or recomputes isRec
after reducing, rejects these two; that is a reasonable reading of a rule
that is not applied uniformly here (see the discussion at
Lean Kernel Arena PR #181). The elaborator
never writes such a field.