1 (* Copyright (C) 2000, 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/.
29 module Misc = MQueryMisc
30 module ER = ProofEngineReduction
34 (* external functions implementation * * * * * * * * * * * * * * * * * * * *)
36 exception TermError of M.result
39 match U.string_of_avs r with
40 | Some s -> Misc.uriref_of_string s
41 | None -> raise (TermError r)
44 let b, _ = Misc.get_object (uriref_of_avs r) in b
47 let _, t = Misc.get_object (uriref_of_avs r) in t
49 (* BODY OF OBJECT ***********************************************************)
53 try U.avs_of_string (CicPp.ppterm (body_of_set r)) with _ -> U.val_false
55 L.fun_arity1 ["helm"; "body"] "" aux
57 let _ = L.fun_register ["helm"; "body"] helm_body_fun
59 (* TYPE OF OBJECT ***********************************************************)
63 try U.avs_of_string (CicPp.ppterm (type_of_set r)) with _ -> U.val_false
65 L.fun_arity1 ["helm"; "type"] "" aux
67 let _ = L.fun_register ["helm"; "type"] helm_type_fun
69 (* ALPHA CONVERTIBILITY OF BODIES *******************************************)
71 let helm_alpha_body_fun =
74 if ER.alpha_equivalence (body_of_set r1) (body_of_set r2)
75 then U.val_true else U.val_false
78 L.fun_arity2 ["helm"; "alpha"; "body"] "" aux
80 let _ = L.fun_register ["helm"; "alpha"; "body"] helm_alpha_body_fun
82 (* ALPHA CONVERTIBILITY OF TYPES ********************************************)
84 let helm_alpha_type_fun =
87 if ER.alpha_equivalence (type_of_set r1) (type_of_set r2)
88 then U.val_true else U.val_false
91 L.fun_arity2 ["helm"; "alpha"; "type"] "" aux
93 let _ = L.fun_register ["helm"; "alpha"; "type"] helm_alpha_type_fun
95 (* generator functions implementation * * * * * * * * * * * * * * * * * * * *)
97 (* STANDARD VARIABLES FOR METADATA ******************************************)
99 let helm_aliases_gen =
100 let mk_let v s x = M.Let (Some v, M.Const [(s, [])], x) in
101 let arity = L.Const 1 in
102 let code _ = function
104 let ns = "http://www.cs.unibo.it/helm/schemas/schema-helm#" in
105 let x = mk_let "SET" "Set" x in
106 let x = mk_let "PROP" "Prop" x in
107 let x = mk_let "TYPE" "Type" x in
108 let x = mk_let "CPROP" "CProp" x in
109 let x = mk_let "MH" (ns ^ "MainHypothesis") x in
110 let x = mk_let "MC" (ns ^ "MainConclusion") x in
111 let x = mk_let "IH" (ns ^ "InHypothesis") x in
112 let x = mk_let "IC" (ns ^ "InConclusion") x in
113 mk_let "IB" (ns ^ "InBody") x
116 {L.arity = arity; L.code = code}
118 let _ = L.gen_register ["helm"; "aliases"] helm_aliases_gen