Claim: in a non-terminating type theory, we should have *three* different weak-h...
Meven Lennon-Bertrand @mevenlennonbertrand@lipn.info
Claim: in a non-terminating type theory, we should have *three* different weak-head reduction engines (or, more likely, three flags).
Cautious whr: don't unfold too many definitions. Good for conversion checking, where you don't want to reduce too much and have a bunch of fast paths for syntactic equality.
Determined whr: unfold ALL definitions until you get a genuine head constructor. Useful during type checking, for instance for an application, where you really really want to get the function's function type. Respect the heartbeat limit, however, otherwise you can fail to terminate.
YOLO whr: unfold definitions *and ignore heartbeat limit*. This is good if you *know* there *must* be a head constructor, by invariants, and thus this cannot cause non-termination. Useful for re-typing, or grabbing a type's sort (which you know must be there!).
The first two are rather standard, it organically appears as one optimises a mature implementation. The third does not, but I claim it's natural once you think carefully about invariants.