otherwise the occur check does not make sense in case of unification
of ?n with ?n *)
let delift ~unify metasenv subst context n l t =
+ let is_in_scope_meta subst = function
+ | NCic.Meta (i,_) ->
+ (try
+ let tag, _, _, _ = NCicUtils.lookup_subst i subst in
+ tag = Some in_scope_tag
+ with NCicUtils.Subst_not_found _ -> false)
+ | _ -> false
+ 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 then None else
+ if flexible_arg subst t || is_in_scope_meta 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 ->