coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gabriel Scherer <gabriel.scherer AT gmail.com>
- To: Coq Club <coq-club AT inria.fr>
- Cc: Francois Pottier <francois.pottier AT inria.fr>
- Subject: Re: [Coq-Club] How to evaluate reflexive tactics? (in a robust way)
- Date: Thu, 8 Nov 2018 11:42:27 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.scherer AT gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk1-f171.google.com
- Ironport-phdr: 9a23:f85dtRUxNebosGHASTFq3pp0g/nV8LGtZVwlr6E/grcLSJyIuqrYbBCOt8tkgFKBZ4jH8fUM07OQ7/i/HzRYqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba9wIRmssQndqtQdjJd/JKo21hbHuGZDdf5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXMTRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KpwVhTmlDkIOCI48GHPi8x/kqRboA66pxdix4LYeZyZOOZicq/Ye94RWGhPUdtLVyFZDYy8YYkAAeoPM+hbsofzuUcBoACkCgWwHu7i0CNEimP00KA8zu8vERvG3AslH98WsXrbts76NL0TUe+ryKnD0CjNYO9W2Tjj8ojHbAohquyLULJ/a8Xe0lMvFwLbgVWUs4DlJC+a1uQTvGiB8eVgT/mii2Eiqw5rozivwt0ghZXOhoIQ013J8zhyzoUtJdCgVkJ3fdqpHIFTuiyaLYd6XN0uT39ytConyLAKpJi2dzUQxps93R7QcfmHfpCI4h39UOaRJi91hHd/d7K+gxa+6FGgyu7hWsWt3lZGsyhInsTWunAC0BzT7ceHSv9j8Uu7xTmP0AXT5vlFIUAyi6XbN4YszqAsmpcXq0jOHS/7lF/ogKOIaEko4PWk5ub6brn+o5+TLY50igXwMqQ0ncy/BPw1MgcUUGeA4+S81aPs/UnjTLVRkvI2krfWsIrEKsQBvaO5DApV3Zwi6xa7FTupzNMYnXwfIFJfZB2Hl5TpO03JIP3gEfi/hE2snC53yPDCI73uGY7ALmPDkbfkZbZy8VRQyAs1zdBF5pJbEKsNIPzpWkXprtzXEgc5MxCow+bgENh92JseWWWTAq+FMaPdr0WI6/kuIumNYY8aoyz9JOI/6/7vi385g14dcrOz0ZsZcnDrVshhdm6eeDLHhsoLWTMBuRN7R+j3gnWDVyRSbjC8RfRvyCs8DdeJBI3ZR42pyIeK3CqhE4ceMm9PAEqNHHOubI6EVu0BcgqdJ8ZglnoPUr33GNxp7g2nqAKvk+kvFeHT4CBN8Mu7jIEktd2Wrgk78HlPN+rY1miMS29umWZRHm052al+pQp2zVLRiPEk0cwdLsRa4rZyail/LYTVlrUoBNX7WwaHddCMGg7/H4eWRAopR9d0+OcgJkZwH9L40ELG1iuuRqYWzvmFXcNttK3b2Hf1KoB2zHOUjKQ=
A fairly generic solution (I don't know if it already exists) would be a parametrized proxy type, isomorphic to the identity on types, that blocks reduction/simplification. You could use (block_reduction Z) instead of Z as the ECst value parameter.
On Thu, Nov 8, 2018 at 11:25 AM Armaël Guéneau <armael.gueneau AT ens-lyon.fr> wrote:
Dear Coq-club,
I'm writing a reflexive tactic that (roughly speaking) simplifies
arithmetic expressions. It first reifies the goal into something like:
Inductive expr :=
| EAdd : expr -> expr -> expr
| EMul : expr -> expr -> expr
| ECst : Z -> expr.
ECst is a catch-all case: it may store arbitrary-looking terms, not only
numerical constants. These should be treated as abstract by the tactic.
Then, I implemented a [simplify : expr -> expr] Coq function, and proved
that it is meaning-preserving. Finally, my tactic reifies the goal,
applies the theorem specialized to the reified _expression_, and reduces
the result to obtain the simplified goal.
The issue I have is with this last part: I want to evaluate [simplify],
but I do not want the reduction tactic to reduce the contents of [ECst
..], since these can contain arbitrary terms that should be treated as
abstract.
How do I evaluate my tactic in a robust way? I feel like this is a
relatively fundamental issue, and for example I wonder how
[ring_simplifies] works around it? Does anyone know?
For the moment I thought about:
- Listing all the functions transitively used by [simplify] and reduce
with a whitelist (cbv [the functions...]). However: 1) there is a lot of
them 2) it's bad from a maintainability perspective 3) it does not quite
work as the whitelist will include stuff like Nat.eqb that might very
well be used in a [ECst ..].
- Introducing local definitions for the terms in [ECst foo] (using [set
(x := foo)]); and blacklisting these local definitions during reduction.
There is a technical issue: the blacklist is discovered dynamically, so
I cannot specify it in Ltac using cbv -[foo bar baz]. I guess I could
write a small plugin to handle dynamically constructing the blacklist,
if that's what it takes...
Any ideas?
— Armaël
- [Coq-Club] How to evaluate reflexive tactics? (in a robust way), Armaël Guéneau, 11/08/2018
- Re: [Coq-Club] How to evaluate reflexive tactics? (in a robust way), Guillaume Melquiond, 11/08/2018
- Re: [Coq-Club] How to evaluate reflexive tactics? (in a robust way), Armaël Guéneau, 11/08/2018
- Re: [Coq-Club] How to evaluate reflexive tactics? (in a robust way), Guillaume Melquiond, 11/08/2018
- Re: [Coq-Club] How to evaluate reflexive tactics? (in a robust way), Guillaume Melquiond, 11/08/2018
- Re: [Coq-Club] How to evaluate reflexive tactics? (in a robust way), Armaël Guéneau, 11/08/2018
- Re: [Coq-Club] How to evaluate reflexive tactics? (in a robust way), Gabriel Scherer, 11/08/2018
- Re: [Coq-Club] How to evaluate reflexive tactics? (in a robust way), Sylvain Boulmé, 11/08/2018
- Re: [Coq-Club] How to evaluate reflexive tactics? (in a robust way), Guillaume Melquiond, 11/08/2018
Archive powered by MHonArc 2.6.18.