| (_, _) -> raise (AssertFailure (lazy "split_prods"))
;;
-let debruijn ?(cb=fun _ _ -> ()) uri number_of_types context =
+let debruijn uri number_of_types context =
let rec aux k t =
- let res =
- match t with
- | C.Meta (i,(s,C.Ctx l)) ->
- let l1 = HExtlib.sharing_map (aux (k-s)) l in
- if l1 == l then t else C.Meta (i,(s,C.Ctx l1))
- | C.Meta _ -> t
- | C.Const (Ref.Ref (_,uri1,(Ref.Fix (no,_) | Ref.CoFix no)))
- | C.Const (Ref.Ref (_,uri1,Ref.Ind (_,no))) when NUri.eq uri uri1 ->
- C.Rel (k + number_of_types - no)
- | t -> U.map (fun _ k -> k+1) k aux t
- in
- cb t res; res
+ match t with
+ | C.Meta (i,(s,C.Ctx l)) ->
+ let l1 = HExtlib.sharing_map (aux (k-s)) l in
+ if l1 == l then t else C.Meta (i,(s,C.Ctx l1))
+ | C.Meta _ -> t
+ | C.Const (Ref.Ref (_,uri1,(Ref.Fix (no,_) | Ref.CoFix no)))
+ | C.Const (Ref.Ref (_,uri1,Ref.Ind (_,no))) when NUri.eq uri uri1 ->
+ C.Rel (k + number_of_types - no)
+ | t -> U.map (fun _ k -> k+1) k aux t
in
aux (List.length context)
;;