Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Getting tactics in terms to fire later?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Getting tactics in terms to fire later?


Chronological Thread 
  • From: Gregory Malecha <gmalecha AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: [Coq-Club] Getting tactics in terms to fire later?
  • Date: Tue, 31 May 2016 22:22:22 -0700
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gmalecha AT gmail.com; spf=Pass smtp.mailfrom=gmalecha AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi0-f43.google.com
  • Ironport-phdr: 9a23:+hFf1hMYDnR6SiU1pr0l6mtUPXoX/o7sNwtQ0KIMzox0KPv7rarrMEGX3/hxlliBBdydsKIVzbeI+PG/EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35Xxir75qsKbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t4XXskzoShLHzX8BWC1CmR1RRgPB8RvSX5HrsyK8uPAriweAOsijYqo5VjO4/u9OQRvlgycOf2o29WjTh8dwhYpUpRugo1p0xIuCM9LdD+Z3Yq6IJYBSfmFGRMsEEnUZWo4=

Hello --

I'm wondering if anyone has a trick to get tactics-in-terms to fire later? Here's a somewhat contrived example:

Definition foo (ls : list nat) : nat := 0.

Ltac try_something :=
  lazymatch goal with
  | |- nat => exact 0
  | |- bool => exact true
  end.

Notation "'it'" := ltac:(try_something) (at level 0).

Definition bar : nat := foo (it :: nil).

In the last line, we know that the type of 'it' should be [nat] since [foo] takes an argument of type [list nat]. However, when the Ltac actually fires, the goal is a unification variable and therefore neither of branches of the [lazymatch] matches.

Any hackish tricks to get this to work? Possibly something involving 'Program' or canonical structures?

-- 
gregory malecha



Archive powered by MHonArc 2.6.18.

Top of Page