1

The tactic instantiate can take and ident or a num as:

instantiate (ident:= term)

instantiate (num := term)

Now I want to use the second one inside a tactic definition. For example:

  Ltac my_instantiate n x:=
    instantiate(n:=x).

Unfortunately, this gives the following error:

Ltac variable n is bound to 1 which cannot be coerced to a fresh identifier.

I suspect that ltac is trying to use the first use of instantiate. How do I tell coq to instantiate by position, or how do I pass the argumetn correctly?


Here is a minimal example:

Ltac my_instantiate n x:=
  instantiate(n:=x).
Goal exists x, x = 2.
  eexists.
  my_instantiate 1 2.
  (* Fails with: Ltac variable n is bound to 1 which 
     cannot be coerced to a fresh identifier. *)

Note: I know that instantiating by position is discouraged, but I'm only using my tactic for exploration purposes.

user2506946
  • 131
  • 9

1 Answers1

0

Maybe what you are looking for can be expressed in terms of a Tactic Notation?

reference manual - tactic notations

hyperlinq
  • 31
  • 5