1 (* Copyright (C) 2004, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://helm.cs.unibo.it/
26 (** create a Cic.CurrentProof from a given proof *)
27 let currentProof (uri, metasenv, bo, ty) =
28 let uri = MatitaTypes.unopt_uri uri in
29 (* TODO CSC: Wrong: [] is just plainly wrong *)
30 Cic.CurrentProof (UriManager.name_of_uri uri, metasenv, bo, ty, [])
32 class proof ?uri ~typ ~metasenv ~body () =
35 inherit [MatitaTypes.hist_metadata]
36 StatefulProofEngine.status ?uri ~typ ~body ~metasenv
38 Cic2acic.acic_object_of_cic_object (currentProof (fst proof)))
39 (fun (old_proof, old_metadata) new_proof ->
40 Cic2acic.acic_object_of_cic_object (currentProof (fst new_proof)))
44 let currentproof = currentProof self#proof in
45 let (acurrentproof,_,_,ids_to_inner_sorts,_,_,_) =
46 Cic2acic.acic_object_of_cic_object ~eta_fix:false currentproof
48 let uri = MatitaTypes.unopt_uri self#uri in
50 match Cic2Xml.print_object uri ~ids_to_inner_sorts
51 ~ask_dtd_to_the_getter:true acurrentproof
53 | xml, Some bodyxml -> xml, bodyxml
54 | _, None -> assert false
59 let (xml, bodyxml) = self#toXml in
60 let buf = Buffer.create 10240 in
61 List.iter (Buffer.add_string buf)
62 [ "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
63 "<!DOCTYPE ConstantType SYSTEM \"http://mowgli.cs.unibo.it:58081/getdtd?uri=cic.dtd\">\n";
65 (Misc.strip_xml_headings (Xml.pp_to_string xml));
66 (Misc.strip_xml_headings(Xml.pp_to_string bodyxml));
67 (if not (self#proof_completed) then
68 Printf.sprintf "<CurrentGoal>%d</CurrentGoal>" self#goal
77 let proof ?uri ~metasenv ~typ () =
78 let metasenv = (1, [], typ) :: metasenv in
79 let body = Cic.Meta (1,[]) in
80 let _ = CicTypeChecker.type_of_aux' metasenv [] typ in
81 new proof ~typ ~metasenv ~body ?uri ()