]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/lambda-delta/basic_rg/brg.ml
we enabled the new style xml exportation, in particular for dual_rg
[helm.git] / helm / software / lambda-delta / basic_rg / brg.ml
index 779a121e603042965c694c3d8f42d45bad083a7c..baa83afed3741ca6f94637fec132262d7294a851 100644 (file)
 (* kernel version: basic, relative, global *)
 (* note          : ufficial basic lambda-delta *) 
 
-type uri = Item.uri
-type id = Item.id
-
-type attr = Name of bool * id  (* real?, name *)
-          | Apix of int        (* additional position index *)
-
-type attrs = attr list
+type uri = Entity.uri
+type id = Entity.id
+type attrs = Entity.attrs
 
 type bind = Void of attrs        (* attrs       *)
           | Abst of attrs * term (* attrs, type *)
@@ -31,15 +27,16 @@ and term = Sort of attrs * int         (* attrs, hierarchy index *)
          | Appl of attrs * term * term (* attrs, argument, function *)
          | Bind of bind * term         (* binder, scope *)
 
-type obj = bind Item.obj (* age, uri, binder *)
+type entity = term Entity.entity (* attrs, uri, binder *)
 
-type item = bind Item.item
+type lenv = Null
+(* Cons: tail, relative local environment, binder *) 
+             | Cons of lenv * lenv option * bind 
 
-type context = Null
-(* Cons: tail, relative context, binder *) 
-             | Cons of context * context option * bind 
+(* helpers ******************************************************************)
 
-type message = (context, term) Log.item list
+let mk_uri root s =
+   String.concat "/" ["ld:"; "brg"; root; s ^ ".ld"]
 
 (* Currified constructors ***************************************************)
 
@@ -59,16 +56,16 @@ let bind_abst a u t = Bind (Abst (a, u), t)
 
 let bind_abbr a v t = Bind (Abbr (a, v), t)
 
-(* context handling functions ***********************************************)
+(* local environment handling functions *************************************)
 
-let empty_context = Null
+let empty_lenv = Null
 
 let push f es ?c b =
    let es = Cons (es, c, b) in f es
 
 let get err f es i =
    let rec aux j = function
-      | Null                            -> err i
+      | Null                            -> err ()
       | Cons (tl, None, b)   when j = 0 -> f tl b
       | Cons (_, Some c, b) when j = 0  -> f c b
       | Cons (tl, _, _)                 -> aux (pred j) tl
@@ -78,22 +75,12 @@ let get err f es i =
 let rec rev_iter f map = function   
    | Null                 -> f ()
    | Cons (tl, None, b)   -> 
-      let f () = map f tl b in rev_iter f map tl
+      let f _ = map f tl b in rev_iter f map tl
    | Cons (tl, Some c, b) -> 
-      let f () = map f c b in rev_iter f map tl
+      let f _ = map f c b in rev_iter f map tl
 
 let rec fold_left f map x = function
    | Null            -> f x
    | Cons (tl, _, b) ->
       let f x = fold_left f map x tl in
       map f x b
-
-let rec name err f = function
-   | []               -> err ()
-   | Name (r, n) :: _ -> f n r
-   | _ :: tl          -> name err f tl
-
-let rec apix err f = function
-   | []          -> err ()
-   | Apix i :: _ -> f i
-   | _ :: tl     -> apix err f tl