coq-club AT inria.fr
Subject: The Coq mailing list
List archive
Re: [Coq-Club] Creating an ml-plugin command that introduces a proof environment
Chronological Thread
- From: e AT x80.org (Emilio Jesús Gallego Arias)
- To: Kenneth Roe <kendroe AT hotmail.com>
- Cc: Coq-Club <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Creating an ml-plugin command that introduces a proof environment
- Date: Mon, 15 Jan 2018 09:55:01 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=e AT x80.org; spf=Pass smtp.mailfrom=e AT x80.org; spf=Pass smtp.helo=postmaster AT x80.org
- Ironport-phdr: 9a23:9o5WPRUTiHn0DzlCx3ohiP+DCrbV8LGtZVwlr6E/grcLSJyIuqrYYxCAt8tkgFKBZ4jH8fUM07OQ7/i5HzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba9vIBmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KpwVhTmlDkIOCI48GHPi8x/kqRboA66pxdix4LYeZyZOOZicq/Ye94RWGhPUdtLVyFZAo2ycZYBD+0PPehWrYbzpFUBohSiCgS3GOPj1iVFimPq0aAg0eksFxzN0gw6H9IJtXTZtMv6ObwdUO220KXE1zLDb+lZ2Tzg7ITGfRUhofCIXbJxdsra1E0hGB3ejk2KsozuIjKb2f4Js2if8eVgWuWvgHM7pgFrozig3NwshozPi4kIyV7E7T10zJs2KNC7UkJ3f8CoHZpKuy2HNYZ6X9kuT3xmtSok0rELu5y2cDIXxJknyBPTceKLf5SH7x75SeqdPTV1iXR4c7ylnRmy61KvyujkW8m0zllKqi1Fn8HDt30OyxDf8M+HSuFy/ku52DaP0R7c6v1cLEwplqfWKIQtzqAumpcSq0jPAy37lFjsgKOLeEgo5PCk6+H9bbXnop+cOZV0igb7Mqk2hMOyGus5PwsSU2SB/uS8zrLj8VXjQLpWlv02jrXZsJfCKMsHoa65GhZZ3Zon6xaiFDiry88YnHkCLFJdYh2LlYnpO1fUIPD5F/izmVqskC04j8zBa57sBJPAMniLqrDsNeJ+5khQ0g0+5dBY+5ddC7VHK/X2DBzfrtvdWxIRI1zsheH9B509+4YfXWOISo2UKzHJ+XCB4uYiLO7ETZUUsS28eKtt3OLnkXJswQxVRqKux5ZCLSngRq03cXXcWmLlh5I6KUlPuwM/SOLwj1jTAy4DPzC1Ra1uv2hnWrLjNp/KQ8WWuJLExD2yT89GNjgADUqDQy+xKte0HswUYSfXGfdP1zwJUb/wGZ9xjVeprgCokrc=
- Organization: X80 Heavy Industries
Hi Kenneth,
Kenneth Roe
<kendroe AT hotmail.com>
writes:
> I would like to create a Coq command that introduces a proof
> environment. I would like to create a command "rewrite_rule" that
> takes three parameters (A,B,C). This rule should create a proof
> obligation (A -> B=C). As an example I would like to the user the
> rule in the following manner:
>
> rewrite_rule (mem(a,(b::c))) (mem(a,c)) (not(a=b)).
> Proof. simps. reflexivity. Qed.
>
> My starting point in the ml-plugin is to have this declaration for the
> command:
>
>
> VERNAC COMMAND EXTEND AR
> | [ "rewrite_rule" constr(left) constr(right) constr(cone)] -> [
> Stuff.rewrite_rule left right conditions ]
> END
>
> What should the shell of the implementation look like?
Indeed, this is a delicate operation to implement due to the need to
inform Coq that your command will start a proof. So you have to take
care of two things:
- parsing:
In `VERNAC EXTEND` you must pass a "classifier" that tells Coq that
the command is going to open a proof. The way to do this is:
`VERNAC COMMAND EXTEND Foo CLASSIFIED BY classify_foo`
where `classify_foo` is for example:
`let classify_foo _ = Vernacexpr.(VtStartProof
("Classic",GuaranteeOpacity,list_of_ids), VtLater)`
That should do the job in 8.7, but this interface is likely to change
soon [sorry for that], ping us on Gitter if you have further question.
If you are in 8.8, I recommend using the new:
`VERNAC COMMAND FUNCTIONAL EXTEND` declaration
[see examples in the source code]
- On the actual implementation side, you must use `start_proof` and
friends. Unfortunately there are several functions called
`start_proof`, different on the level of "side-effects" they perform,
I think you should be good with the one in `Lemmas`.
Best,
E.
- [Coq-Club] Creating an ml-plugin command that introduces a proof environment, Kenneth Roe, 01/13/2018
- Re: [Coq-Club] Creating an ml-plugin command that introduces a proof environment, Emilio Jesús Gallego Arias, 01/15/2018
Archive powered by MHonArc 2.6.18.