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