From: acondolu Date: Mon, 24 Jul 2017 12:05:08 +0000 (+0200) Subject: Removed special strategies in choose_step X-Git-Tag: weak-reduction-separation~7 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=5d7387369fe31267d6d414395d7dde2c32a265b0;p=fireball-separation.git Removed special strategies in choose_step --- diff --git a/ocaml/lambda4.ml b/ocaml/lambda4.ml index dbad9e0..721f822 100644 --- a/ocaml/lambda4.ml +++ b/ocaml/lambda4.ml @@ -336,22 +336,22 @@ let rec edible ({div; conv; ps} as p) arities showstoppers = aux showstoppers xs with Dangerous -> - aux (sort_uniq (h::showstoppers)) ps in - - let showstoppers = sort_uniq (aux showstoppers ps) in - let dangerous_conv = - List.map (dangerous_conv p arities showstoppers) (conv :> nf list) in + aux (sort_uniq (h::showstoppers)) ps + in + let showstoppers = sort_uniq (aux showstoppers ps) in + let dangerous_conv = + List.map (dangerous_conv p arities showstoppers) (conv :> nf list) in prerr_endline ("dangerous_conv lenght:" ^ string_of_int (List.length dangerous_conv)); List.iter (fun l -> prerr_endline (String.concat " " (List.map (string_of_var p.var_names) l))) dangerous_conv; - let showstoppers' = showstoppers @ List.concat dangerous_conv in - let showstoppers' = sort_uniq (match div with - | None -> showstoppers' - | Some div -> - if List.exists ((=) (hd_of_i_var div)) showstoppers' - then showstoppers' @ free_vars (div :> nf) else showstoppers') in - if showstoppers <> showstoppers' then edible p arities showstoppers' else showstoppers', dangerous_conv + let showstoppers' = showstoppers @ List.concat dangerous_conv in + let showstoppers' = sort_uniq (match div with + | None -> showstoppers' + | Some div -> + if List.exists ((=) (hd_of_i_var div)) showstoppers' + then showstoppers' @ free_vars (div :> nf) else showstoppers') in + if showstoppers <> showstoppers' then edible p arities showstoppers' else showstoppers', dangerous_conv ;; let precompute_edible_data {ps; div} xs = @@ -399,8 +399,8 @@ let critical_showstoppers p = let showstoppers_eat = List.filter (fun x -> not (List.mem x showstoppers_step)) showstoppers_eat in -List.iter (fun v -> prerr_endline ("DANGEROUS STEP: " ^ (string_of_var p.var_names) v)) showstoppers_step; -List.iter (fun v -> prerr_endline ("DANGEROUS EAT: " ^ (string_of_var p.var_names) v)) showstoppers_eat; + List.iter (fun v -> prerr_endline ("DANGEROUS STEP: " ^ (string_of_var p.var_names) v)) showstoppers_step; + List.iter (fun v -> prerr_endline ("DANGEROUS EAT: " ^ (string_of_var p.var_names) v)) showstoppers_eat; p, showstoppers_step, showstoppers_eat ;; @@ -537,36 +537,6 @@ let auto_instantiate (n,p) = | x::_, _ -> prerr_endline ("INSTANTIATING " ^ string_of_var p.var_names x); x in -(* Strategy that decreases the special_k to 0 first (round robin) -1:11m42 2:14m5 3:11m16s 4:14m46s 5:12m7s 6:6m31s *) - let x = - try - match - hd_of (List.find (fun t -> - compute_special_k (Listx.Nil (t :> nf)) > 0 && arity_of_hd t > 0 - ) (all_terms p)) - with - | None -> assert false - | Some x -> - prerr_endline ("INSTANTIATING AND HOPING " ^ string_of_var p.var_names x); - x - with - Not_found -> - let arity_of_x = max_arity_tms x (all_terms p) in - assert (Util.option_get arity_of_x > 0); - x in -(* Instantiate in decreasing order of compute_special_k -1:15m14s 2:13m14s 3:4m55s 4:4m43s 5:4m34s 6:6m28s 7:3m31s -let x = - try - (match hd_of (snd (List.hd (List.sort (fun c1 c2 -> - compare (fst c1) (fst c2)) (filter_map (function `I _ as t -> Some (compute_special_k (Listx.Nil (t :> nf)),t) | _ -> None) (all_terms p))))) with - None -> assert false - | Some x -> - prerr_endline ("INSTANTIATING AND HOPING " ^ string_of_var x); - x) - with - Not_found -> x -in*) let special_k = compute_special_k (Listx.from_list (all_terms p :> nf list) )in if special_k < n then