Test "bugs/constlevels"
Expected: ✋ reject · Size: 15.6 KB · Lines: 283 · lean4export: 3.1.0 · Lean: 4.29.1 · 📄 Declaration
Regression test for undefined behavior in lazy_delta_reduction_step that the official kernel had
In the function lazy_delta_reduction_step, the official kernel expected unfold_definition
to always succeed. However, if the constant has an incorrect number of level parameters, it
actually fails, which led to memory corruption in lazy_delta_reduction_step.
This test is to check that the official kernel and also other kernels that closely follow the logic of the official kernel correctly handle this unfolding failure.
The issue in the official kernel was originally reported as https://github.com/leanprover/lean4/issues/10577.