src/Provers/classical.ML
changeset 18728 6790126ab5f6
parent 18708 4b3dadb4fe33
child 18834 7e94af77cfce
equal deleted inserted replaced
18727:caf9bc780c80 18728:6790126ab5f6
   141   val del_context_unsafe_wrapper: string -> theory -> theory
   141   val del_context_unsafe_wrapper: string -> theory -> theory
   142   val get_claset: theory -> claset
   142   val get_claset: theory -> claset
   143   val print_local_claset: Proof.context -> unit
   143   val print_local_claset: Proof.context -> unit
   144   val get_local_claset: Proof.context -> claset
   144   val get_local_claset: Proof.context -> claset
   145   val put_local_claset: claset -> Proof.context -> Proof.context
   145   val put_local_claset: claset -> Proof.context -> Proof.context
   146   val safe_dest: int option -> Context.generic attribute
   146   val safe_dest: int option -> attribute
   147   val safe_elim: int option -> Context.generic attribute
   147   val safe_elim: int option -> attribute
   148   val safe_intro: int option -> Context.generic attribute
   148   val safe_intro: int option -> attribute
   149   val haz_dest: int option -> Context.generic attribute
   149   val haz_dest: int option -> attribute
   150   val haz_elim: int option -> Context.generic attribute
   150   val haz_elim: int option -> attribute
   151   val haz_intro: int option -> Context.generic attribute
   151   val haz_intro: int option -> attribute
   152   val rule_del: Context.generic attribute
   152   val rule_del: attribute
   153   val cla_modifiers: (Args.T list -> (Method.modifier * Args.T list)) list
   153   val cla_modifiers: (Args.T list -> (Method.modifier * Args.T list)) list
   154   val cla_meth: (claset -> tactic) -> thm list -> Proof.context -> Proof.method
   154   val cla_meth: (claset -> tactic) -> thm list -> Proof.context -> Proof.method
   155   val cla_meth': (claset -> int -> tactic) -> thm list -> Proof.context -> Proof.method
   155   val cla_meth': (claset -> int -> tactic) -> thm list -> Proof.context -> Proof.method
   156   val cla_method: (claset -> tactic) -> Method.src -> Proof.context -> Proof.method
   156   val cla_method: (claset -> tactic) -> Method.src -> Proof.context -> Proof.method
   157   val cla_method': (claset -> int -> tactic) -> Method.src -> Proof.context -> Proof.method
   157   val cla_method': (claset -> int -> tactic) -> Method.src -> Proof.context -> Proof.method
   947   context_cs ctxt (get_local_claset ctxt) (get_context_cs ctxt);
   947   context_cs ctxt (get_local_claset ctxt) (get_context_cs ctxt);
   948 
   948 
   949 
   949 
   950 (* attributes *)
   950 (* attributes *)
   951 
   951 
   952 fun attrib f = Attrib.declaration (fn th =>
   952 fun attrib f = Thm.declaration_attribute (fn th =>
   953    fn Context.Theory thy => (change_claset_of thy (f th); Context.Theory thy)
   953    fn Context.Theory thy => (change_claset_of thy (f th); Context.Theory thy)
   954     | Context.Proof ctxt => Context.Proof (LocalClaset.map (f th) ctxt));
   954     | Context.Proof ctxt => Context.Proof (LocalClaset.map (f th) ctxt));
   955 
   955 
   956 fun safe_dest w = attrib (addSE w o name_make_elim);
   956 fun safe_dest w = attrib (addSE w o name_make_elim);
   957 val safe_elim = attrib o addSE;
   957 val safe_elim = attrib o addSE;
   987 val elimN = "elim";
   987 val elimN = "elim";
   988 val destN = "dest";
   988 val destN = "dest";
   989 val ruleN = "rule";
   989 val ruleN = "rule";
   990 
   990 
   991 val setup_attrs = Attrib.add_attributes
   991 val setup_attrs = Attrib.add_attributes
   992  [("swapped", Attrib.common swapped, "classical swap of introduction rule"),
   992  [("swapped", swapped, "classical swap of introduction rule"),
   993   (destN, Attrib.common (ContextRules.add_args safe_dest haz_dest ContextRules.dest_query),
   993   (destN, ContextRules.add_args safe_dest haz_dest ContextRules.dest_query,
   994     "declaration of Classical destruction rule"),
   994     "declaration of Classical destruction rule"),
   995   (elimN, Attrib.common (ContextRules.add_args safe_elim haz_elim ContextRules.elim_query),
   995   (elimN, ContextRules.add_args safe_elim haz_elim ContextRules.elim_query,
   996     "declaration of Classical elimination rule"),
   996     "declaration of Classical elimination rule"),
   997   (introN, Attrib.common (ContextRules.add_args safe_intro haz_intro ContextRules.intro_query),
   997   (introN, ContextRules.add_args safe_intro haz_intro ContextRules.intro_query,
   998     "declaration of Classical introduction rule"),
   998     "declaration of Classical introduction rule"),
   999   (ruleN, Attrib.common (Attrib.syntax (Scan.lift Args.del >> K rule_del)),
   999   (ruleN, Attrib.syntax (Scan.lift Args.del >> K rule_del),
  1000     "remove declaration of intro/elim/dest rule")];
  1000     "remove declaration of intro/elim/dest rule")];
  1001 
  1001 
  1002 
  1002 
  1003 
  1003 
  1004 (** proof methods **)
  1004 (** proof methods **)
  1042 
  1042 
  1043 
  1043 
  1044 (* automatic methods *)
  1044 (* automatic methods *)
  1045 
  1045 
  1046 val cla_modifiers =
  1046 val cla_modifiers =
  1047  [Args.$$$ destN -- Args.bang_colon >> K ((I, Attrib.context (safe_dest NONE)): Method.modifier),
  1047  [Args.$$$ destN -- Args.bang_colon >> K ((I, safe_dest NONE): Method.modifier),
  1048   Args.$$$ destN -- Args.colon >> K (I, Attrib.context (haz_dest NONE)),
  1048   Args.$$$ destN -- Args.colon >> K (I, haz_dest NONE),
  1049   Args.$$$ elimN -- Args.bang_colon >> K (I, Attrib.context (safe_elim NONE)),
  1049   Args.$$$ elimN -- Args.bang_colon >> K (I, safe_elim NONE),
  1050   Args.$$$ elimN -- Args.colon >> K (I, Attrib.context (haz_elim NONE)),
  1050   Args.$$$ elimN -- Args.colon >> K (I, haz_elim NONE),
  1051   Args.$$$ introN -- Args.bang_colon >> K (I, Attrib.context (safe_intro NONE)),
  1051   Args.$$$ introN -- Args.bang_colon >> K (I, safe_intro NONE),
  1052   Args.$$$ introN -- Args.colon >> K (I, Attrib.context (haz_intro NONE)),
  1052   Args.$$$ introN -- Args.colon >> K (I, haz_intro NONE),
  1053   Args.del -- Args.colon >> K (I, Attrib.context rule_del)];
  1053   Args.del -- Args.colon >> K (I, rule_del)];
  1054 
  1054 
  1055 fun cla_meth tac prems ctxt = Method.METHOD (fn facts =>
  1055 fun cla_meth tac prems ctxt = Method.METHOD (fn facts =>
  1056   ALLGOALS (Method.insert_tac (prems @ facts)) THEN tac (local_claset_of ctxt));
  1056   ALLGOALS (Method.insert_tac (prems @ facts)) THEN tac (local_claset_of ctxt));
  1057 
  1057 
  1058 fun cla_meth' tac prems ctxt = Method.METHOD (fn facts =>
  1058 fun cla_meth' tac prems ctxt = Method.METHOD (fn facts =>