src/Pure/Isar/isar_thy.ML
changeset 7678 027b6ec2f084
parent 7666 226ea33c7cd6
child 7734 9c098c777926
equal deleted inserted replaced
7677:de2e468a42c8 7678:027b6ec2f084
   133     -> Toplevel.transition -> Toplevel.transition
   133     -> Toplevel.transition -> Toplevel.transition
   134   val finally: ((string * Args.src list) list * Comment.interest) option * Comment.text
   134   val finally: ((string * Args.src list) list * Comment.interest) option * Comment.text
   135     -> Toplevel.transition -> Toplevel.transition
   135     -> Toplevel.transition -> Toplevel.transition
   136   val finally_i: (thm list * Comment.interest) option * Comment.text
   136   val finally_i: (thm list * Comment.interest) option * Comment.text
   137     -> Toplevel.transition -> Toplevel.transition
   137     -> Toplevel.transition -> Toplevel.transition
       
   138   val obtain: ((string list * string option) * Comment.text) list
       
   139     * ((string * Args.src list * (string * (string list * string list)) list)
       
   140       * Comment.text) list -> ProofHistory.T -> ProofHistory.T
       
   141   val obtain_i: ((string list * typ option) * Comment.text) list
       
   142     * ((string * Proof.context attribute list * (term * (term list * term list)) list)
       
   143       * Comment.text) list -> ProofHistory.T -> ProofHistory.T
   138   val use_mltext: string -> bool -> theory option -> unit
   144   val use_mltext: string -> bool -> theory option -> unit
   139   val use_mltext_theory: string -> bool -> theory -> theory
   145   val use_mltext_theory: string -> bool -> theory -> theory
   140   val use_setup: string -> theory -> theory
   146   val use_setup: string -> theory -> theory
   141   val parse_ast_translation: string -> theory -> theory
   147   val parse_ast_translation: string -> theory -> theory
   142   val parse_translation: string -> theory -> theory
   148   val parse_translation: string -> theory -> theory
   279 val match_bind_i = ProofHistory.apply o Proof.match_bind_i o map Comment.ignore;
   285 val match_bind_i = ProofHistory.apply o Proof.match_bind_i o map Comment.ignore;
   280 
   286 
   281 
   287 
   282 (* statements *)
   288 (* statements *)
   283 
   289 
       
   290 fun multi_local_attribute state (name, src, s) =
       
   291   (name, map (Attrib.local_attribute (Proof.theory_of state)) src, s);
       
   292 
   284 local
   293 local
   285 
   294 
   286 fun global_statement f (name, src, s) int thy =
   295 fun global_statement f (name, src, s) int thy =
   287   ProofHistory.init (Toplevel.undo_limit int)
   296   ProofHistory.init (Toplevel.undo_limit int)
   288     (f name (map (Attrib.global_attribute thy) src) s thy);
   297     (f name (map (Attrib.global_attribute thy) src) s thy);
   294   f name (map (Attrib.local_attribute (Proof.theory_of state)) src) s (g state));
   303   f name (map (Attrib.local_attribute (Proof.theory_of state)) src) s (g state));
   295 
   304 
   296 fun local_statement_i f g (name, atts, t) = ProofHistory.apply (f name atts t o g);
   305 fun local_statement_i f g (name, atts, t) = ProofHistory.apply (f name atts t o g);
   297 
   306 
   298 fun multi_statement f args = ProofHistory.apply (fn state =>
   307 fun multi_statement f args = ProofHistory.apply (fn state =>
   299   f (map (fn (name, src, s) =>
   308   f (map (multi_local_attribute state) args) state);
   300       (name, map (Attrib.local_attribute (Proof.theory_of state)) src, s)) args) state);
       
   301 
   309 
   302 fun multi_statement_i f args = ProofHistory.apply (f args);
   310 fun multi_statement_i f args = ProofHistory.apply (f args);
   303 
   311 
   304 in
   312 in
   305 
   313 
   431 fun finally_i x = proof''' (ProofHistory.applys o gen_calc get_thmss_i Calculation.finally x);
   439 fun finally_i x = proof''' (ProofHistory.applys o gen_calc get_thmss_i Calculation.finally x);
   432 
   440 
   433 end;
   441 end;
   434 
   442 
   435 
   443 
       
   444 (* obtain *)
       
   445 
       
   446 fun obtain (xs, asms) = ProofHistory.applys (fn state =>
       
   447   Obtain.obtain (map Comment.ignore xs)
       
   448     (map (multi_local_attribute state o Comment.ignore) asms) state);
       
   449 
       
   450 fun obtain_i (xs, asms) = ProofHistory.applys
       
   451   (Obtain.obtain_i (map Comment.ignore xs) (map Comment.ignore asms));
       
   452 
       
   453 
       
   454 
   436 (* use ML text *)
   455 (* use ML text *)
   437 
   456 
   438 fun use_mltext txt verb opt_thy = Context.setmp opt_thy (use_text verb) txt;
   457 fun use_mltext txt verb opt_thy = Context.setmp opt_thy (use_text verb) txt;
   439 fun use_mltext_theory txt verb thy = #2 (Context.pass_theory thy (use_text verb) txt);
   458 fun use_mltext_theory txt verb thy = #2 (Context.pass_theory thy (use_text verb) txt);
   440 
   459