1 (* Copyright (C) 2000-2002, 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://cs.unibo.it/helm/.
28 (* It also returns the pretty-printing context! *)
29 let print_context ctx =
33 | Cic.Anonimous -> "_"
36 (fun i (output,context) ->
37 let (newoutput,context') =
39 Some (n,Cic.Decl t) ->
40 print_name n ^ ":" ^ CicPp.pp t context ^ "\n", (Some n)::context
41 | Some (n,Cic.Def t) ->
42 print_name n ^ ":=" ^ CicPp.pp t context ^ "\n", (Some n)::context
44 "_ ?= _\n", None::context
46 output^newoutput,context'
50 exception NotImplemented;;
52 let print_sequent (metano,context,goal) =
53 let module P = ProofEngine in
55 let (output,pretty_printer_context_of_context) = print_context context in
57 "---------------------- ?" ^ string_of_int metano ^ "\n" ^
58 CicPp.pp goal pretty_printer_context_of_context
65 let print_sequent metasenv (metano,context,goal) =
67 let ids_to_terms = Hashtbl.create 503 in
68 let ids_to_father_ids = Hashtbl.create 503 in
69 let ids_to_inner_sorts = Hashtbl.create 503 in
70 let ids_to_inner_types = Hashtbl.create 503 in
71 let ids_to_hypotheses = Hashtbl.create 11 in
72 let hypotheses_seed = ref 0 in
74 let acic_of_cic_context =
75 Cic2acic.acic_of_cic_context' seed ids_to_terms ids_to_father_ids
76 ids_to_inner_sorts ids_to_inner_types metasenv
80 (fun binding (s,context) ->
81 let hid = "h" ^ string_of_int !hypotheses_seed in
82 Hashtbl.add ids_to_hypotheses hid binding ;
83 incr hypotheses_seed ;
85 (Some (n,(Cic.Def t as b)) as entry)
86 | (Some (n,(Cic.Decl t as b)) as entry) ->
87 let acic = acic_of_cic_context context t None in
90 (match b with Cic.Decl _ -> "Decl" | Cic.Def _ -> "Def")
91 ["name",(match n with Cic.Name n -> n | _ -> assert false);
94 (UriManager.uri_of_string "cic:/dummy.con")
95 ~ids_to_inner_sorts acic)
98 [< s ; X.xml_empty "Hidden" [] >], (None::context)
102 let acic = acic_of_cic_context context goal None in
103 X.xml_nempty "Sequent" ["no",string_of_int metano]
105 Xml.xml_nempty "Goal" []
106 (Cic2Xml.print_term (UriManager.uri_of_string "cic:/dummy.con")
107 ~ids_to_inner_sorts acic)
109 ids_to_terms,ids_to_father_ids,ids_to_hypotheses