changeset 20457 | 85414caac94a |
parent 20423 | 593053389701 |
child 20527 | 958ec4833d87 |
20456:42be3a46dcd8 | 20457:85414caac94a |
---|---|
1 (* Authors: Jia Meng, NICTA and Lawrence C Paulson, Cambridge University Computer Laboratory |
1 (* Authors: Jia Meng, NICTA and Lawrence C Paulson, Cambridge University Computer Laboratory |
2 ID: $Id$ |
2 ID: $Id$ |
3 Filtering strategies *) |
3 Filtering strategies *) |
4 |
4 |
5 (*A surprising number of theorems contain only a few significant constants. |
|
6 These include all induction rules, and other general theorems. Filtering |
|
7 theorems in clause form reveals these complexities in the form of Skolem |
|
8 functions. If we were instead to filter theorems in their natural form, |
|
9 some other method of measuring theorem complexity would become necessary.*) |
|
10 |
|
5 structure ReduceAxiomsN = |
11 structure ReduceAxiomsN = |
6 struct |
12 struct |
7 |
13 |
14 val run_relevance_filter = ref true; |
|
8 val pass_mark = ref 0.6; |
15 val pass_mark = ref 0.6; |
9 val convergence = ref 2.4; (*Higher numbers allow longer inference chains*) |
16 val convergence = ref 2.4; (*Higher numbers allow longer inference chains*) |
10 val follow_defs = ref false; (*Follow definitions. Makes problems bigger.*) |
17 val follow_defs = ref false; (*Follow definitions. Makes problems bigger.*) |
11 |
18 |
12 fun log_weight2 (x:real) = 1.0 + 2.0/Math.ln (x+1.0); |
19 fun log_weight2 (x:real) = 1.0 + 2.0/Math.ln (x+1.0); |
17 |
24 |
18 |
25 |
19 (*Including equality in this list might be expected to stop rules like subset_antisym from |
26 (*Including equality in this list might be expected to stop rules like subset_antisym from |
20 being chosen, but for some reason filtering works better with them listed.*) |
27 being chosen, but for some reason filtering works better with them listed.*) |
21 val standard_consts = |
28 val standard_consts = |
22 ["Trueprop","==>","all","Ex","op &","op |","Not","All","op -->", |
29 ["Trueprop","==>","all","==","All","Ex","Ball","Bex","op &","op |","Not","op -->", |
23 "op =","==","True","False"]; |
30 "op =","True","False"]; |
24 |
31 |
25 |
32 |
26 (*** constants with types ***) |
33 (*** constants with types ***) |
27 |
34 |
28 (*An abstraction of Isabelle types*) |
35 (*An abstraction of Isabelle types*) |
72 fun add_standard_const (s,tab) = Symtab.update (s,[]) tab; |
79 fun add_standard_const (s,tab) = Symtab.update (s,[]) tab; |
73 |
80 |
74 val null_const_tab : const_typ list list Symtab.table = |
81 val null_const_tab : const_typ list list Symtab.table = |
75 foldl add_standard_const Symtab.empty standard_consts; |
82 foldl add_standard_const Symtab.empty standard_consts; |
76 |
83 |
77 fun get_goal_consts_typs thy cs = foldl (add_term_consts_typs_rm thy) null_const_tab cs; |
84 fun get_goal_consts_typs thy = foldl (add_term_consts_typs_rm thy) null_const_tab; |
78 |
85 |
79 |
86 |
80 (**** Constant / Type Frequencies ****) |
87 (**** Constant / Type Frequencies ****) |
81 |
88 |
82 local |
89 local |
199 Output.debug ("Total relevant: " ^ Int.toString (length rels)); |
206 Output.debug ("Total relevant: " ^ Int.toString (length rels)); |
200 rels |
207 rels |
201 end; |
208 end; |
202 |
209 |
203 fun relevance_filter thy axioms goals = |
210 fun relevance_filter thy axioms goals = |
204 if !pass_mark < 0.1 then axioms |
211 if !run_relevance_filter andalso !pass_mark >= 0.1 |
205 else map #1 (relevance_filter_aux thy axioms goals); |
212 then map #1 (relevance_filter_aux thy axioms goals) |
206 |
213 else axioms |
207 |
214 |
208 end; |
215 end; |