src/Pure/ROOT.ML
author wenzelm
Fri Mar 18 16:38:40 2016 +0100 (2016-03-18)
changeset 62665 a78ce0c6e191
parent 62662 291cc01f56f5
child 62666 00aff1da05ae
permissions -rw-r--r--
clarified modules;
wenzelm@62643
     1
(*** Isabelle/Pure bootstrap ***)
wenzelm@62508
     2
wenzelm@62508
     3
(** bootstrap phase 0: Poly/ML setup **)
wenzelm@62508
     4
wenzelm@62508
     5
(* initial ML name space *)
wenzelm@56288
     6
wenzelm@62508
     7
use "ML/ml_system.ML";
wenzelm@62508
     8
use "ML/ml_name_space.ML";
wenzelm@62508
     9
wenzelm@62508
    10
if List.exists (fn (a, _) => a = "FixedInt") (#allStruct ML_Name_Space.global ()) then ()
wenzelm@62508
    11
else use "ML/fixed_int_dummy.ML";
clasohm@0
    12
wenzelm@26109
    13
structure Distribution =     (*filled-in by makedist*)
wenzelm@26109
    14
struct
wenzelm@32361
    15
  val version = "unidentified repository version";
wenzelm@57649
    16
  val is_identified = false;
wenzelm@27642
    17
  val is_official = false;
wenzelm@26109
    18
end;
wenzelm@11835
    19
wenzelm@31432
    20
wenzelm@62508
    21
(* multithreading *)
wenzelm@62508
    22
wenzelm@62508
    23
use "General/exn.ML";
wenzelm@62508
    24
wenzelm@62508
    25
val seconds = Time.fromReal;
wenzelm@62508
    26
wenzelm@62508
    27
open Thread;
wenzelm@62508
    28
use "Concurrent/multithreading.ML";
wenzelm@62508
    29
wenzelm@62508
    30
use "Concurrent/unsynchronized.ML";
wenzelm@62657
    31
val _ = ML_Name_Space.forget_val "ref";
wenzelm@62657
    32
val _ = ML_Name_Space.forget_type "ref";
wenzelm@62508
    33
wenzelm@62508
    34
wenzelm@62508
    35
(* pervasive environment *)
wenzelm@62508
    36
wenzelm@62659
    37
val _ =
wenzelm@62659
    38
  List.app ML_Name_Space.forget_val
wenzelm@62659
    39
    ["isSome", "getOpt", "valOf", "foldl", "foldr", "print", "explode", "concat"];
wenzelm@62508
    40
wenzelm@62508
    41
val ord = SML90.ord;
wenzelm@62508
    42
val chr = SML90.chr;
wenzelm@62508
    43
val raw_explode = SML90.explode;
wenzelm@62508
    44
val implode = SML90.implode;
wenzelm@62508
    45
wenzelm@62508
    46
wenzelm@62508
    47
(* ML runtime system *)
wenzelm@62508
    48
wenzelm@62508
    49
use "ML/ml_heap.ML";
wenzelm@62508
    50
use "ML/ml_profiling.ML";
wenzelm@62508
    51
wenzelm@62508
    52
val pointer_eq = PolyML.pointerEq;
wenzelm@62508
    53
wenzelm@62508
    54
wenzelm@62508
    55
(* ML toplevel pretty printing *)
wenzelm@62508
    56
wenzelm@62508
    57
use "ML/ml_pretty.ML";
wenzelm@62508
    58
wenzelm@62508
    59
val error_depth = PolyML.error_depth;
wenzelm@62508
    60
wenzelm@62508
    61
wenzelm@62508
    62
(* ML compiler *)
wenzelm@62508
    63
wenzelm@62508
    64
use "General/secure.ML";
wenzelm@62508
    65
use "ML/ml_compiler0.ML";
wenzelm@62508
    66
wenzelm@62508
    67
PolyML.Compiler.reportUnreferencedIds := true;
wenzelm@62508
    68
PolyML.Compiler.reportExhaustiveHandlers := true;
wenzelm@62508
    69
PolyML.Compiler.printInAlphabeticalOrder := false;
wenzelm@62508
    70
PolyML.Compiler.maxInlineSize := 80;
wenzelm@62508
    71
wenzelm@62508
    72
wenzelm@62508
    73
(* ML debugger *)
wenzelm@62508
    74
wenzelm@62508
    75
use_no_debug "ML/ml_debugger.ML";
wenzelm@62508
    76
wenzelm@62508
    77
wenzelm@62508
    78
wenzelm@62508
    79
(** bootstrap phase 1: towards ML within position context *)
wenzelm@62508
    80
wenzelm@31432
    81
(* library of general tools *)
wenzelm@31432
    82
wenzelm@21396
    83
use "General/basics.ML";
clasohm@0
    84
use "library.ML";
wenzelm@31432
    85
use "General/print_mode.ML";
wenzelm@31432
    86
use "General/alist.ML";
wenzelm@31432
    87
use "General/table.ML";
wenzelm@43684
    88
wenzelm@43684
    89
use "Concurrent/synchronized.ML";
wenzelm@52537
    90
use "Concurrent/counter.ML";
wenzelm@43684
    91
wenzelm@62585
    92
use "General/random.ML";
wenzelm@43746
    93
use "General/properties.ML";
wenzelm@31432
    94
use "General/output.ML";
wenzelm@45670
    95
use "PIDE/markup.ML";
wenzelm@31432
    96
use "General/scan.ML";
wenzelm@31432
    97
use "General/source.ML";
wenzelm@31432
    98
use "General/symbol.ML";
wenzelm@31432
    99
use "General/position.ML";
wenzelm@31432
   100
use "General/symbol_pos.ML";
wenzelm@59064
   101
use "General/input.ML";
wenzelm@31432
   102
use "General/antiquote.ML";
wenzelm@31432
   103
use "ML/ml_lex.ML";
wenzelm@56288
   104
wenzelm@62493
   105
val {use, use_debug, use_no_debug} =
wenzelm@62493
   106
  let
wenzelm@62494
   107
    val context: ML_Compiler0.context =
wenzelm@62493
   108
     {name_space = ML_Name_Space.global,
wenzelm@62493
   109
      here = Position.here oo Position.line_file,
wenzelm@62493
   110
      print = writeln,
wenzelm@62494
   111
      error = error};
wenzelm@62493
   112
  in
wenzelm@62494
   113
    ML_Compiler0.use_operations (fn opt_debug => fn file =>
wenzelm@62493
   114
      Position.setmp_thread_data (Position.file_only file)
wenzelm@62493
   115
        (fn () =>
wenzelm@62494
   116
          ML_Compiler0.use_file context
wenzelm@62494
   117
            {verbose = true, debug = ML_Compiler0.debug_option opt_debug} file
wenzelm@62494
   118
          handle ERROR msg => (writeln msg; error "ML error")) ())
wenzelm@62493
   119
  end;
wenzelm@56434
   120
wenzelm@56288
   121
wenzelm@59054
   122
wenzelm@62508
   123
(** bootstrap phase 2: towards ML within Isar context *)
wenzelm@56288
   124
wenzelm@56288
   125
(* library of general tools *)
wenzelm@56288
   126
wenzelm@31432
   127
use "General/integer.ML";
wenzelm@31432
   128
use "General/stack.ML";
wenzelm@31432
   129
use "General/queue.ML";
wenzelm@31432
   130
use "General/heap.ML";
wenzelm@32015
   131
use "General/same.ML";
wenzelm@31432
   132
use "General/ord_list.ML";
wenzelm@31432
   133
use "General/balanced_tree.ML";
wenzelm@38448
   134
use "General/linear_set.ML";
wenzelm@43593
   135
use "General/buffer.ML";
wenzelm@43791
   136
use "General/pretty.ML";
wenzelm@59363
   137
use "PIDE/xml.ML";
wenzelm@31432
   138
use "General/path.ML";
wenzelm@31432
   139
use "General/url.ML";
wenzelm@31432
   140
use "General/file.ML";
wenzelm@43547
   141
use "General/long_name.ML";
wenzelm@43547
   142
use "General/binding.ML";
wenzelm@50800
   143
use "General/socket_io.ML";
wenzelm@56287
   144
use "General/seq.ML";
wenzelm@56287
   145
use "General/timing.ML";
wenzelm@22592
   146
wenzelm@35628
   147
use "General/sha1.ML";
wenzelm@62354
   148
use "General/sha1_polyml.ML";
wenzelm@53212
   149
use "General/sha1_samples.ML";
wenzelm@35628
   150
wenzelm@62659
   151
val _ = List.app ML_Name_Space.forget_structure ML_Name_Space.critical_structures;
wenzelm@62659
   152
wenzelm@44698
   153
use "PIDE/yxml.ML";
wenzelm@56303
   154
use "PIDE/document_id.ML";
wenzelm@44698
   155
wenzelm@56053
   156
use "General/change_table.ML";
wenzelm@49560
   157
use "General/graph.ML";
wenzelm@49560
   158
wenzelm@60911
   159
wenzelm@60911
   160
(* fundamental structures *)
wenzelm@60911
   161
wenzelm@60911
   162
use "name.ML";
wenzelm@60911
   163
use "term.ML";
wenzelm@60911
   164
use "context.ML";
wenzelm@60911
   165
use "context_position.ML";
wenzelm@51947
   166
use "System/options.ML";
wenzelm@60911
   167
use "config.ML";
wenzelm@51947
   168
wenzelm@31432
   169
wenzelm@31432
   170
(* concurrency within the ML runtime *)
wenzelm@28120
   171
wenzelm@62355
   172
use "ML/exn_properties.ML";
wenzelm@50911
   173
wenzelm@62501
   174
use "ML/ml_statistics.ML";
wenzelm@50255
   175
wenzelm@61556
   176
use "Concurrent/standard_thread.ML";
wenzelm@62359
   177
use "Concurrent/single_assignment.ML";
wenzelm@59054
   178
wenzelm@44247
   179
use "Concurrent/par_exn.ML";
wenzelm@31432
   180
use "Concurrent/task_queue.ML";
wenzelm@31432
   181
use "Concurrent/future.ML";
wenzelm@52798
   182
use "Concurrent/event_timer.ML";
wenzelm@62519
   183
use "Concurrent/timeout.ML";
wenzelm@32815
   184
use "Concurrent/lazy.ML";
wenzelm@31432
   185
use "Concurrent/par_list.ML";
wenzelm@31432
   186
wenzelm@44247
   187
use "Concurrent/mailbox.ML";
wenzelm@32840
   188
use "Concurrent/cache.ML";
wenzelm@32840
   189
wenzelm@50500
   190
use "PIDE/active.ML";
wenzelm@50500
   191
wenzelm@31432
   192
wenzelm@31432
   193
(* inner syntax *)
wenzelm@31432
   194
wenzelm@52211
   195
use "Syntax/type_annotation.ML";
wenzelm@42264
   196
use "Syntax/term_position.ML";
wenzelm@42264
   197
use "Syntax/lexicon.ML";
wenzelm@22679
   198
use "Syntax/ast.ML";
wenzelm@42288
   199
use "Syntax/syntax_ext.ML";
wenzelm@22679
   200
use "Syntax/parser.ML";
wenzelm@42284
   201
use "Syntax/syntax_trans.ML";
wenzelm@22679
   202
use "Syntax/mixfix.ML";
wenzelm@22679
   203
use "Syntax/printer.ML";
wenzelm@22679
   204
use "Syntax/syntax.ML";
wenzelm@22679
   205
wenzelm@31432
   206
wenzelm@31432
   207
(* core of tactical proof system *)
wenzelm@31432
   208
wenzelm@42382
   209
use "term_ord.ML";
wenzelm@42382
   210
use "term_subst.ML";
wenzelm@43729
   211
use "term_xml.ML";
wenzelm@55672
   212
use "General/completion.ML";
wenzelm@42382
   213
use "General/name_space.ML";
wenzelm@42382
   214
use "sorts.ML";
wenzelm@42382
   215
use "type.ML";
wenzelm@42382
   216
use "logic.ML";
wenzelm@42382
   217
use "Syntax/simple_syntax.ML";
wenzelm@30559
   218
use "net.ML";
wenzelm@30559
   219
use "item_net.ML";
wenzelm@18934
   220
use "envir.ML";
wenzelm@18059
   221
use "consts.ML";
wenzelm@24257
   222
use "primitive_defs.ML";
wenzelm@61261
   223
use "sign.ML";
haftmann@27546
   224
use "defs.ML";
wenzelm@43795
   225
use "term_sharing.ML";
clasohm@0
   226
use "pattern.ML";
clasohm@0
   227
use "unify.ML";
paulson@1528
   228
use "theory.ML";
berghofe@11511
   229
use "proofterm.ML";
clasohm@0
   230
use "thm.ML";
wenzelm@59026
   231
use "more_pattern.ML";
wenzelm@59026
   232
use "more_unify.ML";
wenzelm@22361
   233
use "more_thm.ML";
wenzelm@26279
   234
use "facts.ML";
wenzelm@39557
   235
use "global_theory.ML";
wenzelm@3986
   236
use "pure_thy.ML";
clasohm@0
   237
use "drule.ML";
wenzelm@22233
   238
use "morphism.ML";
wenzelm@19898
   239
use "variable.ML";
wenzelm@24833
   240
use "conv.ML";
wenzelm@32187
   241
use "goal_display.ML";
wenzelm@32169
   242
use "tactical.ML";
paulson@1582
   243
use "search.ML";
wenzelm@21708
   244
use "tactic.ML";
wenzelm@41228
   245
use "raw_simplifier.ML";
wenzelm@19417
   246
use "conjunction.ML";
wenzelm@20225
   247
use "assumption.ML";
clasohm@0
   248
wenzelm@31432
   249
wenzelm@31432
   250
(* Isar -- Intelligible Semi-Automated Reasoning *)
wenzelm@31432
   251
wenzelm@56303
   252
(*ML support and global execution*)
wenzelm@49041
   253
use "ML/ml_syntax.ML";
wenzelm@49041
   254
use "ML/ml_env.ML";
wenzelm@56303
   255
use "ML/ml_options.ML";
wenzelm@62498
   256
use_no_debug "ML/exn_debugger.ML";
wenzelm@56303
   257
use "ML/ml_options.ML";
wenzelm@62498
   258
use_no_debug "Isar/runtime.ML";
wenzelm@56303
   259
use "PIDE/execution.ML";
wenzelm@62355
   260
use "ML/ml_compiler.ML";
wenzelm@49041
   261
wenzelm@51551
   262
use "skip_proof.ML";
wenzelm@49041
   263
use "goal.ML";
wenzelm@49041
   264
wenzelm@31432
   265
(*proof context*)
wenzelm@31432
   266
use "Isar/object_logic.ML";
wenzelm@31432
   267
use "Isar/rule_cases.ML";
wenzelm@31432
   268
use "Isar/auto_bind.ML";
wenzelm@42241
   269
use "type_infer.ML";
wenzelm@42240
   270
use "Syntax/local_syntax.ML";
wenzelm@31432
   271
use "Isar/proof_context.ML";
wenzelm@42405
   272
use "type_infer_context.ML";
wenzelm@42243
   273
use "Syntax/syntax_phases.ML";
wenzelm@31432
   274
use "Isar/local_defs.ML";
wenzelm@31432
   275
wenzelm@31432
   276
(*outer syntax*)
wenzelm@58903
   277
use "Isar/keyword.ML";
wenzelm@36959
   278
use "Isar/token.ML";
wenzelm@36949
   279
use "Isar/parse.ML";
wenzelm@31432
   280
use "Isar/args.ML";
wenzelm@31432
   281
wenzelm@57926
   282
(*theory specifications*)
wenzelm@57926
   283
use "Isar/local_theory.ML";
wenzelm@31432
   284
use "Thy/thy_header.ML";
wenzelm@57905
   285
use "PIDE/command_span.ML";
wenzelm@51265
   286
use "Thy/thy_syntax.ML";
wenzelm@61454
   287
use "Thy/markdown.ML";
wenzelm@31432
   288
use "Thy/html.ML";
wenzelm@31432
   289
use "Thy/latex.ML";
wenzelm@31432
   290
wenzelm@56203
   291
(*ML with context and antiquotations*)
wenzelm@56203
   292
use "ML/ml_context.ML";
wenzelm@56205
   293
use "ML/ml_antiquotation.ML";
wenzelm@56288
   294
wenzelm@62493
   295
val {use, use_debug, use_no_debug} =
wenzelm@62494
   296
  ML_Compiler0.use_operations (fn opt_debug => fn file =>
wenzelm@62493
   297
    let val flags = ML_Compiler.verbose true (ML_Compiler.debug_flags opt_debug) in
wenzelm@62490
   298
      ML_Context.eval_file flags (Path.explode file)
wenzelm@62490
   299
        handle ERROR msg => (writeln msg; error "ML error")
wenzelm@62493
   300
    end);
wenzelm@56434
   301
wenzelm@56288
   302
wenzelm@56288
   303
wenzelm@62508
   304
(** bootstrap phase 3: towards Pure.thy and final ML toplevel setup *)
wenzelm@56203
   305
wenzelm@31432
   306
(*basic proof engine*)
wenzelm@58009
   307
use "par_tactical.ML";
wenzelm@31432
   308
use "Isar/proof_display.ML";
wenzelm@31432
   309
use "Isar/attrib.ML";
wenzelm@31432
   310
use "Isar/context_rules.ML";
wenzelm@31432
   311
use "Isar/method.ML";
wenzelm@31432
   312
use "Isar/proof.ML";
wenzelm@31432
   313
use "Isar/element.ML";
wenzelm@31432
   314
use "Isar/obtain.ML";
wenzelm@60630
   315
use "Isar/subgoal.ML";
wenzelm@31432
   316
wenzelm@31432
   317
(*local theories and targets*)
haftmann@52140
   318
use "Isar/locale.ML";
haftmann@38307
   319
use "Isar/generic_target.ML";
wenzelm@31432
   320
use "Isar/overloading.ML";
wenzelm@35669
   321
use "axclass.ML";
haftmann@38379
   322
use "Isar/class.ML";
haftmann@38350
   323
use "Isar/named_target.ML";
wenzelm@31432
   324
use "Isar/expression.ML";
haftmann@61669
   325
use "Isar/interpretation.ML";
haftmann@38379
   326
use "Isar/class_declaration.ML";
wenzelm@47057
   327
use "Isar/bundle.ML";
wenzelm@59901
   328
use "Isar/experiment.ML";
wenzelm@31432
   329
wenzelm@31432
   330
use "simplifier.ML";
wenzelm@58660
   331
use "Tools/plugin.ML";
wenzelm@31432
   332
wenzelm@31432
   333
(*executable theory content*)
wenzelm@31432
   334
use "Isar/code.ML";
wenzelm@31432
   335
wenzelm@31432
   336
(*specifications*)
wenzelm@36952
   337
use "Isar/parse_spec.ML";
wenzelm@33374
   338
use "Isar/spec_rules.ML";
wenzelm@31432
   339
use "Isar/specification.ML";
wenzelm@35626
   340
use "Isar/typedecl.ML";
wenzelm@31432
   341
wenzelm@31432
   342
(*toplevel transactions*)
wenzelm@31432
   343
use "Isar/proof_node.ML";
wenzelm@31432
   344
use "Isar/toplevel.ML";
wenzelm@31432
   345
wenzelm@56206
   346
(*proof term operations*)
wenzelm@56206
   347
use "Proof/reconstruct.ML";
wenzelm@56206
   348
use "Proof/proof_syntax.ML";
wenzelm@56206
   349
use "Proof/proof_rewrite_rules.ML";
wenzelm@56206
   350
use "Proof/proof_checker.ML";
wenzelm@56206
   351
use "Proof/extraction.ML";
wenzelm@56206
   352
wenzelm@62584
   353
(*Isabelle system*)
wenzelm@62584
   354
if ML_System.platform_is_windows
wenzelm@62584
   355
then use "System/bash_windows.ML"
wenzelm@62584
   356
else use "System/bash.ML";
wenzelm@62584
   357
use "System/isabelle_system.ML";
wenzelm@62584
   358
wenzelm@38271
   359
(*theory documents*)
wenzelm@31432
   360
use "Thy/term_style.ML";
wenzelm@58928
   361
use "Isar/outer_syntax.ML";
wenzelm@31432
   362
use "Thy/thy_output.ML";
wenzelm@61619
   363
use "Thy/document_antiquotations.ML";
wenzelm@49561
   364
use "General/graph_display.ML";
wenzelm@43712
   365
use "Thy/present.ML";
wenzelm@58928
   366
use "pure_syn.ML";
wenzelm@52510
   367
use "PIDE/command.ML";
wenzelm@52865
   368
use "PIDE/query_operation.ML";
wenzelm@56208
   369
use "PIDE/resources.ML";
wenzelm@31432
   370
use "Thy/thy_info.ML";
wenzelm@59086
   371
use "PIDE/session.ML";
wenzelm@59714
   372
use "PIDE/protocol_message.ML";
wenzelm@44185
   373
use "PIDE/document.ML";
wenzelm@31432
   374
wenzelm@31432
   375
(*theory and proof operations*)
wenzelm@31432
   376
use "Isar/isar_cmd.ML";
wenzelm@31432
   377
wenzelm@31432
   378
wenzelm@31432
   379
(* Isabelle/Isar system *)
wenzelm@31432
   380
wenzelm@48681
   381
use "System/command_line.ML";
wenzelm@45029
   382
use "System/system_channel.ML";
wenzelm@52584
   383
use "System/message_channel.ML";
wenzelm@38412
   384
use "System/isabelle_process.ML";
wenzelm@43748
   385
use "System/invoke_scala.ML";
wenzelm@45709
   386
use "PIDE/protocol.ML";
wenzelm@30173
   387
wenzelm@31432
   388
wenzelm@31432
   389
(* miscellaneous tools and packages for Pure Isabelle *)
wenzelm@31432
   390
wenzelm@50686
   391
use "Tools/build.ML";
wenzelm@31432
   392
use "Tools/named_thms.ML";
wenzelm@31432
   393
wenzelm@55387
   394
structure Output: OUTPUT = Output;  (*seal system channels!*)
wenzelm@55387
   395
wenzelm@62665
   396
use "ML/ml_pp.ML";
wenzelm@48732
   397
wenzelm@48732
   398
wenzelm@49862
   399
(* the Pure theory *)
wenzelm@49862
   400
wenzelm@58928
   401
use "ML/ml_file.ML";
wenzelm@56303
   402
Runtime.toplevel_program (fn () => Thy_Info.use_thy ("Pure", Position.none));
wenzelm@49862
   403
Context.set_thread_data NONE;
wenzelm@60937
   404
structure Pure = struct val thy = Thy_Info.pure_theory () end;
wenzelm@49862
   405
wenzelm@49862
   406
wenzelm@48879
   407
(* ML toplevel commands *)
wenzelm@48879
   408
wenzelm@56303
   409
fun use_thys args =
wenzelm@56303
   410
  Runtime.toplevel_program (fn () => Thy_Info.use_thys (map (rpair Position.none) args));
wenzelm@48927
   411
val use_thy = use_thys o single;
wenzelm@48732
   412
wenzelm@52487
   413
Proofterm.proofs := 0;