(* note : fragment of complete lambda-delta serving as abstract layer *)
module E = Entity
+module N = Level
type uri = E.uri
type id = E.id
type attrs = E.attrs
-type bind = Abst of term list (* domains *)
- | Abbr of term list (* bodies *)
- | Void of int (* number of exclusions *)
+type bind = Abst of N.level * term list (* level, domains *)
+ | Abbr of term list (* bodies *)
+ | Void of int (* number of exclusions *)
and term = TSort of attrs * int (* attrs, hierarchy index *)
| TLRef of attrs * int * int (* attrs, position indexes *)
let push_proj f lenv a e = f (EProj (lenv, a, e))
let push2 err f lenv attr ?t () = match lenv, t with
- | EBind (e, a, Abst ws), Some t -> f (EBind (e, (attr :: a), Abst (t :: ws)))
- | EBind (e, a, Abbr vs), Some t -> f (EBind (e, (attr :: a), Abbr (t :: vs)))
- | EBind (e, a, Void n), None -> f (EBind (e, (attr :: a), Void (succ n)))
+ | EBind (e, a, Abst (n, ws)), Some t ->
+ f (EBind (e, (attr :: a), Abst (n, t :: ws)))
+ | EBind (e, a, Abbr vs), Some t ->
+ f (EBind (e, (attr :: a), Abbr (t :: vs)))
+ | EBind (e, a, Void n), None ->
+ f (EBind (e, (attr :: a), Void (succ n)))
| _ -> err ()
(* this id not tail recursive *)
let resolve_lref err f id lenv =
let rec aux f i k = function
| ESort -> err ()
- | EBind (tl, _, Abst [])
+ | EBind (tl, _, Abst (_, []))
| EBind (tl, _, Abbr [])
| EBind (tl, _, Void 0) -> aux f i k tl
- | EBind (tl, a, _) ->
- let err kk = aux f (succ i) (k + kk) tl in
+ | EBind (tl, a, b) ->
+ let err kk = aux f (succ i) (k + kk) tl in
let f j = f i j (k + j) in
E.resolve err f id a
| EProj _ -> assert false (* TODO *)
let rec get_name err f i j = function
| ESort -> err i
- | EBind (tl, _, Abst [])
+ | EBind (tl, _, Abst (_, []))
| EBind (tl, _, Abbr [])
| EBind (tl, _, Void 0) -> get_name err f i j tl
| EBind (_, a, _) when i = 0 ->
let get_index err f i j lenv =
let rec aux f i k = function
| ESort -> err i
- | EBind (tl, _, Abst [])
+ | EBind (tl, _, Abst (_, []))
| EBind (tl, _, Abbr [])
| EBind (tl, _, Void 0) -> aux f i k tl
| EBind (_, a, _) when i = 0 ->