X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Fdual_rg%2FdrgAut.ml;h=bf42cc2abaab83252857ffc32b9c0e4eaa857f50;hb=f7bb626faf6b9d89c0ee5ac48b1d97c69d189f8a;hp=3e19444087010cf58af6e18eab246cbd3ec950fb;hpb=ece36f3adcdf55739b4686168b49506439bff2ba;p=helm.git diff --git a/helm/software/lambda-delta/dual_rg/drgAut.ml b/helm/software/lambda-delta/dual_rg/drgAut.ml index 3e1944408..bf42cc2ab 100644 --- a/helm/software/lambda-delta/dual_rg/drgAut.ml +++ b/helm/software/lambda-delta/dual_rg/drgAut.ml @@ -53,7 +53,7 @@ let add_abst (a, ws) id w = Y.Name (id, true) :: a, w :: ws let lenv_of_cnt (a, ws) = - D.push C.start D.empty_lenv a (D.Abst ws) + D.push_bind C.start D.empty_lenv a (D.Abst ws) let mk_lref f i j k = f (D.TLRef ([Y.Apix k], i, j)) @@ -89,10 +89,11 @@ let relax_opt_qid f st = function let resolve_gref err f st qid = try let cnt = H.find st.henv (uri_of_qid qid) in f qid cnt - with Not_found -> err () + with Not_found -> err qid let resolve_gref_relaxed f st qid = - let rec err () = relax_qid (resolve_gref err f st) st qid in +(* this is not tail recursive *) + let rec err qid = relax_qid (resolve_gref err f st) st qid in resolve_gref err f st qid let get_cnt err f st = function @@ -102,9 +103,11 @@ let get_cnt err f st = function with Not_found -> err node let get_cnt_relaxed f st = +(* this is not tail recursive *) let rec err node = relax_opt_qid (get_cnt err f st) st node in get_cnt err f st st.node +(* this is not tail recursive in the GRef branch *) let rec xlate_term f st lenv = function | A.Sort s -> let f h = f (D.TSort ([], h)) in @@ -118,18 +121,22 @@ let rec xlate_term f st lenv = function let a, b = [Y.Name (name, true)], (D.Abst [ww]) in let f tt = f (D.TBind (a, b, tt)) in let f lenv = xlate_term f st lenv t in - D.push f lenv a b + D.push_bind f lenv a b in xlate_term f st lenv w | A.GRef (name, args) -> let g qid (a, _) = + let gref = D.TGRef ([], uri_of_qid qid) in let map1 f = xlate_term f st lenv in let map2 f = function | Y.Name (id, _) -> D.resolve_lref Cps.err (mk_lref f) id lenv | _ -> assert false in let f tail = - let f args = f (D.TAppl ([], args, D.TGRef ([], uri_of_qid qid))) in + let f = function + | [] -> f gref + | args -> f (D.TAppl ([], args, gref)) + in let f a = C.list_rev_map_append f map2 a ~tail in C.list_sub_strict f a args in