Do not store recursive trees anymore in inductive blocks.#21901
Do not store recursive trees anymore in inductive blocks.#21901ppedrot wants to merge 2 commits intorocq-prover:masterfrom
Conversation
Backwards compatible, can be merged already.
Backwards compatible, can be merged already.
| infos.is_general | ||
| || Rtree.is_infinite Declareops.eq_recarg | ||
| graph_def.Declarations.mind_recargs | ||
| || Inductiveops.mis_is_recursive graph_def |
There was a problem hiding this comment.
Why is this equivalent, or if not a correct replacement?
There was a problem hiding this comment.
Who cares, this is funind.
There was a problem hiding this comment.
I saw you made the same change for elpi.
yannl35133
left a comment
There was a problem hiding this comment.
I can accept on behalf of @rocq-prover/kernel-maintainers but real users should be the ones to comment on the changes this PR introduces.
|
@ppedrot If you stand by and add in a comment the invariant that "a non-trivial recursive tree / automaton implies it must have a loop", I'll merge this. |
This data is now useless as it can be recovered from the compiled automaton.
da06334 to
7e63485
Compare
|
I've added a comment to mis_is_recursive to make clean the intended semantics. |
| (** Check if a [one_inductive_body] is recursive. An inductive is recursive | ||
| either if it has a constructor that mentions it in its normal form type, or | ||
| if it nested. Note that the latter case means that an inductive is | ||
| considered recursive even if the nesting type does not mention its argument. *) |
There was a problem hiding this comment.
The normal form type of a constructor always mention its inductive (in the codomain).
Also, mutual inductives trigger the check.
Feel free to adapt this suggestion:
| (** Check if a [one_inductive_body] is recursive. An inductive is recursive | |
| either if it has a constructor that mentions it in its normal form type, or | |
| if it nested. Note that the latter case means that an inductive is | |
| considered recursive even if the nesting type does not mention its argument. *) | |
| (** Check if a [one_inductive_body] is recursive. | |
| An inductive is recursive if it has a constructor argument whose type | |
| (or, for function types, the codomain of which) is either | |
| the inductive itself, another inductive of the same mutual block | |
| or another type nesting over the inductive | |
| (without it needing to mention its argument). | |
| Equivalently, an inductive is recursive if its minimized recursive tree is not trivial. *) |
I found another weird edge case, but this is independent from this PR at this stage:
Inductive P (u : unit) := c.
Inductive T := C (x : P (let x := T in tt)).
T is recursive.
This data is now useless as it can be recovered from the compiled automaton.