coq-club AT inria.fr
Subject: The Coq mailing list
List archive
[Coq-Club] API: How to generate a sort type for the parameter of an abstraction
Chronological Thread
- From: Sylvain Boulmé <Sylvain.Boulme AT imag.fr>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] API: How to generate a sort type for the parameter of an abstraction
- Date: Thu, 6 Oct 2016 09:13:00 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=Sylvain.Boulme AT imag.fr; spf=Pass smtp.mailfrom=Sylvain.Boulme AT imag.fr; spf=None smtp.helo=postmaster AT mx2.imag.fr
- Mailscanner-null-check: 1476342784.99535@0mIgOql2yE+YghrLA1k4+A
Hello everybody,
I have defined in Coq a higher-order abstract syntax for some expression language (in a Coq module "Syntax"):
Inductive expr (var:Type): Type :=
| Var: var -> expr var
...
Definition eval (e: forall v, expr v) ....
Lemma eval_correctness (e: forall v, expr v): ...
My goal is to write a tactic in Ocaml to generate a Coq proof like "eval_correctness (fun v => f v) ..." for some "f"
But I do not understand how to use the Coq API to generate a valid sort "Type" for variable "v" in lambda-abstraction "fun (v:Type) => f v".
I am using Coq V8.5.2.
Currently, by imitating some files found in Coq plugins, I have written something like
Proofview.Goal.enter (fun gl ->
let _eval_correctness = ... in
let vid = Names.Id.of_string "v" in
let evm = Proofview.Goal.sigma gl in
let evm, vtype = Evd.new_sort_variable Evd.univ_flexible evm in
let vtype = Term.mkSort vtype in
let _f = .... (Term.mkVar vid) in
let _e = Term.mkNamedLambda vid vtype f in
...
let proof = Term.mkApp _eval_correctness [| _e; ... |] in
Tacticals.New.tclTHENLIST
[
Proofview.Unsafe.tclEVARS evm;
Proofview.V82.tactic (Tactics.exact_no_check proof);
])
But, when using this tactic inside a Coq module "TestTactic", I get the following error message:
Error: Illegal application:
The term "Syntax.Var" of type
"forall var : Type, var -> Syntax.expr var"
cannot be applied to the terms
"v" : "Type"
"r4" : "v"
The 1st term has type "Type@{TestTactic.1}"
which should be coercible to "Type@{Syntax.1}".
How to correct my code above ?
Thanks.
Sylvain Boulmé.
- [Coq-Club] API: How to generate a sort type for the parameter of an abstraction, Sylvain Boulmé, 10/06/2016
- Re: [Coq-Club] API: How to generate a sort type for the parameter of an abstraction, Guillaume Melquiond, 10/06/2016
- Re: [Coq-Club] API: How to generate a sort type for the parameter of an abstraction, Jean-Francois Monin, 10/06/2016
- Re: [Coq-Club] API: How to generate a sort type for the parameter of an abstraction, Sylvain Boulmé, 10/06/2016
- Re: [Coq-Club] API: How to generate a sort type for the parameter of an abstraction, Sylvain Boulmé, 10/06/2016
- Re: [Coq-Club] API: How to generate a sort type for the parameter of an abstraction, Matthieu Sozeau, 10/06/2016
- Re: [Coq-Club] API: How to generate a sort type for the parameter of an abstraction, Jean-Francois Monin, 10/06/2016
- Re: [Coq-Club] API: How to generate a sort type for the parameter of an abstraction, Guillaume Melquiond, 10/06/2016
Archive powered by MHonArc 2.6.18.