coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Hugo Herbelin <herbelin AT pauillac.inria.fr>
- To: J.Stein AT cs.ru.nl (Jasper Stein)
- Cc: hugo.herbelin AT inria.fr, synek AT cs.kun.nl, Coq-club AT pauillac.inria.fr
- Subject: Re: [Coq-Club] recursive ltacs
- Date: Sun, 26 Sep 2004 14:32:18 +0200 (MET DST)
- List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>
Hi Jasper,
> > Ltac Ct F :=
> > match F with
> > true => True
> > | false => False
> > | (andb ?f1 ?f2) => let c1 := Ct f1 with c2 := Ct f2 in constr:(and
> > | c1 c2)
> >
> > end.
>
> Aren't Ltac definitions supposed to return tactics? After all, True and
> False are terms, not tactics.
Ltac definitions are used to build tactics but it is convenient and
allowed to define intermediate ltac definitions that just build
terms. Ct above is such a definition.
On the syntactic side, ltac expressions that return tactics and ltac
expressions that return terms share the same syntactic constructions
("match", "let", juxtaposition as application, ...). Each
subexpressions of these constructions is parsed using a default parser
as indicated in the reference manual. For instance, the branches of a
match expect "expr", i.e. tactic expressions. To return a term when a
tactic is expected, the prefix "constr:" must be given to tell the
parser to choose the right grammar entry. As an exception, single
identifiers, even those denoting terms, can be given without requiring
"constr:". This is because the role of "constr:" is purely syntactic
and that identifiers of terms and of tactics are treated the same.
Conversely, when the default is to expect a term (typically
arguments of an applied ltac definitions), the prefix "ltac:" must be
given to tell the parser to select the entry parsing tactic
expressions.
Hugo
- [Coq-Club] recursive ltacs, Dan Synek
- Re: [Coq-Club] recursive ltacs, Houda Anoun
- Re: [Coq-Club] recursive ltacs,
Hugo Herbelin
- Re: [Coq-Club] recursive ltacs,
Jasper Stein
- Re: [Coq-Club] recursive ltacs, Hugo Herbelin
- Re: [Coq-Club] recursive ltacs, Hugo Herbelin
- Re: [Coq-Club] recursive ltacs,
Jasper Stein
Archive powered by MhonArc 2.6.16.