replace_in_sigma (List.rev perm) p.sigma
;;
-let env_of_sigma freshno sigma should_explode =
- let rec aux n =
- if n > freshno then
- []
- else
- let e = aux (n+1) in
- (try
- e,Pure.lift (-n-1) (snd (List.find (fun (i,_) -> i = n) sigma)),[]
- with
- Not_found -> ([], Pure.V n, []) ) :: e
- in aux 0
-;;
(* ************************************************************************** *)
type result = [
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 in
- let e'' = env_of_sigma freshno sigma' true in
+ let e' = Pure.env_of_sigma freshno sigma' in
prerr_endline "--------<REDUCE>---------";
(function
| 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 (not (Pure.diverged t))
) conv ;
let diverged = (=) B;;
+(* Note: maps only variables <= freshno *)
+let env_of_sigma freshno sigma =
+ let rec aux n =
+ if n > freshno then
+ []
+ else
+ let e = aux (n+1) in
+ (try
+ e, lift (-n-1) (snd (List.find (fun (i,_) -> i = n) sigma)),[]
+ with
+ Not_found -> ([], V n, []) ) :: e
+ in aux 0
+
end
module Scott =