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_______________________________________________________________ *)
17 (* Internal functions *******************************************************)
19 let rec xlate_term c f = function
21 let f h = f (B.Sort ([], h)) in
22 if s then f 0 else f 1
25 | M.GRef (_, uri, vs) ->
26 let map f t v = f (B.appl [] v t) in
27 let f vs = C.list_fold_left f map (B.GRef ([], uri)) vs in
28 C.list_map f (xlate_term c) vs
30 let f v t = f (B.Appl ([], v, t)) in
31 let f v = xlate_term c (f v) t in
33 | M.Abst (id, w, t) ->
35 let a = [Y.Name (id, true)] in
36 let f t = f (B.Bind (a, B.Abst w, t)) in
37 xlate_term (B.push c B.empty a (B.Abst w)) f t
41 let xlate_pars f pars =
43 let a = [Y.Name (id, true)] in
44 let f w = f (B.push c B.empty a (B.Abst w)) in
47 C.list_fold_right f map pars B.empty
49 let unwind_to_xlate_term f c t =
50 let map t a b = B.bind a b t in
51 let f t = f (B.fold_left map t c) in
54 let xlate_entry f = function
56 let f c = unwind_to_xlate_term f c u in
59 let f u t = f (B.Cast ([], u, t)) in
60 let f c u = unwind_to_xlate_term (f u) c t in
61 let f c = unwind_to_xlate_term (f c) c u in
64 (* Interface functions ******************************************************)
66 let brg_of_meta = xlate_entry