2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department, University of Bologna, Italy.
6 ||T|| HELM is free software; you can redistribute it and/or
7 ||A|| modify it under the terms of the GNU General Public License
8 \ / version 2 or (at your option) any later version.
9 \ / This software is distributed as is, NO WARRANTY.
10 V_______________________________________________________________ *)
12 (* $Id: terms.mli 9822 2009-06-03 15:37:06Z tassi $ *)
14 module type NCicContext =
16 val metasenv : NCic.metasenv
17 val subst : NCic.substitution
18 val context : NCic.context
21 module NCicBlob(C : NCicContext) : Terms.Blob with type t = NCic.term = struct
25 let eq x y = NCicReduction.alpha_eq C.metasenv C.subst C.context x y;;
29 | NCic.Rel i, NCic.Rel j -> i-j
30 | NCic.Const r1, NCic.Const r2 -> NReference.compare r1 r2
31 | NCic.Appl l1, NCic.Appl l2 -> assert false (* TODO *)
36 NCicPp.ppterm ~context:C.context ~metasenv:C.metasenv ~subst:C.subst t;;
38 let rec embed = function
39 | NCic.Meta (i,_) -> Terms.Var i, [i]
41 let rec aux acc l = function
43 |hd::tl -> if List.mem hd l then aux acc l tl else aux (hd::acc) l tl
45 let res,vars = List.fold_left
46 (fun (r,v) t -> let r1,v1 = embed t in (r1::r),aux [] v v1) ([],[]) l
47 in (Terms.Node (List.rev res)), vars
48 | t -> Terms.Leaf t, []
51 let embed t = fst (embed t) ;;
55 NCicMetaSubst.saturate ~delta:max_int C.metasenv C.subst C.context
59 if args = [] then Terms.Leaf t
60 else Terms.Node (Terms.Leaf t :: List.map embed args)
62 let sty = embed sty in
68 OCic2NCic.reference_of_oxuri
69 (UriManager.uri_of_string
70 "cic:/matita/logic/equality/eq.ind#xpointer(1/1)")