src/Pure/pure_setup.ML
author haftmann
Mon, 29 Dec 2008 17:56:37 +0100
changeset 29198 418ed6411847
parent 29123 63c25d3964f7
child 29618 8161c8e3fa10
permissions -rw-r--r--
pretty printer for bindings
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23828
a8a3962f8eeb Pure theory setup.
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/pure_setup.ML
a8a3962f8eeb Pure theory setup.
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
a8a3962f8eeb Pure theory setup.
wenzelm
parents:
diff changeset
     3
24053
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
     4
Pure theory and ML toplevel setup.
23828
a8a3962f8eeb Pure theory setup.
wenzelm
parents:
diff changeset
     5
*)
a8a3962f8eeb Pure theory setup.
wenzelm
parents:
diff changeset
     6
24053
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
     7
(* ML toplevel use commands *)
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
     8
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
     9
fun use name          = Toplevel.program (fn () => ThyInfo.use name);
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    10
fun use_thys name     = Toplevel.program (fn () => ThyInfo.use_thys name);
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    11
fun use_thy name      = Toplevel.program (fn () => ThyInfo.use_thy name);
24174
59a5ffec7078 theory loader: removed obsolete update_thy (coincides with use_thy);
wenzelm
parents: 24053
diff changeset
    12
fun time_use name     = Toplevel.program (fn () => ThyInfo.time_use name);
24053
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    13
fun time_use_thy name = Toplevel.program (fn () => ThyInfo.time_use_thy name);
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    14
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    15
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    16
(* the Pure theories *)
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    17
26608
ff838a61dad6 val theory = ThyInfo.get_theory;
wenzelm
parents: 26463
diff changeset
    18
val theory = ThyInfo.get_theory;
ff838a61dad6 val theory = ThyInfo.get_theory;
wenzelm
parents: 26463
diff changeset
    19
26463
9283b4185fdf Context.>> : operate on Context.generic;
wenzelm
parents: 26435
diff changeset
    20
Context.>> (Context.map_theory
9283b4185fdf Context.>> : operate on Context.generic;
wenzelm
parents: 26435
diff changeset
    21
 (OuterSyntax.process_file (Path.explode "Pure.thy") #>
9283b4185fdf Context.>> : operate on Context.generic;
wenzelm
parents: 26435
diff changeset
    22
  Theory.end_theory));
26427
f33d1b522316 implicit setup of emerging theory Pure;
wenzelm
parents: 25223
diff changeset
    23
structure Pure = struct val thy = ML_Context.the_global_context () end;
f33d1b522316 implicit setup of emerging theory Pure;
wenzelm
parents: 25223
diff changeset
    24
Context.set_thread_data NONE;
f33d1b522316 implicit setup of emerging theory Pure;
wenzelm
parents: 25223
diff changeset
    25
ThyInfo.register_theory Pure.thy;
23828
a8a3962f8eeb Pure theory setup.
wenzelm
parents:
diff changeset
    26
24053
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    27
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    28
(* ML toplevel pretty printing *)
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    29
29123
63c25d3964f7 renamed structure TaskQueue to Task_Queue;
wenzelm
parents: 28557
diff changeset
    30
install_pp (make_pp ["Task_Queue", "task"] (Pretty.pprint o Pretty.str o Task_Queue.str_of_task));
63c25d3964f7 renamed structure TaskQueue to Task_Queue;
wenzelm
parents: 28557
diff changeset
    31
install_pp (make_pp ["Task_Queue", "group"] (Pretty.pprint o Pretty.str o Task_Queue.str_of_group));
27776
644e03cb568d install_pp Position.T;
wenzelm
parents: 27341
diff changeset
    32
install_pp (make_pp ["Position", "T"] (Pretty.pprint o Pretty.enum "," "{" "}" o
644e03cb568d install_pp Position.T;
wenzelm
parents: 27341
diff changeset
    33
  map (fn (x, y) => Pretty.str (x ^ "=" ^ y)) o Position.properties_of));
24053
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    34
install_pp (make_pp ["Thm", "thm"] ProofDisplay.pprint_thm);
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    35
install_pp (make_pp ["Thm", "cterm"] ProofDisplay.pprint_cterm);
29198
418ed6411847 pretty printer for bindings
haftmann
parents: 29123
diff changeset
    36
install_pp (make_pp ["Binding", "T"] (Pretty.pprint o Pretty.str o Binding.display));
24053
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    37
install_pp (make_pp ["Thm", "ctyp"] ProofDisplay.pprint_ctyp);
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    38
install_pp (make_pp ["Context", "theory"] Context.pprint_thy);
27341
97e2ccba3b64 added pprint_thy_ref;
wenzelm
parents: 26957
diff changeset
    39
install_pp (make_pp ["Context", "theory_ref"] Context.pprint_thy_ref);
24053
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    40
install_pp (make_pp ["Context", "proof"] ProofDisplay.pprint_context);
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    41
install_pp (make_pp ["Syntax", "ast"] Syntax.pprint_ast);
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    42
install_pp (make_pp ["typ"] (ProofDisplay.pprint_typ Pure.thy));
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    43
install_pp (make_pp ["Path", "T"] (Pretty.pprint o Pretty.str o quote o Path.implode));
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    44
install_pp (make_pp ["File", "ident"] (Pretty.pprint o Pretty.str o quote o File.rep_ident));
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    45
28557
6a661aeff564 extra Poly/ML toplevel pretty printing in ML-Systems/install_pp_polyml.ML;
wenzelm
parents: 28414
diff changeset
    46
if String.isPrefix "polyml" ml_system then use "ML-Systems/install_pp_polyml.ML"
6a661aeff564 extra Poly/ML toplevel pretty printing in ML-Systems/install_pp_polyml.ML;
wenzelm
parents: 28414
diff changeset
    47
else ();
6a661aeff564 extra Poly/ML toplevel pretty printing in ML-Systems/install_pp_polyml.ML;
wenzelm
parents: 28414
diff changeset
    48
24053
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    49
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    50
(* misc *)
af1dd276fae0 added ML toplevel use commands: Toplevel.program;
wenzelm
parents: 23828
diff changeset
    51
23828
a8a3962f8eeb Pure theory setup.
wenzelm
parents:
diff changeset
    52
val cd = File.cd o Path.explode;
a8a3962f8eeb Pure theory setup.
wenzelm
parents:
diff changeset
    53
ml_prompts "ML> " "ML# ";
a8a3962f8eeb Pure theory setup.
wenzelm
parents:
diff changeset
    54
25223
7463251e7273 qualified Proofterm.proofs;
wenzelm
parents: 24960
diff changeset
    55
Proofterm.proofs := 0;