Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] deactivating implicit args via tactic

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] deactivating implicit args via tactic


Chronological Thread 
  • From: Jason Gross <jasongross9 AT gmail.com>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] deactivating implicit args via tactic
  • Date: Thu, 12 Nov 2015 14:48:20 -0500
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi0-f44.google.com
  • Ironport-phdr: 9a23:0nOuQhdJgTNel277lTW8Z1jElGMj4u6mDksu8pMizoh2WeGdxc6+bR7h7PlgxGXEQZ/co6odzbGG7ua8CCdZu8jJmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbviptuPMk4R3mT1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu2pN5g/GLdfFXEtN30/rJngsgCGRg+S7FMdVH8Xm1xGGV6Wwgv9W8LTuzD9sKJSwi6BJoWiT7kvXjKt9aBwU07AhyIONjp/+2bS3J8jxJlHqQ6s8kQsi7XfZ5uYYaJz

Does this do what you want?

Tactic Notation "with_open" open_constr(v) tactic3(tac) := tac v.

Tactic Notation "foo'" uconstr(v) tactic3(foo2) :=
  first [ let v' := constr:v in tryif has_evar v' then fail else pose proof v
        | with_open v foo2 ].

Ltac foo2 v :=
    idtac;
    match v with
      | ?f _ => foo' f foo2
      | _ => fail 1
    end.

Tactic Notation "head_pose_proof" uconstr(v) := foo' v foo2.

Goal True -> True.
  intro H.
  head_pose_proof eq_refl.

Or, if you want something simpler:

Ltac head x :=
  match x with
    | ?f _ => head f
    | _ => constr:x
  end.

Tactic Notation "head_pose_proof" open_constr(v) := let v' := head v in pose proof v'.

which may or may not have the behavior you want on things with explicit arguments already passed.



On Thu, Nov 12, 2015 at 11:35 AM, Jonathan Leivent <jonikelee AT gmail.com> wrote:
Given the name of a function with implicit args, say "foo", the name "@foo" names the same function with all args made explict.  However, the "@" does not seem to be an operator that one can apply to a name tactically.  For example - the following doesn't work:

Tactic Notation "Explicitly" uconstr(L) := pose proof @L.

as it appears to ignore the "@", with the result that pose proof fails due to uninferrable implicits.

Is there any way to take a name of a function and tactically change it to its explicit version?

-- Jonathan





Archive powered by MHonArc 2.6.18.

Top of Page