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

Get arguments for tactic of form simple_intropattern_list(x) #505

Closed
lukovdm opened this issue Sep 27, 2023 · 4 comments · Fixed by #508
Closed

Get arguments for tactic of form simple_intropattern_list(x) #505

lukovdm opened this issue Sep 27, 2023 · 4 comments · Fixed by #508

Comments

@lukovdm
Copy link

lukovdm commented Sep 27, 2023

I need to write an Intro tactic that also allows for receiving normal intro patterns and also my own intro patterns. To be able to properly accept an intro pattern, I need to have a notation in the form of:

Tactic Notation "eiIntros" "(" simple_intropattern_list(x) ")" :=
  elpi eiIntros x.

amongst other notations.
It would thus be nice to be able to read in an intro pattern list, be able to manipulate it when necessary and pass it on to the intro tactic.

@gares
Copy link
Contributor

gares commented Sep 27, 2023

I see two ways forward.
The quick fix could be to make such a code work:

From elpi Require Import elpi.

Elpi Tactic app.
Elpi Accumulate lp:{{
  solve (goal _ _ _ _ [str X] as G) GL :- coq.ltac.call-ltac1 X G GL.
}}.
Elpi Typecheck.

Goal forall n, n + 1 = 1.
  let tac := intros n in
  elpi app "tac".

here tac is a thunk, so the simple intro pattern data type does not need to be known to elpi. Tactics are already called by name, but apparently we only look for them in the global ltac environment.

The better option would be to expose to elpi this data type

https://github.com/coq/coq/blob/967e2222e79def2c15c6652de2e9f4c015a6dc89/proofs/tactypes.mli#L19-L31

This latter option would make it possible to craft this data in elpi, and not just pass it along.

@gares
Copy link
Contributor

gares commented Sep 27, 2023

Sorry, the implicit question is: would the first approach suffice for your use case?

@lukovdm
Copy link
Author

lukovdm commented Sep 27, 2023

Yes, I think this would work. I only need to call intros on an intro pattern that I have been given by the user on the tactic for now.
Thus my notation would become:

Tactic Notation "eiIntros" "(" simple_intropattern_list(x) ")" :=
  let coqintro := intros x in
  elpi eiIntros coqintro "".

@lukovdm
Copy link
Author

lukovdm commented Oct 6, 2023

After having a talk with my supervisor, I'm sorry to say, it turns out we actually do need to have full access to the intro pattern data type. We have to pull it apart and apply our own steps in between applications of parts of the intro pattern. Also we would need to create new ones from scratch. Would this be possible?

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 a pull request may close this issue.

2 participants