X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Facic_procedural%2FproceduralOptimizer.ml;h=a397de41e8fa3b8b82b930968a1ef1251d45baec;hb=1b70a1f66be53f76e475383e86d63c2b5c1fbcaa;hp=50e3024605a564caad2e19be389c4984576ff9e3;hpb=89519c7b52e06304a94019dd528925300380cdc0;p=helm.git diff --git a/helm/software/components/acic_procedural/proceduralOptimizer.ml b/helm/software/components/acic_procedural/proceduralOptimizer.ml index 50e302460..a397de41e 100644 --- a/helm/software/components/acic_procedural/proceduralOptimizer.ml +++ b/helm/software/components/acic_procedural/proceduralOptimizer.ml @@ -81,7 +81,7 @@ let rec add_abst k = function | t -> C.Lambda (C.Anonymous, C.Implicit None, S.lift 1 t) let rec opt_letin g st es c name v w t = - let name = H.mk_fresh_name c name in + let name = H.mk_fresh_name true c name in let entry = Some (name, C.Def (v, w)) in let g st t = if DTI.does_not_occur 1 t then @@ -99,7 +99,9 @@ let rec opt_letin g st es c name v w t = | v when H.is_proof c v && H.is_atomic v -> let x = S.subst v t in opt_proof g (info st "Optimizer: remove 5") true c x - | v -> +(* | v when t = C.Rel 1 -> + g (info st "Optimizer: remove 6") v +*) | v -> g st (C.LetIn (name, v, w, t)) in if es then opt_term g st es c v else g st v @@ -107,7 +109,7 @@ let rec opt_letin g st es c name v w t = if es then opt_proof g st es (entry :: c) t else g st t and opt_lambda g st es c name w t = - let name = H.mk_fresh_name c name in + let name = H.mk_fresh_name true c name in let entry = Some (name, C.Decl w) in let g st t = g st (C.Lambda (name, w, t)) in if es then opt_proof g st es (entry :: c) t else g st t @@ -185,6 +187,10 @@ and opt_mutcase_critical g st es c uri tyno outty arg cases = let ps, sort_disp = H.get_ind_parameters c arg in let lps, rps = HEL.split_nth lpsno ps in let rpsno = List.length rps in + if rpsno = 0 && sort_disp = 0 then +(* FG: the transformation is not possible, we fall back into the plain case *) + opt_mutcase_plain g st es c uri tyno outty arg cases + else let predicate = clear_absts rpsno (1 - sort_disp) outty in let is_recursive t = I.S.mem tyno (I.get_mutinds_of_uri uri t) @@ -253,8 +259,16 @@ let wrap g st c bo = let optimize_obj = function | C.Constant (name, Some bo, ty, pars, attrs) -> - let count_nodes = I.count_nodes ~implicit:false 0 in + let count_nodes = I.count_nodes ~meta:false 0 in let st, c = {info = ""; dummy = ()}, [] in + L.time_stamp ("PO: OPTIMIZING " ^ name); + let nodes = Printf.sprintf "Initial nodes: %u" (count_nodes bo) in + if !debug then begin + Printf.eprintf "BEGIN: %s\n" name; + Printf.eprintf "Initial : %s\n" (Pp.ppterm bo); + prerr_string "Ut.pp_term : "; + Ut.pp_term prerr_string [] c bo; prerr_newline () + end; let bo, ty = H.cic_bc c bo, H.cic_bc c ty in let g st bo = if !debug then begin @@ -268,9 +282,6 @@ let optimize_obj = function L.time_stamp ("PO: DONE " ^ name); C.Constant (name, Some bo, ty, pars, attrs), st.info in - L.time_stamp ("PO: OPTIMIZING " ^ name); - if !debug then Printf.eprintf "BEGIN: %s\n" name; - let nodes = Printf.sprintf "Initial nodes: %u" (count_nodes bo) in wrap g (info st nodes) c bo | obj -> obj, ""