Skip to content
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

Allow open terms in "apply ->" and "apply <-" (fix #18177). #18946

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

silene
Copy link
Contributor

@silene silene commented Apr 17, 2024

In particular, these tactics can now be used with a symbol that has some implicit arguments.

Fixes / closes #18177

  • Added / updated test-suite.
  • Added changelog.
  • Opened overlay pull requests.

In particular, these tactics can now be used with a symbol that has some
implicit arguments.
@silene silene added part: ltac Issues and PRs related to the Ltac tactic language. kind: enhancement Enhancement to an existing user-facing feature, tactic, etc. request: full CI Use this label when you want your next push to trigger a full CI. labels Apr 17, 2024
@silene silene requested a review from a team as a code owner April 17, 2024 16:19
@coqbot-app coqbot-app bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label Apr 17, 2024
@@ -0,0 +1,7 @@
- **Changed:**
When used with a direction :n:`->` or :n:`<-`, :tacn:`apply` now accepts an open term,
assuming its holes can be inferred during application, as was already the case for plain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what the precise meaning of "assuming" is supposed to be here.
For instance if we do

Axiom foo : unit -> True <-> True.

Goal True.
  apply <- (foo _).

in master it fails and with this PR it succeeds leaving a shelved unit goal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I should trust my Ltac reading skills less.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but note that the following one succeeds on master too.

Axiom foo : unit -> True <-> True.
Goal True.
  let v := open_constr:(foo _) in apply <- v.

So, this pull request is not adding some new semantic behaviors, it is just removing a syntactic limitation.

If you think this will make the changelog clearer, I can stop the entry just after "open term".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how that matters, you can do regular apply with a ltac-bound open_constr too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@silene, IMO the least surprising behavior would be for apply -> and apply <- to match that of apply:

Axiom foo : unit -> True <-> True.
Goal True.
  apply (foo _). (* Error: Cannot infer this placeholder of type "unit". *)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everybody agrees, and if you know how to do that, feel free to implement it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made another attempt at https://github.com/andres-erbsen/coq/tree/fix-18177; it passes both tests so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Enhancement to an existing user-facing feature, tactic, etc. part: ltac Issues and PRs related to the Ltac tactic language.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected apply -> behavior
3 participants