271 tag_brls (k+1) brls; |
271 tag_brls (k+1) brls; |
272 |
272 |
273 fun tag_brls' _ _ [] = [] |
273 fun tag_brls' _ _ [] = [] |
274 | tag_brls' w k (brl::brls) = ((w, k), brl) :: tag_brls' w (k + 1) brls; |
274 | tag_brls' w k (brl::brls) = ((w, k), brl) :: tag_brls' w (k + 1) brls; |
275 |
275 |
276 fun insert_tagged_list rls = fold_rev Bires.insert_tagged_brl rls; |
|
277 |
|
278 (*Insert into netpair that already has nI intr rules and nE elim rules. |
276 (*Insert into netpair that already has nI intr rules and nE elim rules. |
279 Count the intr rules double (to account for swapify). Negate to give the |
277 Count the intr rules double (to account for swapify). Negate to give the |
280 new insertions the lowest priority.*) |
278 new insertions the lowest priority.*) |
281 fun insert (nI, nE) = insert_tagged_list o (tag_brls (~(2*nI+nE))) o joinrules; |
279 fun insert (nI, nE) = Bires.insert_tagged_rules o (tag_brls (~(2*nI+nE))) o joinrules; |
282 fun insert' w (nI, nE) = insert_tagged_list o tag_brls' w (~(nI + nE)) o joinrules; |
280 fun insert' w (nI, nE) = Bires.insert_tagged_rules o tag_brls' w (~(nI + nE)) o joinrules; |
283 |
281 |
284 fun delete_tagged_list rls = fold_rev Bires.delete_tagged_brl rls; |
282 fun delete x = Bires.delete_tagged_rules (joinrules x); |
285 fun delete x = delete_tagged_list (joinrules x); |
|
286 |
283 |
287 fun bad_thm ctxt msg th = error (msg ^ "\n" ^ Thm.string_of_thm ctxt th); |
284 fun bad_thm ctxt msg th = error (msg ^ "\n" ^ Thm.string_of_thm ctxt th); |
288 |
285 |
289 fun make_elim ctxt th = |
286 fun make_elim ctxt th = |
290 if Thm.no_prems th then bad_thm ctxt "Ill-formed destruction rule" th |
287 if Thm.no_prems th then bad_thm ctxt "Ill-formed destruction rule" th |