src/Pure/Isar/context_rules.ML
changeset 15531 08c8dad8e399
parent 14981 e73f8140af78
child 15570 8d8c70b41bab
equal deleted inserted replaced
15530:6f43714517ee 15531:08c8dad8e399
    93 
    93 
    94 fun make_rules next rules netpairs wrappers =
    94 fun make_rules next rules netpairs wrappers =
    95   Rules {next = next, rules = rules, netpairs = netpairs, wrappers = wrappers};
    95   Rules {next = next, rules = rules, netpairs = netpairs, wrappers = wrappers};
    96 
    96 
    97 fun add_rule (i, b) opt_w th (Rules {next, rules, netpairs, wrappers}) =
    97 fun add_rule (i, b) opt_w th (Rules {next, rules, netpairs, wrappers}) =
    98   let val w = (case opt_w of Some w => w | None => Tactic.subgoals_of_brl (b, th)) in
    98   let val w = (case opt_w of SOME w => w | NONE => Tactic.subgoals_of_brl (b, th)) in
    99     make_rules (next - 1) ((w, ((i, b), th)) :: rules)
    99     make_rules (next - 1) ((w, ((i, b), th)) :: rules)
   100       (map_nth_elem i (curry insert_tagged_brl ((w, next), (b, th))) netpairs) wrappers
   100       (map_nth_elem i (curry insert_tagged_brl ((w, next), (b, th))) netpairs) wrappers
   101   end;
   101   end;
   102 
   102 
   103 fun del_rule th (rs as Rules {next, rules, netpairs, wrappers}) =
   103 fun del_rule th (rs as Rules {next, rules, netpairs, wrappers}) =
   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 (the (assoc (kind_names, (i, b))) ^ ":")
   116         (mapfilter (fn (_, (k, th)) => if k = (i, b) then Some (prt x th) else None)
   116         (mapfilter (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 *)
   252 (* low-level modifiers *)
   252 (* low-level modifiers *)
   253 
   253 
   254 fun modifier att (x, ths) =
   254 fun modifier att (x, ths) =
   255   #1 (Thm.applys_attributes ((x, rev ths), [att]));
   255   #1 (Thm.applys_attributes ((x, rev ths), [att]));
   256 
   256 
   257 val addXIs_global = modifier (intro_query_global None);
   257 val addXIs_global = modifier (intro_query_global NONE);
   258 val addXEs_global = modifier (elim_query_global None);
   258 val addXEs_global = modifier (elim_query_global NONE);
   259 val addXDs_global = modifier (dest_query_global None);
   259 val addXDs_global = modifier (dest_query_global NONE);
   260 val delrules_global = modifier rule_del_global;
   260 val delrules_global = modifier rule_del_global;
   261 
   261 
   262 val addXIs_local = modifier (intro_query_local None);
   262 val addXIs_local = modifier (intro_query_local NONE);
   263 val addXEs_local = modifier (elim_query_local None);
   263 val addXEs_local = modifier (elim_query_local NONE);
   264 val addXDs_local = modifier (dest_query_local None);
   264 val addXDs_local = modifier (dest_query_local NONE);
   265 val delrules_local = modifier rule_del_local;
   265 val delrules_local = modifier rule_del_local;
   266 
   266 
   267 
   267 
   268 
   268 
   269 (** theory setup **)
   269 (** theory setup **)