equal
deleted
inserted
replaced
105 Proof.context -> atp_format -> formula_kind -> formula_kind -> type_enc |
105 Proof.context -> atp_format -> formula_kind -> formula_kind -> type_enc |
106 -> bool -> string -> bool -> bool -> bool -> term list -> term |
106 -> bool -> string -> bool -> bool -> bool -> term list -> term |
107 -> ((string * stature) * term) list |
107 -> ((string * stature) * term) list |
108 -> string problem * string Symtab.table * (string * stature) list vector |
108 -> string problem * string Symtab.table * (string * stature) list vector |
109 * (string * term) list * int Symtab.table |
109 * (string * term) list * int Symtab.table |
110 val atp_problem_relevance_weights : string problem -> (string * real) list |
110 val atp_problem_selection_weights : string problem -> (string * real) list |
111 val atp_problem_kbo_weights : string problem -> (string * int) list |
111 val atp_problem_term_order_weights : string problem -> (string * int) list |
112 end; |
112 end; |
113 |
113 |
114 structure ATP_Problem_Generate : ATP_PROBLEM_GENERATE = |
114 structure ATP_Problem_Generate : ATP_PROBLEM_GENERATE = |
115 struct |
115 struct |
116 |
116 |
2708 val fact_min_weight = 0.2 |
2708 val fact_min_weight = 0.2 |
2709 val fact_max_weight = 1.0 |
2709 val fact_max_weight = 1.0 |
2710 val type_info_default_weight = 0.8 |
2710 val type_info_default_weight = 0.8 |
2711 |
2711 |
2712 (* Weights are from 0.0 (most important) to 1.0 (least important). *) |
2712 (* Weights are from 0.0 (most important) to 1.0 (least important). *) |
2713 fun atp_problem_relevance_weights problem = |
2713 fun atp_problem_selection_weights problem = |
2714 let |
2714 let |
2715 fun add_term_weights weight (ATerm (s, tms)) = |
2715 fun add_term_weights weight (ATerm (s, tms)) = |
2716 is_tptp_user_symbol s ? Symtab.default (s, weight) |
2716 is_tptp_user_symbol s ? Symtab.default (s, weight) |
2717 #> fold (add_term_weights weight) tms |
2717 #> fold (add_term_weights weight) tms |
2718 | add_term_weights weight (AAbs (_, tm)) = add_term_weights weight tm |
2718 | add_term_weights weight (AAbs (_, tm)) = add_term_weights weight tm |
2752 have_head_rolling (hd args) ||> append (tl args) |
2752 have_head_rolling (hd args) ||> append (tl args) |
2753 else |
2753 else |
2754 (s, args) |
2754 (s, args) |
2755 | have_head_rolling _ = ("", []) |
2755 | have_head_rolling _ = ("", []) |
2756 |
2756 |
2757 val max_kbo_weight = 2147483647 |
2757 val max_term_order_weight = 2147483647 |
2758 |
2758 |
2759 fun atp_problem_kbo_weights problem = |
2759 fun atp_problem_term_order_weights problem = |
2760 let |
2760 let |
2761 fun add_term_deps head (ATerm (s, args)) = |
2761 fun add_term_deps head (ATerm (s, args)) = |
2762 is_tptp_user_symbol s ? perhaps (try (Graph.add_edge_acyclic (s, head))) |
2762 is_tptp_user_symbol s ? perhaps (try (Graph.add_edge_acyclic (s, head))) |
2763 #> fold (add_term_deps head) args |
2763 #> fold (add_term_deps head) args |
2764 | add_term_deps head (AAbs (_, tm)) = add_term_deps head tm |
2764 | add_term_deps head (AAbs (_, tm)) = add_term_deps head tm |
2778 else |
2778 else |
2779 I |
2779 I |
2780 val graph = |
2780 val graph = |
2781 Graph.empty |> fold (fold (add_line_deps spec_eqN) o snd) problem |
2781 Graph.empty |> fold (fold (add_line_deps spec_eqN) o snd) problem |
2782 |> fold (fold (add_line_deps simpN) o snd) problem |
2782 |> fold (fold (add_line_deps simpN) o snd) problem |
2783 fun next_weight w = if w + w <= max_kbo_weight then w + w else w + 1 |
2783 fun next_weight w = if w + w <= max_term_order_weight then w + w else w + 1 |
2784 fun add_weights _ [] = I |
2784 fun add_weights _ [] = I |
2785 | add_weights weight syms = |
2785 | add_weights weight syms = |
2786 fold (AList.update (op =) o rpair weight) syms |
2786 fold (AList.update (op =) o rpair weight) syms |
2787 #> add_weights (next_weight weight) |
2787 #> add_weights (next_weight weight) |
2788 (fold (union (op =) o Graph.immediate_succs graph) syms []) |
2788 (fold (union (op =) o Graph.immediate_succs graph) syms []) |