Skip to Content.
Sympa Menu

ssreflect - [ssreflect] Using ssreflect's pattern match for custom tactics

Subject: Ssreflect Users Discussion List

List archive

[ssreflect] Using ssreflect's pattern match for custom tactics


Chronological Thread 
  • From: Ralf Jung <>
  • To:
  • Subject: [ssreflect] Using ssreflect's pattern match for custom tactics
  • Date: Wed, 24 Feb 2016 13:35:01 +0100
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:0zwN7h3l2aOeE9m2smDT+DRfVm0co7zxezQtwd8ZsegTLvad9pjvdHbS+e9qxAeQG96LtLQZ26GK6ejJYi8p39WoiDg6aptCVhsI2409vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6kO74TNaIBjjLw09fr2zQd6NyZnnnLzos7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cYjdt6qJUFCfmyP/lgDO8QMDNzKHsv6cPvuBLfZQ6U/D4dVH8Xm1xJBRLE5Vf0RMTfqCz/49B03CfSH9DwQvhgWymk4I9uUB6tkzgccTkj/zeE2YRLkKtHrUf59FREyInObdTIbPc=

Hi,

For our current Coq project, we'd like some of our tactics to support
patterns. So, for example,

cancel (_ -* _)

should find a magic wand in the goal, and then perform canceling on that
hypothesis.

Robbert asked about how to do this a while ago [1], and we ended up with

Tactic Notation "cancel" open_constr(z) :=
match goal with
| _ : context [?z'] |- _ => unify z z'; real_cancel (z) || fail 2
end.

where real_cancel takes a closed term.
However, we do have some subterms in our goals where the unifier pretty
much diverges when matching against certain patterns. But even with
those patterns and subterms, ssreflect's rewrite works fine.

Is there a way to use the pattern matcher that is also used by
ssreflect's rewrite, which seems to be "smarter" than [unify], in my own
tactics?
If this means custom tactics support ssreflect's contextual patterns and
what not, that would be welcome :)

For now, we ended up sealing our definitions with modules to help the
unifier. But is still rather frustrating to know that there is this
great pattern-matching engine that we use all the time for rewriting,
and that we cannot use for our own tactics.

[1] <https://sympa.inria.fr/sympa/arc/coq-club/2014-11/msg00023.html>

Kind regards,
Ralf



Archive powered by MHonArc 2.6.18.

Top of Page