110 end; |
110 end; |
111 |
111 |
112 fun print_rules prt x (Rules {rules, ...}) = |
112 fun print_rules prt x (Rules {rules, ...}) = |
113 let |
113 let |
114 fun prt_kind (i, b) = |
114 fun prt_kind (i, b) = |
115 Pretty.big_list (the (assoc (kind_names, (i, b))) ^ ":") |
115 Pretty.big_list (valOf (assoc (kind_names, (i, b))) ^ ":") |
116 (mapfilter (fn (_, (k, th)) => if k = (i, b) then SOME (prt x th) else NONE) |
116 (List.mapPartial (fn (_, (k, th)) => if k = (i, b) then SOME (prt x th) else NONE) |
117 (sort (Int.compare o pairself fst) rules)); |
117 (sort (Int.compare o pairself fst) rules)); |
118 in Pretty.writeln (Pretty.chunks (map prt_kind rule_kinds)) end; |
118 in Pretty.writeln (Pretty.chunks (map prt_kind rule_kinds)) end; |
119 |
119 |
120 |
120 |
121 (* theory and proof data *) |
121 (* theory and proof data *) |
134 let |
134 let |
135 val wrappers = (gen_merge_lists' eq_snd ws1 ws2, gen_merge_lists' eq_snd ws1' ws2'); |
135 val wrappers = (gen_merge_lists' eq_snd ws1 ws2, gen_merge_lists' eq_snd ws1' ws2'); |
136 val rules = gen_merge_lists' (fn ((_, (k1, th1)), (_, (k2, th2))) => |
136 val rules = gen_merge_lists' (fn ((_, (k1, th1)), (_, (k2, th2))) => |
137 k1 = k2 andalso Drule.eq_thm_prop (th1, th2)) rules1 rules2; |
137 k1 = k2 andalso Drule.eq_thm_prop (th1, th2)) rules1 rules2; |
138 val next = ~ (length rules); |
138 val next = ~ (length rules); |
139 val netpairs = foldl (fn (nps, (n, (w, ((i, b), th)))) => |
139 val netpairs = Library.foldl (fn (nps, (n, (w, ((i, b), th)))) => |
140 map_nth_elem i (curry insert_tagged_brl ((w, n), (b, th))) nps) |
140 map_nth_elem i (curry insert_tagged_brl ((w, n), (b, th))) nps) |
141 (empty_netpairs, next upto ~1 ~~ rules); |
141 (empty_netpairs, next upto ~1 ~~ rules); |
142 in make_rules (next - 1) rules netpairs wrappers end; |
142 in make_rules (next - 1) rules netpairs wrappers end; |
143 |
143 |
144 val print = print_rules Display.pretty_thm_sg; |
144 val print = print_rules Display.pretty_thm_sg; |
201 val addWrapper = gen_add_wrapper Library.apsnd; |
201 val addWrapper = gen_add_wrapper Library.apsnd; |
202 |
202 |
203 |
203 |
204 fun gen_wrap which ctxt = |
204 fun gen_wrap which ctxt = |
205 let val Rules {wrappers, ...} = LocalRules.get ctxt |
205 let val Rules {wrappers, ...} = LocalRules.get ctxt |
206 in fn tac => foldr (fn ((w, _), t) => w t) (which wrappers, tac) end; |
206 in fn tac => Library.foldr (fn ((w, _), t) => w t) (which wrappers, tac) end; |
207 |
207 |
208 val Swrap = gen_wrap #1; |
208 val Swrap = gen_wrap #1; |
209 val wrap = gen_wrap #2; |
209 val wrap = gen_wrap #2; |
210 |
210 |
211 |
211 |