25 {rules: thm list, (*the type-checking rules*) |
25 {rules: thm list, (*the type-checking rules*) |
26 net: thm Net.net}; (*discrimination net of the same rules*) |
26 net: thm Net.net}; (*discrimination net of the same rules*) |
27 |
27 |
28 fun add_rule th (tcs as TC {rules, net}) = |
28 fun add_rule th (tcs as TC {rules, net}) = |
29 if member Thm.eq_thm_prop rules th then |
29 if member Thm.eq_thm_prop rules th then |
30 (warning ("Ignoring duplicate type-checking rule\n" ^ Display.string_of_thm th); tcs) |
30 (warning ("Ignoring duplicate type-checking rule\n" ^ |
|
31 Display.string_of_thm_without_context th); tcs) |
31 else |
32 else |
32 TC {rules = th :: rules, |
33 TC {rules = th :: rules, |
33 net = Net.insert_term (K false) (Thm.concl_of th, th) net}; |
34 net = Net.insert_term (K false) (Thm.concl_of th, th) net}; |
34 |
35 |
35 fun del_rule th (tcs as TC {rules, net}) = |
36 fun del_rule th (tcs as TC {rules, net}) = |
36 if member Thm.eq_thm_prop rules th then |
37 if member Thm.eq_thm_prop rules th then |
37 TC {net = Net.delete_term Thm.eq_thm_prop (Thm.concl_of th, th) net, |
38 TC {net = Net.delete_term Thm.eq_thm_prop (Thm.concl_of th, th) net, |
38 rules = remove Thm.eq_thm_prop th rules} |
39 rules = remove Thm.eq_thm_prop th rules} |
39 else (warning ("No such type-checking rule\n" ^ Display.string_of_thm th); tcs); |
40 else (warning ("No such type-checking rule\n" ^ |
|
41 Display.string_of_thm_without_context th); tcs); |
40 |
42 |
41 |
43 |
42 (* generic data *) |
44 (* generic data *) |
43 |
45 |
44 structure Data = GenericDataFun |
46 structure Data = GenericDataFun |
58 val tcset_of = Data.get o Context.Proof; |
60 val tcset_of = Data.get o Context.Proof; |
59 |
61 |
60 fun print_tcset ctxt = |
62 fun print_tcset ctxt = |
61 let val TC {rules, ...} = tcset_of ctxt in |
63 let val TC {rules, ...} = tcset_of ctxt in |
62 Pretty.writeln (Pretty.big_list "type-checking rules:" |
64 Pretty.writeln (Pretty.big_list "type-checking rules:" |
63 (map (ProofContext.pretty_thm ctxt) rules)) |
65 (map (Display.pretty_thm ctxt) rules)) |
64 end; |
66 end; |
65 |
67 |
66 |
68 |
67 (* tactics *) |
69 (* tactics *) |
68 |
70 |