+ let e = B.push m.e m.e a b in
+ {m with e = e; d = d}
+
+let rec ac_nfs st (m1, r1, u) (m2, r2, t) =
+ log2 "Now converting nfs" m1.e u m2.e t;
+ match r1, u, r2, t with
+ | _, B.Sort (_, h1), _, B.Sort (_, h2) ->
+ h1 = h2
+ | Some (e1, _, B.Abst _), _, Some (e2, _, B.Abst _), _ ->
+ if e1 = e2 then ac_stacks st m1 m2 else false
+ | Some (e1, _, B.Abbr v1), _, Some (e2, _, B.Abbr v2), _ ->
+ if e1 = e2 then
+ if ac_stacks st m1 m2 then true else begin
+ P.add ~gdelta:2 (); ac st m1 v1 m2 v2
+ end
+ else if e1 < e2 then begin
+ P.add ~gdelta:1 ();
+ ac_nfs st (m1, r1, u) (step st m2 v2)
+ end else begin
+ P.add ~gdelta:1 ();
+ ac_nfs st (step st m1 v1) (m2, r2, t)
+ end
+ | _, _, Some (_, _, B.Abbr v2), _ ->
+ P.add ~gdelta:1 ();
+ ac_nfs st (m1, r1, u) (step st m2 v2)
+ | Some (_, _, B.Abbr v1), _, _, _ ->
+ P.add ~gdelta:1 ();
+ ac_nfs st (step st m1 v1) (m2, r2, t)
+ | _, B.Bind (a1, (B.Abst w1 as b1), t1),
+ _, B.Bind (a2, (B.Abst w2 as b2), t2) ->
+ if ac {st with Y.si = false} m1 w1 m2 w2 then
+ ac st (push m1 a1 b1) t1 (push m2 a2 b2) t2
+ else false
+ | _, B.Sort _, _, B.Bind (a, b, t) when st.Y.si ->
+ P.add ~si:1 ();
+ ac st (push m1 a b) u (push m2 a b) t
+ | _ -> false
+
+and ac st m1 t1 m2 t2 =
+(* L.warn "entering R.are_convertible"; *)
+ ac_nfs st (step st m1 t1) (step st m2 t2)
+
+and ac_stacks st m1 m2 =
+(* L.warn "entering R.are_convertible_stacks"; *)
+ if List.length m1.s <> List.length m2.s then false else
+ let map (c1, v1) (c2, v2) =
+ let m1, m2 = {m1 with e = c1; s = []}, {m2 with e = c2; s = []} in
+ ac {st with Y.si = false} m1 v1 m2 v2