let goal w script =
let gid = w.po_gid in
let env = w.po_env in
let model = w.po_model in
let file = Tmp.file gid ".v" in
let coq_file = Wpo.file_for_goal ~gid L_coq in
Command.pp_to_file file
(fun fmt ->
Format.fprintf fmt "Require Import Reals.@\n";
Format.fprintf fmt "Require Import wp.@\n";
Format.fprintf fmt "Require Import %s.@\n" (Wpo.coq_for_model ~model);
Format.fprintf fmt "Require Import %s.@\n" (Wpo.coq_for_env ~env);
Command.pp_from_file fmt coq_file;
begin
match script with
| Some script ->
Format.fprintf fmt "Proof.@\n%sQed.@\n@." script ;
| None ->
Format.fprintf fmt "Proof.@\nAdmitted.@\n@." ;
end
);
Task.return file