Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] How does tactic-in-term interact with notation?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] How does tactic-in-term interact with notation?


Chronological Thread 
  • From: Jonathan Leivent <jonikelee AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] How does tactic-in-term interact with notation?
  • Date: Mon, 4 Jul 2016 17:02:06 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f178.google.com
  • Ironport-phdr: 9a23:ilo9mhULXOBshc5eGinmH81BE53V8LGtZVwlr6E/grcLSJyIuqrYZheCt8tkgFKBZ4jH8fUM07OQ6PG4HzZaqs/c6TgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLHqvceJKFwV3XKUWvBbFF2OtwLft80b08NJC50a7V/3mEZOYPlc3mhyJFiezF7W78a0+4N/oWwL46pyv50IbaKvdKMhCLdcET4OMmYv5cStuwOQYxGI4y4+VWMfjhpBBUDh4RDkU5Ht+n/4sex82ySeMMDeQrU9WDDk5KBuHky7wBwbPiI0pTmEwvd7i7hW9Uqs

In general, one should not mix tactic-in-term with notations, unless the notations are "only parsing".

See https://coq.inria.fr/bugs/show_bug.cgi?id=4595


-- Jonathan


On 07/04/2016 04:57 PM, Ben Sherman wrote:
Hi all,

My general understanding of Coq notations is that they first are "desugared"
and then the resulting term is interpreted (including inference and ltac-in-term).
However, I cannot explain the following behavior, where a tactic-in-term in notation
breaks inference:

Inductive term {var : bool -> Type} : bool -> Type :=
| Var : forall A : bool, var A -> term A
| Const : forall A : bool, term A.

Arguments term : clear implicits.

Record WfTerm {A} :=
{ WfT_Term : forall var, term var A
; WfT_Ok : True
}.

Arguments WfTerm : clear implicits.
Arguments Build_WfTerm {A} _ _.

Axiom undefined : forall A, A.

Ltac proveWF := exact (undefined _).

Notation "[ e ]" := (Build_WfTerm (fun _ => e) (ltac:(proveWF))).
Notation "<< e >>" := (Build_WfTerm (fun _ => e) (undefined _)).

Definition konst {A : bool} : WfTerm A :=
Build_WfTerm (fun _ => Const A) (ltac:(proveWF)).

Definition konst1 {A : bool} : WfTerm A :=
<< Const A >> .

(* Why doesn't this work? It looks like it should just
"desugar" to the definition of 'konst', and is also similar
to 'konst1'. *)
Fail Definition konst2 {A : bool} : WfTerm A :=
[ Const A ] .
(*
Cannot infer the implicit parameter var of Const whose type is
"bool -> Type" in environment:
A : bool
*)
Is there some way to understand what it is about the combination of the
notation and the tactic-in-term that's breaking type inference? Or is it
possible that this is a bug?

Thanks,
Ben




Archive powered by MHonArc 2.6.18.

Top of Page