src/Pure/ROOT.ML
author wenzelm
Tue Mar 18 16:44:51 2014 +0100 (2014-03-18)
changeset 56206 7adec2a527f5
parent 56205 ceb8a93460b7
child 56208 06cc31dff138
permissions -rw-r--r--
clarified module arrangement;
more antiquotations;
wenzelm@31432
     1
(** Pure Isabelle **)
clasohm@0
     2
wenzelm@26109
     3
structure Distribution =     (*filled-in by makedist*)
wenzelm@26109
     4
struct
wenzelm@32361
     5
  val version = "unidentified repository version";
wenzelm@27642
     6
  val is_official = false;
wenzelm@26109
     7
end;
wenzelm@11835
     8
wenzelm@12248
     9
print_depth 10;
clasohm@0
    10
wenzelm@31432
    11
wenzelm@31432
    12
(* library of general tools *)
wenzelm@31432
    13
wenzelm@21396
    14
use "General/basics.ML";
clasohm@0
    15
use "library.ML";
wenzelm@31432
    16
use "General/print_mode.ML";
wenzelm@31432
    17
use "General/alist.ML";
wenzelm@31432
    18
use "General/table.ML";
wenzelm@43684
    19
wenzelm@43684
    20
use "Concurrent/simple_thread.ML";
wenzelm@43684
    21
wenzelm@43684
    22
use "Concurrent/synchronized.ML";
wenzelm@43684
    23
if Multithreading.available then ()
wenzelm@43684
    24
else use "Concurrent/synchronized_sequential.ML";
wenzelm@52537
    25
use "Concurrent/counter.ML";
wenzelm@43684
    26
wenzelm@43746
    27
use "General/properties.ML";
wenzelm@31432
    28
use "General/output.ML";
wenzelm@45670
    29
use "PIDE/markup.ML";
wenzelm@50201
    30
fun legacy_feature s = warning (Markup.markup Markup.legacy ("Legacy feature! " ^ s));
wenzelm@51606
    31
use "General/timing.ML";
wenzelm@31432
    32
use "General/scan.ML";
wenzelm@31432
    33
use "General/source.ML";
wenzelm@31432
    34
use "General/symbol.ML";
wenzelm@31432
    35
use "General/seq.ML";
wenzelm@31432
    36
use "General/position.ML";
wenzelm@31432
    37
use "General/symbol_pos.ML";
wenzelm@31432
    38
use "General/antiquote.ML";
wenzelm@31432
    39
use "ML/ml_lex.ML";
wenzelm@31432
    40
use "ML/ml_parse.ML";
wenzelm@31432
    41
use "General/secure.ML";
wenzelm@56203
    42
(*^^^^^ end of ML bootstrap 0 ^^^^^*)
wenzelm@31432
    43
use "General/integer.ML";
wenzelm@31432
    44
use "General/stack.ML";
wenzelm@31432
    45
use "General/queue.ML";
wenzelm@31432
    46
use "General/heap.ML";
wenzelm@32015
    47
use "General/same.ML";
wenzelm@31432
    48
use "General/ord_list.ML";
wenzelm@31432
    49
use "General/balanced_tree.ML";
wenzelm@38448
    50
use "General/linear_set.ML";
wenzelm@43593
    51
use "General/buffer.ML";
wenzelm@43791
    52
use "General/pretty.ML";
wenzelm@31432
    53
use "General/path.ML";
wenzelm@31432
    54
use "General/url.ML";
wenzelm@31432
    55
use "General/file.ML";
wenzelm@43547
    56
use "General/long_name.ML";
wenzelm@43547
    57
use "General/binding.ML";
wenzelm@50800
    58
use "General/socket_io.ML";
wenzelm@22592
    59
wenzelm@35628
    60
use "General/sha1.ML";
wenzelm@43948
    61
if ML_System.is_polyml then use "General/sha1_polyml.ML" else ();
wenzelm@53212
    62
use "General/sha1_samples.ML";
wenzelm@35628
    63
wenzelm@44698
    64
use "PIDE/xml.ML";
wenzelm@44698
    65
use "PIDE/yxml.ML";
wenzelm@44698
    66
wenzelm@56053
    67
use "General/change_table.ML";
wenzelm@49560
    68
use "General/graph.ML";
wenzelm@49560
    69
wenzelm@51947
    70
use "System/options.ML";
wenzelm@51947
    71
wenzelm@31432
    72
wenzelm@31432
    73
(* concurrency within the ML runtime *)
wenzelm@28120
    74
wenzelm@50911
    75
if ML_System.is_polyml
wenzelm@50911
    76
then use "ML/exn_properties_polyml.ML"
wenzelm@50911
    77
else use "ML/exn_properties_dummy.ML";
wenzelm@50911
    78
wenzelm@53709
    79
if ML_System.name = "polyml-5.5.1"
wenzelm@54717
    80
  orelse ML_System.name = "polyml-5.5.2"
wenzelm@53709
    81
then use "ML/exn_trace_polyml-5.5.1.ML"
wenzelm@53709
    82
else ();
wenzelm@53709
    83
wenzelm@54717
    84
if ML_System.name = "polyml-5.5.0"
wenzelm@54717
    85
  orelse ML_System.name = "polyml-5.5.1"
wenzelm@54717
    86
  orelse ML_System.name = "polyml-5.5.2"
wenzelm@50255
    87
then use "ML/ml_statistics_polyml-5.5.0.ML"
wenzelm@50255
    88
else use "ML/ml_statistics_dummy.ML";
wenzelm@50255
    89
wenzelm@35014
    90
use "Concurrent/single_assignment.ML";
wenzelm@35014
    91
if Multithreading.available then ()
wenzelm@35014
    92
else use "Concurrent/single_assignment_sequential.ML";
wenzelm@35014
    93
wenzelm@40748
    94
if Multithreading.available
wenzelm@40748
    95
then use "Concurrent/bash.ML"
wenzelm@40748
    96
else use "Concurrent/bash_sequential.ML";
wenzelm@40748
    97
wenzelm@44247
    98
use "Concurrent/par_exn.ML";
wenzelm@31432
    99
use "Concurrent/task_queue.ML";
wenzelm@31432
   100
use "Concurrent/future.ML";
wenzelm@52798
   101
use "Concurrent/event_timer.ML";
wenzelm@52798
   102
wenzelm@52798
   103
if ML_System.is_polyml then use "Concurrent/time_limit.ML" else ();
wenzelm@32840
   104
wenzelm@32815
   105
use "Concurrent/lazy.ML";
wenzelm@32815
   106
if Multithreading.available then ()
wenzelm@32815
   107
else use "Concurrent/lazy_sequential.ML";
wenzelm@32840
   108
wenzelm@31432
   109
use "Concurrent/par_list.ML";
wenzelm@32815
   110
if Multithreading.available then ()
wenzelm@32816
   111
else use "Concurrent/par_list_sequential.ML";
wenzelm@31432
   112
wenzelm@44247
   113
use "Concurrent/mailbox.ML";
wenzelm@32840
   114
use "Concurrent/cache.ML";
wenzelm@32840
   115
wenzelm@50500
   116
use "PIDE/active.ML";
wenzelm@50500
   117
wenzelm@31432
   118
wenzelm@31432
   119
(* fundamental structures *)
wenzelm@31432
   120
wenzelm@20075
   121
use "name.ML";
clasohm@0
   122
use "term.ML";
wenzelm@28404
   123
use "context.ML";
wenzelm@47813
   124
use "context_position.ML";
wenzelm@39508
   125
use "config.ML";
wenzelm@19
   126
wenzelm@52059
   127
val quick_and_dirty_raw = Config.declare_option "quick_and_dirty";
wenzelm@52059
   128
val quick_and_dirty = Config.bool quick_and_dirty_raw;
wenzelm@52059
   129
wenzelm@31432
   130
wenzelm@31432
   131
(* inner syntax *)
wenzelm@31432
   132
wenzelm@52211
   133
use "Syntax/type_annotation.ML";
wenzelm@42264
   134
use "Syntax/term_position.ML";
wenzelm@42264
   135
use "Syntax/lexicon.ML";
wenzelm@22679
   136
use "Syntax/ast.ML";
wenzelm@42288
   137
use "Syntax/syntax_ext.ML";
wenzelm@22679
   138
use "Syntax/parser.ML";
wenzelm@42284
   139
use "Syntax/syntax_trans.ML";
wenzelm@22679
   140
use "Syntax/mixfix.ML";
wenzelm@22679
   141
use "Syntax/printer.ML";
wenzelm@22679
   142
use "Syntax/syntax.ML";
wenzelm@22679
   143
wenzelm@31432
   144
wenzelm@31432
   145
(* core of tactical proof system *)
wenzelm@31432
   146
wenzelm@42382
   147
use "term_ord.ML";
wenzelm@42382
   148
use "term_subst.ML";
wenzelm@43729
   149
use "term_xml.ML";
wenzelm@55672
   150
use "General/completion.ML";
wenzelm@42382
   151
use "General/name_space.ML";
wenzelm@42382
   152
use "sorts.ML";
wenzelm@42382
   153
use "type.ML";
wenzelm@42382
   154
use "logic.ML";
wenzelm@42382
   155
use "Syntax/simple_syntax.ML";
wenzelm@30559
   156
use "net.ML";
wenzelm@30559
   157
use "item_net.ML";
wenzelm@18934
   158
use "envir.ML";
wenzelm@18059
   159
use "consts.ML";
wenzelm@24257
   160
use "primitive_defs.ML";
haftmann@27546
   161
use "defs.ML";
clasohm@0
   162
use "sign.ML";
wenzelm@43795
   163
use "term_sharing.ML";
clasohm@0
   164
use "pattern.ML";
clasohm@0
   165
use "unify.ML";
paulson@1528
   166
use "theory.ML";
wenzelm@24664
   167
use "interpretation.ML";
berghofe@11511
   168
use "proofterm.ML";
clasohm@0
   169
use "thm.ML";
wenzelm@22361
   170
use "more_thm.ML";
wenzelm@26279
   171
use "facts.ML";
wenzelm@39557
   172
use "global_theory.ML";
wenzelm@3986
   173
use "pure_thy.ML";
clasohm@0
   174
use "drule.ML";
wenzelm@22233
   175
use "morphism.ML";
wenzelm@19898
   176
use "variable.ML";
wenzelm@24833
   177
use "conv.ML";
wenzelm@32187
   178
use "goal_display.ML";
wenzelm@32169
   179
use "tactical.ML";
paulson@1582
   180
use "search.ML";
wenzelm@21708
   181
use "tactic.ML";
wenzelm@41228
   182
use "raw_simplifier.ML";
wenzelm@19417
   183
use "conjunction.ML";
wenzelm@20225
   184
use "assumption.ML";
wenzelm@32089
   185
use "display.ML";
clasohm@0
   186
wenzelm@31432
   187
wenzelm@31432
   188
(* Isar -- Intelligible Semi-Automated Reasoning *)
wenzelm@31432
   189
wenzelm@49041
   190
(*ML support*)
wenzelm@49041
   191
use "ML/ml_syntax.ML";
wenzelm@49041
   192
use "ML/ml_env.ML";
wenzelm@49041
   193
use "Isar/runtime.ML";
wenzelm@49041
   194
use "ML/ml_compiler.ML";
wenzelm@49041
   195
if ML_System.is_polyml then use "ML/ml_compiler_polyml.ML" else ();
wenzelm@49041
   196
wenzelm@53192
   197
(*global execution*)
wenzelm@53192
   198
use "PIDE/document_id.ML";
wenzelm@53192
   199
use "PIDE/execution.ML";
wenzelm@51551
   200
use "skip_proof.ML";
wenzelm@49041
   201
use "goal.ML";
wenzelm@49041
   202
wenzelm@31432
   203
(*proof context*)
wenzelm@31432
   204
use "Isar/object_logic.ML";
wenzelm@31432
   205
use "Isar/rule_cases.ML";
wenzelm@31432
   206
use "Isar/auto_bind.ML";
wenzelm@42241
   207
use "type_infer.ML";
wenzelm@42240
   208
use "Syntax/local_syntax.ML";
wenzelm@31432
   209
use "Isar/proof_context.ML";
wenzelm@42405
   210
use "type_infer_context.ML";
wenzelm@42243
   211
use "Syntax/syntax_phases.ML";
wenzelm@31432
   212
use "Isar/local_defs.ML";
wenzelm@31432
   213
wenzelm@31432
   214
(*outer syntax*)
wenzelm@36959
   215
use "Isar/token.ML";
wenzelm@36949
   216
use "Isar/keyword.ML";
wenzelm@36949
   217
use "Isar/parse.ML";
wenzelm@31432
   218
use "Isar/args.ML";
wenzelm@31432
   219
wenzelm@31432
   220
(*theory sources*)
wenzelm@31432
   221
use "Thy/thy_header.ML";
wenzelm@51265
   222
use "Thy/thy_syntax.ML";
wenzelm@31432
   223
use "Thy/html.ML";
wenzelm@31432
   224
use "Thy/latex.ML";
wenzelm@31432
   225
wenzelm@56203
   226
(*ML with context and antiquotations*)
wenzelm@56203
   227
use "ML/ml_context.ML";
wenzelm@56205
   228
use "ML/ml_antiquotation.ML";
wenzelm@56203
   229
val use = ML_Context.eval_file true o Path.explode;
wenzelm@56203
   230
(*^^^^^ end of ML bootstrap 1 ^^^^^*)
wenzelm@56203
   231
wenzelm@31432
   232
(*basic proof engine*)
wenzelm@31432
   233
use "Isar/proof_display.ML";
wenzelm@31432
   234
use "Isar/attrib.ML";
wenzelm@31432
   235
use "Isar/context_rules.ML";
wenzelm@31432
   236
use "Isar/method.ML";
wenzelm@31432
   237
use "Isar/proof.ML";
wenzelm@31432
   238
use "Isar/element.ML";
wenzelm@31432
   239
use "Isar/obtain.ML";
wenzelm@31432
   240
wenzelm@31432
   241
(*local theories and targets*)
haftmann@52140
   242
use "Isar/locale.ML";
wenzelm@31432
   243
use "Isar/local_theory.ML";
haftmann@38307
   244
use "Isar/generic_target.ML";
wenzelm@31432
   245
use "Isar/overloading.ML";
wenzelm@35669
   246
use "axclass.ML";
haftmann@38379
   247
use "Isar/class.ML";
haftmann@38350
   248
use "Isar/named_target.ML";
wenzelm@31432
   249
use "Isar/expression.ML";
haftmann@38379
   250
use "Isar/class_declaration.ML";
wenzelm@47057
   251
use "Isar/bundle.ML";
wenzelm@31432
   252
wenzelm@31432
   253
use "simplifier.ML";
wenzelm@31432
   254
wenzelm@31432
   255
(*executable theory content*)
wenzelm@31432
   256
use "Isar/code.ML";
wenzelm@31432
   257
wenzelm@31432
   258
(*specifications*)
wenzelm@36952
   259
use "Isar/parse_spec.ML";
wenzelm@33374
   260
use "Isar/spec_rules.ML";
wenzelm@31432
   261
use "Isar/specification.ML";
wenzelm@35626
   262
use "Isar/typedecl.ML";
wenzelm@31432
   263
wenzelm@31432
   264
(*toplevel transactions*)
wenzelm@31432
   265
use "Isar/proof_node.ML";
wenzelm@31432
   266
use "Isar/toplevel.ML";
wenzelm@31432
   267
wenzelm@56206
   268
(*proof term operations*)
wenzelm@56206
   269
use "Proof/reconstruct.ML";
wenzelm@56206
   270
use "Proof/proof_syntax.ML";
wenzelm@56206
   271
use "Proof/proof_rewrite_rules.ML";
wenzelm@56206
   272
use "Proof/proof_checker.ML";
wenzelm@56206
   273
use "Proof/extraction.ML";
wenzelm@56206
   274
wenzelm@38271
   275
(*theory documents*)
wenzelm@40743
   276
use "System/isabelle_system.ML";
wenzelm@31432
   277
use "Thy/term_style.ML";
wenzelm@31432
   278
use "Thy/thy_output.ML";
wenzelm@31432
   279
use "Isar/outer_syntax.ML";
wenzelm@49561
   280
use "General/graph_display.ML";
wenzelm@43712
   281
use "Thy/present.ML";
wenzelm@52510
   282
use "PIDE/command.ML";
wenzelm@52865
   283
use "PIDE/query_operation.ML";
wenzelm@43712
   284
use "Thy/thy_load.ML";
wenzelm@31432
   285
use "Thy/thy_info.ML";
wenzelm@44185
   286
use "PIDE/document.ML";
wenzelm@31432
   287
wenzelm@31432
   288
(*theory and proof operations*)
wenzelm@31432
   289
use "Thy/thm_deps.ML";
wenzelm@31432
   290
use "Isar/isar_cmd.ML";
wenzelm@31432
   291
wenzelm@20207
   292
use "subgoal.ML";
wenzelm@5834
   293
wenzelm@31432
   294
wenzelm@31432
   295
(* Isabelle/Isar system *)
wenzelm@31432
   296
wenzelm@30173
   297
use "System/session.ML";
wenzelm@48681
   298
use "System/command_line.ML";
wenzelm@45029
   299
use "System/system_channel.ML";
wenzelm@52584
   300
use "System/message_channel.ML";
wenzelm@38412
   301
use "System/isabelle_process.ML";
wenzelm@43748
   302
use "System/invoke_scala.ML";
wenzelm@45709
   303
use "PIDE/protocol.ML";
wenzelm@30173
   304
use "System/isar.ML";
wenzelm@30173
   305
wenzelm@31432
   306
wenzelm@31432
   307
(* miscellaneous tools and packages for Pure Isabelle *)
wenzelm@31432
   308
wenzelm@50686
   309
use "Tools/build.ML";
wenzelm@31432
   310
use "Tools/named_thms.ML";
wenzelm@52009
   311
use "Tools/proof_general.ML";
wenzelm@31432
   312
wenzelm@55387
   313
structure Output: OUTPUT = Output;  (*seal system channels!*)
wenzelm@55387
   314
wenzelm@31432
   315
wenzelm@48732
   316
(* ML toplevel pretty printing *)
wenzelm@48732
   317
wenzelm@48732
   318
toplevel_pp ["Pretty", "T"] "(fn _: Pretty.T => Pretty.str \"<pretty>\")";
wenzelm@48732
   319
toplevel_pp ["Task_Queue", "task"] "Pretty.str o Task_Queue.str_of_task";
wenzelm@48732
   320
toplevel_pp ["Task_Queue", "group"] "Pretty.str o Task_Queue.str_of_group";
wenzelm@48732
   321
toplevel_pp ["Position", "T"] "Pretty.position";
wenzelm@48732
   322
toplevel_pp ["Binding", "binding"] "Pretty.str o Binding.print";
wenzelm@48732
   323
toplevel_pp ["Thm", "thm"] "Proof_Display.pp_thm";
wenzelm@48732
   324
toplevel_pp ["Thm", "cterm"] "Proof_Display.pp_cterm";
wenzelm@48732
   325
toplevel_pp ["Thm", "ctyp"] "Proof_Display.pp_ctyp";
wenzelm@48732
   326
toplevel_pp ["Context", "theory"] "Context.pretty_thy";
wenzelm@48732
   327
toplevel_pp ["Context", "Proof", "context"] "Proof_Display.pp_context";
wenzelm@48732
   328
toplevel_pp ["Ast", "ast"] "Ast.pretty_ast";
wenzelm@48732
   329
toplevel_pp ["Path", "T"] "Path.pretty";
wenzelm@48732
   330
toplevel_pp ["SHA1", "digest"] "Pretty.str o quote o SHA1.rep";
wenzelm@48732
   331
toplevel_pp ["Proof", "state"] "(fn _: Proof.state => Pretty.str \"<Proof.state>\")";
wenzelm@48732
   332
toplevel_pp ["Toplevel", "state"] "Toplevel.pretty_abstract";
wenzelm@54740
   333
toplevel_pp ["Morphism", "morphism"] "Morphism.pretty";
wenzelm@48732
   334
wenzelm@48732
   335
if ML_System.is_polyml then use "ML/install_pp_polyml.ML" else ();
wenzelm@48732
   336
wenzelm@48732
   337
wenzelm@49862
   338
(* the Pure theory *)
wenzelm@49862
   339
wenzelm@49862
   340
use "pure_syn.ML";
wenzelm@49862
   341
Toplevel.program (fn () => Thy_Info.use_thy ("Pure", Position.none));
wenzelm@49862
   342
Context.set_thread_data NONE;
wenzelm@49862
   343
structure Pure = struct val thy = Thy_Info.get_theory "Pure" end;
wenzelm@49862
   344
wenzelm@49862
   345
toplevel_pp ["typ"] "Proof_Display.pp_typ Pure.thy";
wenzelm@49862
   346
wenzelm@49862
   347
wenzelm@48879
   348
(* ML toplevel commands *)
wenzelm@48879
   349
wenzelm@48927
   350
fun use_thys args = Toplevel.program (fn () => Thy_Info.use_thys (map (rpair Position.none) args));
wenzelm@48927
   351
val use_thy = use_thys o single;
wenzelm@48732
   352
wenzelm@48732
   353
val cd = File.cd o Path.explode;
wenzelm@48732
   354
wenzelm@52487
   355
Proofterm.proofs := 0;
wenzelm@30639
   356