with UnificationFailure _ | Uncertain _ when not b ->
metasenv, subst
in
- let rec check_stack l1 l2 r (metasenv, subst) =
+ let rec check_stack l1 l2 r todo =
match l1,l2,r with
- | x1::tl1, x2::tl2, r::tr ->
- check_stack tl1 tl2 tr
- (unif_from_stack x1 x2 r metasenv subst)
- | x1::tl1, x2::tl2, [] ->
- check_stack tl1 tl2 []
- (unif_from_stack x1 x2 true metasenv subst)
+ | x1::tl1, x2::tl2, r::tr-> check_stack tl1 tl2 tr ((x1,x2,r)::todo)
+ | x1::tl1, x2::tl2, []-> check_stack tl1 tl2 [] ((x1,x2,true)::todo)
| l1, l2, _ ->
- fo_unif test_eq_only metasenv subst
- (NCicReduction.unwind (k1,e1,t1,List.rev l1))
- (NCicReduction.unwind (k2,e2,t2,List.rev l2))
+ NCicReduction.unwind (k1,e1,t1,List.rev l1),
+ NCicReduction.unwind (k2,e2,t2,List.rev l2),
+ todo
in
- try check_stack (List.rev s1) (List.rev s2) relevance (metasenv,subst)
+ let hh1,hh2,todo=check_stack (List.rev s1) (List.rev s2) relevance [] in
+ try
+ let metasenv,subst = fo_unif test_eq_only metasenv subst hh1 hh2 in
+ List.fold_left
+ (fun (metasenv,subst) (x1,x2,r) ->
+ unif_from_stack x1 x2 r metasenv subst
+ ) (metasenv,subst) todo
with UnificationFailure _ | Uncertain _ when not (norm1 && norm2) ->
unif_machines metasenv subst (small_delta_step m1 m2)
(*D*) in outside(); rc with exn -> outside (); raise exn