src/Pure/Isar/context_rules.ML
changeset 15801 d2f5ca3c048d
parent 15574 b1d1b5bfc464
child 15973 5fd94d84470f
equal deleted inserted replaced
15800:f2215ed00438 15801:d2f5ca3c048d
    47   val delrules_global: theory * thm list -> theory
    47   val delrules_global: theory * thm list -> theory
    48   val addXIs_local: ProofContext.context * thm list -> ProofContext.context
    48   val addXIs_local: ProofContext.context * thm list -> ProofContext.context
    49   val addXEs_local: ProofContext.context * thm list -> ProofContext.context
    49   val addXEs_local: ProofContext.context * thm list -> ProofContext.context
    50   val addXDs_local: ProofContext.context * thm list -> ProofContext.context
    50   val addXDs_local: ProofContext.context * thm list -> ProofContext.context
    51   val delrules_local: ProofContext.context * thm list -> ProofContext.context
    51   val delrules_local: ProofContext.context * thm list -> ProofContext.context
    52   val setup: (theory -> theory) list
       
    53 end;
    52 end;
    54 
    53 
    55 structure ContextRules: CONTEXT_RULES =
    54 structure ContextRules: CONTEXT_RULES =
    56 struct
    55 struct
    57 
    56 
   143 
   142 
   144   val print = print_rules Display.pretty_thm_sg;
   143   val print = print_rules Display.pretty_thm_sg;
   145 end;
   144 end;
   146 
   145 
   147 structure GlobalRules = TheoryDataFun(GlobalRulesArgs);
   146 structure GlobalRules = TheoryDataFun(GlobalRulesArgs);
       
   147 val _ = Context.add_setup [GlobalRules.init];
   148 val print_global_rules = GlobalRules.print;
   148 val print_global_rules = GlobalRules.print;
   149 
   149 
   150 structure LocalRulesArgs =
   150 structure LocalRulesArgs =
   151 struct
   151 struct
   152   val name = GlobalRulesArgs.name;
   152   val name = GlobalRulesArgs.name;
   154   val init = GlobalRules.get;
   154   val init = GlobalRules.get;
   155   val print = print_rules ProofContext.pretty_thm;
   155   val print = print_rules ProofContext.pretty_thm;
   156 end;
   156 end;
   157 
   157 
   158 structure LocalRules = ProofDataFun(LocalRulesArgs);
   158 structure LocalRules = ProofDataFun(LocalRulesArgs);
       
   159 val _ = Context.add_setup [LocalRules.init];
   159 val print_local_rules = LocalRules.print;
   160 val print_local_rules = LocalRules.print;
   160 
   161 
   161 
   162 
   162 (* access data *)
   163 (* access data *)
   163 
   164 
   246 val dest_query_local   = add elim_queryK Tactic.make_elim LocalRules.map;
   247 val dest_query_local   = add elim_queryK Tactic.make_elim LocalRules.map;
   247 val rule_del_local     = del LocalRules.map;
   248 val rule_del_local     = del LocalRules.map;
   248 
   249 
   249 end;
   250 end;
   250 
   251 
       
   252 val _ = Context.add_setup
       
   253   [#1 o PureThy.add_thms [(("", Drule.equal_intr_rule), [intro_query_global NONE])]];
       
   254 
   251 
   255 
   252 (* low-level modifiers *)
   256 (* low-level modifiers *)
   253 
   257 
   254 fun modifier att (x, ths) =
   258 fun modifier att (x, ths) =
   255   #1 (Thm.applys_attributes ((x, rev ths), [att]));
   259   #1 (Thm.applys_attributes ((x, rev ths), [att]));
   263 val addXEs_local = modifier (elim_query_local NONE);
   267 val addXEs_local = modifier (elim_query_local NONE);
   264 val addXDs_local = modifier (dest_query_local NONE);
   268 val addXDs_local = modifier (dest_query_local NONE);
   265 val delrules_local = modifier rule_del_local;
   269 val delrules_local = modifier rule_del_local;
   266 
   270 
   267 
   271 
   268 
   272 end;
   269 (** theory setup **)
       
   270 
       
   271 val setup =
       
   272  [GlobalRules.init, LocalRules.init];
       
   273 
       
   274 
       
   275 end;