New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add head reduction flags (lazy head beta
etc)
#17503
Conversation
@coqbot run full ci |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions. Would be good to add the index entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you!
I would also be quite interested in modifiers that meant "don't go underneath lambdas". Should I open a separate issue for that?
test-suite/output/reduction.v
Outdated
@@ -11,3 +11,6 @@ Eval simpl in (fix plus (n m : nat) {struct n} : nat := | |||
|
|||
Eval hnf in match (plus (S n) O) with S n => n | _ => O end. | |||
|
|||
Eval weak simpl in 2 + 2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also test 2 + (2 + 2)
(behavior on terms with non-normal arguments) and
hold (fun x => 1 + x)for
Axiom hold : forall {T}, T.` (when the arguments to the whnf have lambdas)
If we want to add modifiers we should probably not go with this syntax and instead put the modifiers among the flags (beta etc) |
I'd be fine with |
Only if we document the behavior/differences! |
But "go in subterms but not under binders" is also meaningful for cbn & co. |
That's true. But it's also the natural meaning of "weak" for cbv ("stop once you're guaranteed that there can be no more redexs in the head position"). But in any case, I care more about having the functionality at all than about what the syntax is. And I support merging this PR with the current syntax. (Though I do think it'd be cleaner overall to have two flags instead of prefixes, one for "stop when there are guaranteed to be no redexs in the head position", and another for "do not traverse into the bodies of lambdas/Pis".) |
Related to the flag discussion, I'm not a huge fan of adding non-identifiers in the list of reductions, since this easily causes mayhem with parsing (think about future parsing extensions). If not a flag, this should rather be called |
weak lazy
weak cbn
weak simpl
lazy head beta
etc)
|
OK if you insist. Then how to proceed? You fix the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK to me.
Note that the following will later have to be done:
- weak cbv (but Support for weak cbv #18190 will do)
- support for the
head
flag at the syntax level in Ltac2
Regarding terminology: head
looks good because more intuitive than weak-head
(e.g. using the word whd
would have looked a bit jargon).
Also: will it be "acceptable practice" that the weak cbv PR modifies the change log of this PR? Added: I guess so. |
@coqbot ci minimize ci-analysis |
I am now running minimization at commit 6bbecf5 on requested target ci-analysis. I'll come back to you with the results once it's done. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
I expect the minimization will not go anywhere without help; the file takes 10s to run and is 3700loc... |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Looks like it was a temporary problem anyway, probably some incompatible mathcomp change. |
@herbelin this should be ready to merge |
@coqbot: merge now (finally!) |
@herbelin: Please take care of the following overlays:
|
Adapt to coq/coq#17503 (raw/glob_red_expr moved)
NB: the
cbv
code doesn't seem to have a weak mode (I guess it wouldjust mean not reducing under binders).
Overlays: