src/Pure/pure_setup.ML
author blanchet
Tue, 07 Dec 2010 11:56:01 +0100
changeset 41051 2ed1b971fc20
parent 40741 17d6293a1e26
child 41415 23533273220a
permissions -rw-r--r--
give the inner timeout mechanism a chance, since it gives more precise information to the user

(*  Title:      Pure/pure_setup.ML
    Author:     Makarius

Pure theory and ML toplevel setup.
*)

(* the Pure theory *)

Context.>> (Context.map_theory
 (Outer_Syntax.process_file (Path.explode "Pure.thy") #>
  Theory.end_theory));

structure Pure = struct val thy = ML_Context.the_global_context () end;

Context.set_thread_data NONE;
Thy_Info.register_thy Pure.thy;


(* ML toplevel pretty printing *)

if String.isPrefix "polyml" ml_system
then toplevel_pp ["String", "string"] "ML_Syntax.pretty_string"
else ();

toplevel_pp ["Pretty", "T"] "(fn _: Pretty.T => Pretty.str \"<pretty>\")";
toplevel_pp ["Task_Queue", "task"] "Pretty.str o Task_Queue.str_of_task";
toplevel_pp ["Task_Queue", "group"] "Pretty.str o Task_Queue.str_of_group";
toplevel_pp ["Position", "T"] "Pretty.position";
toplevel_pp ["Binding", "binding"] "Pretty.str o quote o Binding.str_of";
toplevel_pp ["Thm", "thm"] "Proof_Display.pp_thm";
toplevel_pp ["Thm", "cterm"] "Proof_Display.pp_cterm";
toplevel_pp ["Thm", "ctyp"] "Proof_Display.pp_ctyp";
toplevel_pp ["typ"] "Proof_Display.pp_typ Pure.thy";
toplevel_pp ["Context", "theory"] "Context.pretty_thy";
toplevel_pp ["Context", "theory_ref"] "Context.pretty_thy o Theory.deref";
toplevel_pp ["Context", "Proof", "context"] "Proof_Display.pp_context";
toplevel_pp ["Syntax", "ast"] "Syntax.pretty_ast";
toplevel_pp ["Path", "T"] "Pretty.str o quote o Path.implode";
toplevel_pp ["Thy_Load", "file_ident"] "Thy_Load.pretty_file_ident";
toplevel_pp ["Proof", "state"] "(fn _: Proof.state => Pretty.str \"<Proof.state>\")";
toplevel_pp ["Toplevel", "state"] "Toplevel.pretty_abstract";

if ml_system = "polyml-5.2" orelse ml_system = "polyml-5.2.1"
then use "ML/install_pp_polyml.ML"
else if String.isPrefix "polyml" ml_system
then use "ML/install_pp_polyml-5.3.ML"
else ();


(* ML toplevel use commands *)

fun use name = Toplevel.program (fn () => Thy_Load.use_ml (Path.explode name));

fun use_thys name = Toplevel.program (fn () => Thy_Info.use_thys name);
fun use_thy name = Toplevel.program (fn () => Thy_Info.use_thy name);


(* misc *)

val cd = File.cd o Path.explode;

Proofterm.proofs := 0;