Fix de Bruijn index bug in inductive_of_mutfix.find_ind#22127
Fix de Bruijn index bug in inductive_of_mutfix.find_ind#22127JasonGross wants to merge 1 commit into
Conversation
|
maybe also add a coqc test with Definition my_length (T:=list nat) := fix my_length (l : T) : nat :=
match l with
| nil => O
| cons _ l' => S (my_length l')
end.? |
deeb4f1 to
a3514da
Compare
|
@coqbot run full ci |
|
Why are the tests in two different files, in success? A single file in bugs should be checked by rocq check. |
I added it in response to @SkySkimmer 's comment, but indeed I don't understand what the second file adds over the existing one (neither in content nor in mechanism of being tested). What is the thing that you believe is missing from the coqchk test @SkySkimmer ? |
…type In `inductive_of_mutfix.find_ind`, `find_inductive` was called on the type of the structural argument `ty` using the environment *after* `push_rel`, but `ty` is a term valid in the context *before* the push. When `ty` contains de Bruijn indices (e.g. a reference to a section Let-binding), they would be shifted by one, causing `find_inductive` to resolve them to the wrong binding. This was introduced by a46bbfb ("Reorder and cleanup in inductive_of_mutfix.find_ind") which moved `push_rel` before the `find_inductive` call. The original code correctly used the pre-push environment. Fixes rocq-prover#22125. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
a3514da to
21edf32
Compare
|
Files merged. Note that full ci passed before I rebased, but I guess we might as well @coqbot run full ci |
|
The second test could fail in rocq c directly, instead of requiring rocq check to appear; it's going to be easier to debug if it gets broken again. I imagine there's nothing deeper. |
Summary
inductive_of_mutfix.find_indthat causedrocq check(and the kernel guard checker) to fail on fixpoints whose structural argument type contains a de Bruijn reference (e.g., a sectionLet-bound type alias).push_relbefore thefind_inductivecall. Sincetyis valid in the pre-push context, de Bruijn indices intywere resolved to wrong bindings in the post-push environment.test-suite/coqchk/bug_22125.v).Fixes #22125.
Test plan
Section S. Let T := list nat. Fixpoint my_length (l : T) ... End S.now passesrocqchkcoqchktests pass🤖 Generated with Claude Code