X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fhelena%2Fsrc%2Fcommon%2Fentity.ml;h=ab99e24cd5641c0285e825cf858911c0127f0502;hb=1b4d894e7349bba991823249f1716fb8f18239b7;hp=d4bfef5d3e44d826b0f3a30193134a64b5e9372a;hpb=04ffe68396b98bbf21bcd403ffba03b94eaebadc;p=helm.git diff --git a/helm/software/helena/src/common/entity.ml b/helm/software/helena/src/common/entity.ml index d4bfef5d3..ab99e24cd 100644 --- a/helm/software/helena/src/common/entity.ml +++ b/helm/software/helena/src/common/entity.ml @@ -10,7 +10,7 @@ V_______________________________________________________________ *) module U = NUri -module N = Level +module N = Layer type uri = U.uri @@ -18,16 +18,21 @@ type id = string (* identifier *) type name = id * bool (* token, real? *) +type arity = int * int (* sort, degree *) + type meta = Main (* main object *) | InProp (* inhabitant of a proposition *) | Progress (* uncompleted object *) | Private (* private global definition *) type node_attrs = { - n_name: name option; (* name *) - n_apix: int; (* additional position index *) - n_degr: int; (* degree *) - n_sort: int; (* sort *) + n_apix: int; (* additional position index *) +} + +type bind_attrs = { + b_name: name option; (* name *) + b_main: arity; (* main arity *) + b_side: arity; (* side arity *) } type root_attrs = { @@ -43,8 +48,12 @@ type 'term entity = root_attrs * node_attrs * uri * 'term bind (* attrs, uri, bi (* helpers ******************************************************************) -let node_attrs ?(apix=0) ?name ?(degr=0) ?(sort=0) () = { - n_apix = apix; n_name = name; n_degr = degr; n_sort = sort +let node_attrs ?(apix=0) () = { + n_apix = apix; +} + +let bind_attrs ?name ?(main=(0,0)) ?(side=(0,0)) () = { + b_name = name; b_main = main; b_side = side; } let root_attrs ?(meta=[]) ?info () = { @@ -53,11 +62,19 @@ let root_attrs ?(meta=[]) ?info () = { let empty_node = node_attrs () +let empty_bind = bind_attrs () + let empty_root = root_attrs () let common f (ra, na, u, _) = f ra na u -let rec name err f a = match a.n_name with +let succ (sort, degr) = sort, succ degr + +let compose av at = {av with b_main = at.b_main} + +let shift av = {av with b_side = av.b_main} + +let rec name err f a = match a.b_name with | Some (n, r) -> f n r | None -> err ()