-
Notifications
You must be signed in to change notification settings - Fork 56
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
apply tactic, similar to rewrite #747
Conversation
Not sure if coq.saturate is appropriate here, if we want to be able to apply |
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.
Thanks for your contribution, please have a look at my comments.
apps/eltac/theories/apply.v
Outdated
% from context | ||
coq.typecheck T Ty ok; | ||
% Eq is a reference to a declared variable in the context | ||
std.mem Ctx (decl T _ Ty)), |
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.
Why do you want to check this? Can't it be an arbitrary term?
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.
I just want the type Ty
of the term T
somehow, so that I can iteratively drop down through the nested foralls of Ty
.
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.
Then the typecheck line suffices, no need for the '; mem ...' part
apps/eltac/theories/apply.v
Outdated
apply Term (prod _ _ B) G GL :- | ||
whd (app [Term, Hole]) [] HD ARGS, | ||
unwind HD ARGS Term', | ||
apply Term' (B Hole) G GL. |
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.
There seems to be a misconception here, I think you want to reduce the type, not the proof term
Untested:
apply Term (prod _ _ B) G GL :- | |
whd (app [Term, Hole]) [] HD ARGS, | |
unwind HD ARGS Term', | |
apply Term' (B Hole) G GL. | |
apply Term Ty G GL :- | |
whd Ty [] (prod _ _ B) [], | |
apply {coq.mk-app Term [Hole]} (B Hole) G GL. |
apps/eltac/theories/apply.v
Outdated
Elpi Accumulate lp:{{ | ||
pred apply i:term, i:term, o:goal, o:list sealed-goal. | ||
|
||
apply T _ G GL :- refine T G GL. |
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.
apply T _ G GL :- refine T G GL. | |
apply T _ G GL :- refine T G GL, !. |
I did do a |
Let me know if you can suggest useful ways to eliminate duplication here between apply and rewrite, both of them are doing the same thing where they traverse nested foralls.
Is repeatedly calling
refine
and failing inefficient? I have no idea.I would also be interested if you have suggestions for making it stronger, it would be nice to have it behave as
"if the type of term
f
is unifiable withforall (x : A), B
, then recursively applyf _
. But I don't know how to check that checks whether a type is unifiable with a product type.