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