(* Copyright (C) 2004, HELM Team. * * This file is part of HELM, an Hypertextual, Electronic * Library of Mathematics, developed at the Computer Science * Department, University of Bologna, Italy. * * HELM is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * HELM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HELM; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * * For details, see the HELM World-Wide-Web page, * http://helm.cs.unibo.it/ *) open MatitaCicMisc let init_metadata _ = () let compute_metadata _ _ = () (* let init_metadata status = let ((_, metasenv, _, _) as proof, _) = status in let proof_object_metadata = (* compute proof annotations *) Cic2acic.acic_object_of_cic_object (cicCurrentProof proof) in let sequents_metadata = (* compute all sequent annotations from scratch *) List.map (fun ((metano, context, term) as sequent) -> (metano, Cic2acic.asequent_of_sequent metasenv sequent)) metasenv in (proof_object_metadata, sequents_metadata) let compute_metadata (old_status, old_metadata) new_status = let ((_, new_metasenv, _, _) as new_proof, goal_opt) = new_status in let proof_object_metadata = (* compute proof annotations *) let obj = match goal_opt with | Some _ -> cicCurrentProof new_proof | None -> cicConstant new_proof in Cic2acic.acic_object_of_cic_object obj in let sequents_metadata = (* compute all sequent annotations from scratch *) (** TODO Zack could we reuse some of the annotations from the previous * status to avoid recomputing all of them? uhm ... we have to which * sequents haven't been changed by last tactic applications ... doh! *) List.map (fun ((metano, context, term) as sequent) -> (metano, Cic2acic.asequent_of_sequent new_metasenv sequent)) new_metasenv in (proof_object_metadata, sequents_metadata) *) class proof ?uri ~typ ~metasenv ~body () = object (self) inherit [unit] StatefulProofEngine.status ~history_size:BuildTimeConf.undo_history_size ?uri ~typ ~body ~metasenv init_metadata compute_metadata () method toXml = let currentproof = cicCurrentProof self#proof in let (acurrentproof,_,_,ids_to_inner_sorts,_,_,_) = Cic2acic.acic_object_of_cic_object ~eta_fix:false currentproof in let uri = MatitaTypes.unopt_uri self#uri in let xml, bodyxml = match Cic2Xml.print_object uri ~ids_to_inner_sorts ~ask_dtd_to_the_getter:true acurrentproof with | xml, Some bodyxml -> xml, bodyxml | _, None -> assert false in (xml, bodyxml) method toString = let (xml, bodyxml) = self#toXml in let buf = Buffer.create 10240 in List.iter (Buffer.add_string buf) [ "\n"; "\n"; "\n"; (Misc.strip_xml_headings (Xml.pp_to_string xml)); (Misc.strip_xml_headings(Xml.pp_to_string bodyxml)); (if not (self#proof_completed) then Printf.sprintf "%d" self#goal else ""); "\n" ]; Buffer.contents buf end let proof ?uri ~metasenv ~typ () = let metasenv = (1, [], typ) :: metasenv in let body = Cic.Meta (1,[]) in let _ = CicTypeChecker.type_of_aux' metasenv [] typ in new proof ~typ ~metasenv ~body ?uri ()