Skip to content

Fix #737 by computing rec_type after adjust_sign_arity in equations.ml - #738

Open
blume0 wants to merge 1 commit into
rocq-prover:mainfrom
blume0:fix_737_wfrec_implicit_argument
Open

Fix #737 by computing rec_type after adjust_sign_arity in equations.ml#738
blume0 wants to merge 1 commit into
rocq-prover:mainfrom
blume0:fix_737_wfrec_implicit_argument

Conversation

@blume0

@blume0 blume0 commented Aug 4, 2026

Copy link
Copy Markdown

Fixes #737.

Functions in covering.ml carry around information of type int_data. It is computed in part in Equations.define_by_eqs and contains a field rec_type which among other things, for well-founded recursive definitions carries the data of the position at which the additional wf recursion argument should be added. This position is the length of context of the signature of the function to be defined, howerer this signature is sometimes extended when the return type is a product type. The constructed internal type of the function that is used for the fixpoint combinator uses this updated signature, making the computed rec_type outdated.

This PR does the following:

  • move the interpretation of pre_equations into pre_clauses and the call to adjust_sign_arity from Covering.program_covering to Equations.define_by_eqs.
  • compute rec_type data after adjusting the signature and the arity of the program
  • minor change: make compute_fixdecls_data take an evar_map instead of a reference since it doesn't modify it

There should not be any observable change in behavior apart from the rec_type now being computed with the relevant signature, because the two operations that were moved above were happening right after in Covering.program_covering with the same arguments, and Equations.define_by_eqs is the only caller of program_covering. This is also makes the treatement similar to the one done for local wheres in Covering.interp_wheres in which rec_type was computed after adjusting the signature.

… in equations.ml

- move the interpretation of `pre_equations` into `pre_clauses` and the call to
  `adjust_sign_arity` from `Covering.program_covering` to `Equations.define_by_eqs`.
- compute `rec_type` data *after* adjusting the signature and the arity of the
  program
- minor change: make `compute_fixdecls_data` take an evar_map instead of a reference
  since it doesn't modify it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ill placed well-founded recursion implicit argument when including patterns for part of arity

1 participant