]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/helena/src/common/entity.ml
- bug fix in the static analyzer allows better Pi/forall separation (exportation...
[helm.git] / helm / software / helena / src / common / entity.ml
index c53db162bdb0d4edc40bb808e2bf395faf429c6f..d834ed53e3804ce5769210b674be0fe9e75621c8 100644 (file)
@@ -18,6 +18,8 @@ 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 *)
@@ -26,8 +28,8 @@ type meta = Main     (* main object *)
 type node_attrs = {
    n_name: name option; (* name *)
    n_apix: int;         (* additional position index *)
-   n_degr: int;         (* degree *)
-   n_sort: int;         (* sort *)
+   n_main: arity;       (* main arity *)
+   n_side: arity;       (* side arity *)
 }
 
 type root_attrs = {
@@ -43,8 +45,8 @@ 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 ?name ?(main=(0,0)) ?(side=(0,0)) () = {
+   n_apix = 0; n_name = name; n_main = main; n_side = side;
 }
 
 let root_attrs ?(meta=[]) ?info () = {
@@ -57,6 +59,12 @@ let empty_root = root_attrs ()
 
 let common f (ra, na, u, _) = f ra na u
 
+let succ (sort, degr) = sort, succ degr
+
+let compose av at = {av with n_main = at.n_main}
+
+let shift av = {av with n_side = av.n_main}
+
 let rec name err f a = match a.n_name with
    | Some (n, r) -> f n r
    | None        -> err ()