X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=ocaml%2Fpure.ml;h=11cb9af81638ca6f546cd2a7e67ed182a3f9f50c;hb=18e8638888e5e47d755a6c7c4bff37a1a6ec026b;hp=f1cac843e2349f15c1e5c4cf9c5dd00e3c05e4af;hpb=5cecab147f53f77dcf70a0f1845772d41cff1597;p=fireball-separation.git diff --git a/ocaml/pure.ml b/ocaml/pure.ml index f1cac84..11cb9af 100644 --- a/ocaml/pure.ml +++ b/ocaml/pure.ml @@ -94,6 +94,7 @@ in let rec aux g = function (* mmm -> print_endline (print_machine mmm); match mmm with *) + m when unwind m = let d = L(A(V 0, V 0)) in A(d,d) -> [], B, [] | (e,A(t1,t2),s) -> let t2' = aux g (e,t2,[]) in let (_,t,_) = t2' in @@ -131,6 +132,19 @@ let omega should_explode = 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 =