X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Fbasic_ag%2Fbag.ml;h=1aa9b62e749a79b5f2494ce0d09b67932235584f;hb=3f6af93003bef461be59c8d4c96009c631f0c2e7;hp=d0c193a2a71a0ad4528d21952320ae93ea022181;hpb=338e3e5c639fbcfeeb347a0121cacc6c0f1fc42a;p=helm.git diff --git a/helm/software/lambda-delta/basic_ag/bag.ml b/helm/software/lambda-delta/basic_ag/bag.ml index d0c193a2a..1aa9b62e7 100644 --- a/helm/software/lambda-delta/basic_ag/bag.ml +++ b/helm/software/lambda-delta/basic_ag/bag.ml @@ -9,8 +9,11 @@ \ / This software is distributed as is, NO WARRANTY. V_______________________________________________________________ *) -type uri = NUri.uri -type id = Aut.id +(* kernel version: basic, absolute, global *) +(* note : experimental *) + +type uri = Entity.uri +type id = Entity.id type bind = Void (* exclusion *) | Abst of term (* abstraction *) @@ -19,17 +22,21 @@ type bind = Void (* exclusion *) and term = Sort of int (* hierarchy index *) | LRef of int (* location *) | GRef of uri (* reference *) - | Cast of term * term (* type, term *) + | Cast of term * term (* domain, element *) | Appl of term * term (* argument, function *) | Bind of int * id * bind * term (* location, name, binder, scope *) -type obj = int * uri * bind (* age, uri, binder, contents *) +type entity = term Entity.entity (* attrs, uri, binder *) + +type lenv = (int * id * bind) list (* location, name, binder *) -type item = obj option +type message = (lenv, term) Log.item list -type context = (int * id * bind) list (* location, name, binder *) +(* helpers ******************************************************************) -type message = (context, term) Log.item list +let mk_uri si root s = + let kernel = if si then "bag-si" else "bag" in + String.concat "/" ["ld:"; kernel; root; s ^ ".ld"] (* Currified constructors ***************************************************) @@ -55,11 +62,19 @@ let location = ref 0 let new_location () = let loc = !location in incr location; loc -(* context handling functions ***********************************************) +let locations () = !location -let empty_context = [] +(* local environment handling functions *************************************) -let push f es l id b = +let empty_lenv = [] + +let push msg f es l id b = + let rec does_not_occur loc = function + | [] -> true + | (l, _, _) :: _ when l = loc -> false + | _ :: es -> does_not_occur l es + in + if not (does_not_occur l es) then failwith msg else let c = (l, id, b) :: es in f c let append f es1 es2 =