]> matita.cs.unibo.it Git - helm.git/blob - components/content_pres/content2Procedural.ml
we parametrized CicNotationPt.obj on 'term
[helm.git] / components / content_pres / content2Procedural.ml
1 (* Copyright (C) 2003-2005, HELM Team.
2  * 
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.
6  * 
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.
11  * 
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.
16  *
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,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://cs.unibo.it/helm/.
24  *)
25
26 module H = HExtlib
27 module C = Content
28 module G = GrafiteAst
29
30 (* grafite ast constructors *************************************************)
31
32 let floc = H.dummy_floc
33
34 let mk_note str = G.Comment (floc, G.Note (floc, str))
35    
36 (* interface functions ******************************************************)
37
38 let out_arg = function
39    | C.Aux _       -> "aux"
40    | C.Premise _   -> "premise"
41    | C.Lemma _     -> "lemma"
42    | C.Term _      -> "term"
43    | C.ArgProof _  -> "proof"
44    | C.ArgMethod _ -> "method"
45
46 let out_args args = String.concat " " (List.map out_arg args) 
47
48 let out_name = function
49    | None     -> ""
50    | Some str -> str
51
52 let content2procedural ~ids_to_inner_sorts prefix (_, params, xmenv, obj) = 
53    if List.length params > 0 || xmenv <> None then assert false;
54    match obj with
55       | `Def (C.Const, t, `Proof {
56            C.proof_name = Some name; C.proof_context = []; 
57            C.proof_apply_context = []; C.proof_conclude = {
58               C.conclude_conclusion = Some b
59            }
60         }) ->   
61         [mk_note (Printf.sprintf "%s" name)]
62       | _ -> assert false