module O = BrgOutput
module E = BrgEnvironment
-type machine = {
- c: B.context;
- s: (B.context * B.term) list;
+type kam = {
+ c: B.lenv;
+ s: (B.lenv * B.term) list;
i: int
}
let level = 5
let log1 s c t =
- let sc, st = s ^ " in the context", "the term" in
- L.log O.specs level (L.ct_items1 sc c st t)
+ let sc, st = s ^ " in the environment", "the term" in
+ L.log O.specs level (L.et_items1 sc c st t)
let log2 s cu u ct t =
- let s1, s2, s3 = s ^ " in the context", "the term", "and in the context" in
- L.log O.specs level (L.ct_items2 s1 cu s2 u ~sc2:s3 ~c2:ct s2 t)
+ let s1, s2, s3 = s ^ " in the environment", "the term", "and in the environment" in
+ L.log O.specs level (L.et_items2 s1 cu s2 u ~sc2:s3 ~c2:ct s2 t)
let are_alpha_convertible err f t1 t2 =
let rec aux f = function
if U.eq u1 u2 then f () else err ()
| B.Cast (_, v1, t1), B.Cast (_, v2, t2)
| B.Appl (_, v1, t1), B.Appl (_, v2, t2) ->
- let f () = aux f (t1, t2) in
+ let f _ = aux f (t1, t2) in
aux f (v1, v2)
| B.Bind (b1, t1), B.Bind (b2, t2) ->
- let f () = aux f (t1, t2) in
+ let f _ = aux f (t1, t2) in
aux_bind f (b1, b2)
| _ -> err ()
and aux_bind f = function
in
if S.eq t1 t2 then f () else aux f (t1, t2)
-let get f m i =
- B.get C.err f m.c i
+let get err f m i =
+ B.get err f m.c i
(* to share *)
let rec step f ?(delta=false) ?(rt=false) m x =
| e, _, b ->
f m (Some (e, b)) x
in
- E.get_obj f uri
+ E.get_entry C.err f uri
| B.LRef (_, i) ->
let f c = function
| B.Abbr (_, v) ->
let f e = f {m with c = c} (Some (e, b)) x in
B.apix C.err f a
in
- get f m i
+ get C.err f m i
| B.Cast (_, _, t) ->
P.add ~tau:1 ();
step f ~delta ~rt m t
if e1 = e2 then ac_stacks err f m1 m2 else err ()
| Some (e1, B.Abbr (_, v1)), _, Some (e2, B.Abbr (_, v2)), _ ->
if e1 = e2 then
- let err () =
- P.add ~gdelta:2 ();
- ac err f ~si m1 v1 m2 v2
- in
+ let err _ = P.add ~gdelta:2 (); ac err f ~si m1 v1 m2 v2 in
ac_stacks err f m1 m2
else if e1 < e2 then begin
P.add ~gdelta:1 ();
_, B.Bind ((B.Abst (_, w2) as b2), t2) ->
let f m1 m2 = ac err f ~si m1 t1 m2 t2 in
let f m1 = push (f m1) m2 b2 in
- let f () = push f m1 b1 in
+ let f _ = push f m1 b1 in
ac err f ~si:false m1 w1 m2 w2
| _, B.Sort _, _, B.Bind (b, t) when si ->
P.add ~si:1 ();
(* Interface functions ******************************************************)
-let empty_machine = {
- c = B.empty_context; s = []; i = 0
+let empty_kam = {
+ c = B.empty_lenv; s = []; i = 0
}
-let get f m i =
+let get err f m i =
assert (m.s = []);
let f c = f in
- get f m i
+ get err f m i
let xwhd f m t =
L.box level; log1 "Now scanning" m.c t;
let are_convertible err f ?(si=false) mu u mw w =
L.box level; log2 "Now converting" mu.c u mw.c w;
- let f () = L.unbox level; f () in
- let err () = ac err f ~si mu u mw w in
+ let f x = L.unbox level; f x in
+ let err _ = ac err f ~si mu u mw w in
(* if S.eq mu mw then are_alpha_convertible err f u w else *) err ()
-let message1 st1 m t1 =
- L.ct_items1 "In the context" m.c st1 t1
-
-let message3 st1 st2 ?sm3 st3 m1 t1 t2 ?m3 t3 =
- let sm1 = "In the context" in
- match sm3, m3 with
- | Some sm3, Some m3 ->
- L.ct_items3 sm1 m1.c st1 t1 st2 t2 ~sc3:sm3 ~c3:m3.c st3 t3
- | None, None ->
- L.ct_items3 sm1 m1.c st1 t1 st2 t2 st3 t3
- | _ -> assert false
+(* error reporting **********************************************************)
+
+let pp_term m frm t = O.specs.L.pp_term m.c frm t
+
+let pp_lenv frm m = O.specs.L.pp_lenv frm m.c
+
+let specs = {
+ L.pp_term = pp_term; L.pp_lenv = pp_lenv
+}