]> matita.cs.unibo.it Git - fireball-separation.git/blobdiff - ocaml/lambda4.ml
Detection of divergents
[fireball-separation.git] / ocaml / lambda4.ml
index 340b955049e3cc64230cb81bf258663fcdfe941b..c6cecec5c0c064f972071344d4c6381559a4b120 100644 (file)
@@ -657,9 +657,9 @@ let env_of_sigma freshno sigma should_explode =
     e,Pure.lift (-n-1) (snd (List.find (fun (i,_) -> i = n) sigma)),[]
    with
     Not_found ->
-     if should_explode && n = hd_of_i_var (cast_to_i_var !bomb)
-      then ([], (let f t = Pure.A(t,t) in f (Pure.L (f (Pure.V 0)))), [])
-      else ([],Pure.V n,[]))::e
+    if n = hd_of_i_var (cast_to_i_var !bomb)
+     then ([], Pure.omega should_explode, [])
+     else ([], Pure.V n, []) ) :: e
  in aux 0
 ;;
 (* ************************************************************************** *)
@@ -712,22 +712,22 @@ let solve p =
  let ps = List.map scott_of_nf p.ps in
 
  let sigma' = List.map (fun (x,inst) -> x, scott_of_nf inst) sigma in
- let e' = env_of_sigma freshno sigma' false (* FIXME shoudl_explode *) in
+ let e' = env_of_sigma freshno sigma' false in
+ let e'' = env_of_sigma freshno sigma' true in
 
  prerr_endline "--------<REDUCE>---------";
- let pure_bomb = ToScott.t_of_nf (!bomb) in (* Pure.B *)
  (function
    | Some div ->
       print_endline (Pure.print div);
       let t = Pure.mwhd (e',div,[]) in
       prerr_endline ("*:: " ^ (Pure.print t));
-      assert (t = pure_bomb)
+      assert (Pure.diverged t)
    | None -> ()) div;
  List.iter (fun n ->
   verbose ("_::: " ^ (Pure.print n));
-  let t = Pure.mwhd (e',n,[]) in
+  let t = Pure.mwhd (e'',n,[]) in
   verbose ("_:: " ^ (Pure.print t));
-  assert (t <> pure_bomb)
+  assert (not (Pure.diverged t))
  ) conv ;
  List.iteri (fun i n ->
   verbose ((string_of_int i) ^ "::: " ^ (Pure.print n));