;;
+exception Found;;
+
(* INVARIANT: we suppose that t is not another occurrence of Meta(n,_),
otherwise the occur check does not make sense in case of unification
of ?n with ?n *)
with NCicUtils.Subst_not_found _ -> false)
| _ -> false
in
+ let contains_in_scope subst t =
+ let rec aux _ () = function
+ | NCic.Meta _ as t ->
+ if is_in_scope_meta subst t then raise Found
+ else ()
+ | t ->
+ if is_in_scope_meta subst t then raise Found
+ else NCicUtils.fold (fun _ () -> ()) () aux () t
+ in
+ try aux () () t; false with Found -> true
+ in
let unify_list in_scope =
match l with
| _, NCic.Irl _ -> fun _ _ _ _ _ -> None
| shift, NCic.Ctx l -> fun metasenv subst context k t ->
- if flexible_arg subst t || is_in_scope_meta subst t then None else
+ if flexible_arg subst t || contains_in_scope subst t then None else
let lb = List.map (fun t -> t, flexible_arg subst t) l in
HExtlib.list_findopt
(fun (li,flexible) i ->