src/Pure/ROOT.ML
author wenzelm
Tue Mar 01 19:42:59 2016 +0100 (2016-03-01)
changeset 62490 39d01eaf5292
parent 62459 7a5d88dd8cc9
child 62493 dd154240a53c
permissions -rw-r--r--
ML debugger support in Pure (again, see 3565c9f407ec);
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@57649
     8
  val is_identified = false;
wenzelm@27642
     9
  val is_official = false;
wenzelm@26109
    10
end;
wenzelm@11835
    11
wenzelm@31432
    12
wenzelm@31432
    13
(* library of general tools *)
wenzelm@31432
    14
wenzelm@21396
    15
use "General/basics.ML";
clasohm@0
    16
use "library.ML";
wenzelm@31432
    17
use "General/print_mode.ML";
wenzelm@31432
    18
use "General/alist.ML";
wenzelm@31432
    19
use "General/table.ML";
wenzelm@43684
    20
wenzelm@43684
    21
use "Concurrent/synchronized.ML";
wenzelm@52537
    22
use "Concurrent/counter.ML";
wenzelm@59172
    23
use "Concurrent/random.ML";
wenzelm@43684
    24
wenzelm@43746
    25
use "General/properties.ML";
wenzelm@31432
    26
use "General/output.ML";
wenzelm@45670
    27
use "PIDE/markup.ML";
wenzelm@31432
    28
use "General/scan.ML";
wenzelm@31432
    29
use "General/source.ML";
wenzelm@31432
    30
use "General/symbol.ML";
wenzelm@31432
    31
use "General/position.ML";
wenzelm@31432
    32
use "General/symbol_pos.ML";
wenzelm@59064
    33
use "General/input.ML";
wenzelm@31432
    34
use "General/antiquote.ML";
wenzelm@31432
    35
use "ML/ml_lex.ML";
wenzelm@31432
    36
use "ML/ml_parse.ML";
wenzelm@31432
    37
use "General/secure.ML";
wenzelm@56288
    38
wenzelm@56434
    39
val use_text = Secure.use_text;
wenzelm@56434
    40
val use_file = Secure.use_file;
wenzelm@56434
    41
wenzelm@62490
    42
local
wenzelm@62490
    43
  fun use_ opt_debug file =
wenzelm@62490
    44
    Position.setmp_thread_data (Position.file_only file)
wenzelm@62490
    45
      (fn () =>
wenzelm@62490
    46
        Secure.use_file ML_Parse.global_context
wenzelm@62490
    47
          {verbose = true, debug = use_debug_option opt_debug} file
wenzelm@60959
    48
        handle ERROR msg => (writeln msg; error "ML error")) ();
wenzelm@62490
    49
in
wenzelm@62490
    50
  val use = use_ NONE;
wenzelm@62490
    51
  val use_debug = use_ (SOME true);
wenzelm@62490
    52
  val use_no_debug = use_ (SOME false);
wenzelm@62490
    53
end;
wenzelm@56434
    54
wenzelm@56288
    55
wenzelm@59054
    56
wenzelm@56288
    57
(** bootstrap phase 1: towards ML within Isar context *)
wenzelm@56288
    58
wenzelm@56288
    59
(* library of general tools *)
wenzelm@56288
    60
wenzelm@31432
    61
use "General/integer.ML";
wenzelm@31432
    62
use "General/stack.ML";
wenzelm@31432
    63
use "General/queue.ML";
wenzelm@31432
    64
use "General/heap.ML";
wenzelm@32015
    65
use "General/same.ML";
wenzelm@31432
    66
use "General/ord_list.ML";
wenzelm@31432
    67
use "General/balanced_tree.ML";
wenzelm@38448
    68
use "General/linear_set.ML";
wenzelm@43593
    69
use "General/buffer.ML";
wenzelm@43791
    70
use "General/pretty.ML";
wenzelm@59363
    71
use "PIDE/xml.ML";
wenzelm@31432
    72
use "General/path.ML";
wenzelm@31432
    73
use "General/url.ML";
wenzelm@31432
    74
use "General/file.ML";
wenzelm@43547
    75
use "General/long_name.ML";
wenzelm@43547
    76
use "General/binding.ML";
wenzelm@50800
    77
use "General/socket_io.ML";
wenzelm@56287
    78
use "General/seq.ML";
wenzelm@56287
    79
use "General/timing.ML";
wenzelm@22592
    80
wenzelm@35628
    81
use "General/sha1.ML";
wenzelm@62354
    82
use "General/sha1_polyml.ML";
wenzelm@53212
    83
use "General/sha1_samples.ML";
wenzelm@35628
    84
wenzelm@44698
    85
use "PIDE/yxml.ML";
wenzelm@56303
    86
use "PIDE/document_id.ML";
wenzelm@44698
    87
wenzelm@56053
    88
use "General/change_table.ML";
wenzelm@49560
    89
use "General/graph.ML";
wenzelm@49560
    90
wenzelm@60911
    91
wenzelm@60911
    92
(* fundamental structures *)
wenzelm@60911
    93
wenzelm@60911
    94
use "name.ML";
wenzelm@60911
    95
use "term.ML";
wenzelm@60911
    96
use "context.ML";
wenzelm@60911
    97
use "context_position.ML";
wenzelm@51947
    98
use "System/options.ML";
wenzelm@60911
    99
use "config.ML";
wenzelm@51947
   100
wenzelm@31432
   101
wenzelm@31432
   102
(* concurrency within the ML runtime *)
wenzelm@28120
   103
wenzelm@62355
   104
use "ML/exn_properties.ML";
wenzelm@50911
   105
wenzelm@62459
   106
if ML_System.name = "polyml-5.6"
wenzelm@62459
   107
then use "ML/ml_statistics.ML"
wenzelm@50255
   108
else use "ML/ml_statistics_dummy.ML";
wenzelm@50255
   109
wenzelm@61556
   110
use "Concurrent/standard_thread.ML";
wenzelm@62359
   111
use "Concurrent/single_assignment.ML";
wenzelm@59054
   112
wenzelm@62359
   113
if ML_System.platform_is_windows
wenzelm@62359
   114
then use "Concurrent/bash_windows.ML"
wenzelm@60962
   115
else use "Concurrent/bash.ML";
wenzelm@40748
   116
wenzelm@44247
   117
use "Concurrent/par_exn.ML";
wenzelm@31432
   118
use "Concurrent/task_queue.ML";
wenzelm@31432
   119
use "Concurrent/future.ML";
wenzelm@52798
   120
use "Concurrent/event_timer.ML";
wenzelm@62354
   121
use "Concurrent/time_limit.ML";
wenzelm@32815
   122
use "Concurrent/lazy.ML";
wenzelm@31432
   123
use "Concurrent/par_list.ML";
wenzelm@31432
   124
wenzelm@44247
   125
use "Concurrent/mailbox.ML";
wenzelm@32840
   126
use "Concurrent/cache.ML";
wenzelm@32840
   127
wenzelm@50500
   128
use "PIDE/active.ML";
wenzelm@50500
   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";
wenzelm@61261
   161
use "sign.ML";
haftmann@27546
   162
use "defs.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";
berghofe@11511
   167
use "proofterm.ML";
clasohm@0
   168
use "thm.ML";
wenzelm@59026
   169
use "more_pattern.ML";
wenzelm@59026
   170
use "more_unify.ML";
wenzelm@22361
   171
use "more_thm.ML";
wenzelm@26279
   172
use "facts.ML";
wenzelm@39557
   173
use "global_theory.ML";
wenzelm@3986
   174
use "pure_thy.ML";
clasohm@0
   175
use "drule.ML";
wenzelm@22233
   176
use "morphism.ML";
wenzelm@19898
   177
use "variable.ML";
wenzelm@24833
   178
use "conv.ML";
wenzelm@32187
   179
use "goal_display.ML";
wenzelm@32169
   180
use "tactical.ML";
paulson@1582
   181
use "search.ML";
wenzelm@21708
   182
use "tactic.ML";
wenzelm@41228
   183
use "raw_simplifier.ML";
wenzelm@19417
   184
use "conjunction.ML";
wenzelm@20225
   185
use "assumption.ML";
clasohm@0
   186
wenzelm@31432
   187
wenzelm@31432
   188
(* Isar -- Intelligible Semi-Automated Reasoning *)
wenzelm@31432
   189
wenzelm@56303
   190
(*ML support and global execution*)
wenzelm@49041
   191
use "ML/ml_syntax.ML";
wenzelm@49041
   192
use "ML/ml_env.ML";
wenzelm@56303
   193
use "ML/ml_options.ML";
wenzelm@62355
   194
use "ML/exn_output.ML";
wenzelm@56303
   195
use "ML/ml_options.ML";
wenzelm@49041
   196
use "Isar/runtime.ML";
wenzelm@56303
   197
use "PIDE/execution.ML";
wenzelm@62355
   198
use "ML/ml_compiler.ML";
wenzelm@49041
   199
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@58903
   215
use "Isar/keyword.ML";
wenzelm@36959
   216
use "Isar/token.ML";
wenzelm@36949
   217
use "Isar/parse.ML";
wenzelm@31432
   218
use "Isar/args.ML";
wenzelm@31432
   219
wenzelm@57926
   220
(*theory specifications*)
wenzelm@57926
   221
use "Isar/local_theory.ML";
wenzelm@31432
   222
use "Thy/thy_header.ML";
wenzelm@57905
   223
use "PIDE/command_span.ML";
wenzelm@51265
   224
use "Thy/thy_syntax.ML";
wenzelm@61454
   225
use "Thy/markdown.ML";
wenzelm@31432
   226
use "Thy/html.ML";
wenzelm@31432
   227
use "Thy/latex.ML";
wenzelm@31432
   228
wenzelm@56203
   229
(*ML with context and antiquotations*)
wenzelm@56203
   230
use "ML/ml_context.ML";
wenzelm@56205
   231
use "ML/ml_antiquotation.ML";
wenzelm@56288
   232
wenzelm@62490
   233
local
wenzelm@62490
   234
  fun use_ opt_debug file =
wenzelm@62490
   235
    let val flags = ML_Compiler.debug_flags opt_debug |> ML_Compiler.verbose true in
wenzelm@62490
   236
      ML_Context.eval_file flags (Path.explode file)
wenzelm@62490
   237
        handle ERROR msg => (writeln msg; error "ML error")
wenzelm@62490
   238
    end;
wenzelm@62490
   239
in
wenzelm@62490
   240
wenzelm@62490
   241
val use = use_ NONE;
wenzelm@62490
   242
val use_debug = use_ (SOME true);
wenzelm@62490
   243
val use_no_debug = use_ (SOME false);
wenzelm@62490
   244
wenzelm@62490
   245
end;
wenzelm@56434
   246
wenzelm@56288
   247
wenzelm@56288
   248
wenzelm@56288
   249
(** bootstrap phase 2: towards Pure.thy and final ML toplevel setup *)
wenzelm@56203
   250
wenzelm@31432
   251
(*basic proof engine*)
wenzelm@58009
   252
use "par_tactical.ML";
wenzelm@31432
   253
use "Isar/proof_display.ML";
wenzelm@31432
   254
use "Isar/attrib.ML";
wenzelm@31432
   255
use "Isar/context_rules.ML";
wenzelm@31432
   256
use "Isar/method.ML";
wenzelm@31432
   257
use "Isar/proof.ML";
wenzelm@31432
   258
use "Isar/element.ML";
wenzelm@31432
   259
use "Isar/obtain.ML";
wenzelm@60630
   260
use "Isar/subgoal.ML";
wenzelm@31432
   261
wenzelm@31432
   262
(*local theories and targets*)
haftmann@52140
   263
use "Isar/locale.ML";
haftmann@38307
   264
use "Isar/generic_target.ML";
wenzelm@31432
   265
use "Isar/overloading.ML";
wenzelm@35669
   266
use "axclass.ML";
haftmann@38379
   267
use "Isar/class.ML";
haftmann@38350
   268
use "Isar/named_target.ML";
wenzelm@31432
   269
use "Isar/expression.ML";
haftmann@61669
   270
use "Isar/interpretation.ML";
haftmann@38379
   271
use "Isar/class_declaration.ML";
wenzelm@47057
   272
use "Isar/bundle.ML";
wenzelm@59901
   273
use "Isar/experiment.ML";
wenzelm@31432
   274
wenzelm@31432
   275
use "simplifier.ML";
wenzelm@58660
   276
use "Tools/plugin.ML";
wenzelm@31432
   277
wenzelm@31432
   278
(*executable theory content*)
wenzelm@31432
   279
use "Isar/code.ML";
wenzelm@31432
   280
wenzelm@31432
   281
(*specifications*)
wenzelm@36952
   282
use "Isar/parse_spec.ML";
wenzelm@33374
   283
use "Isar/spec_rules.ML";
wenzelm@31432
   284
use "Isar/specification.ML";
wenzelm@35626
   285
use "Isar/typedecl.ML";
wenzelm@31432
   286
wenzelm@31432
   287
(*toplevel transactions*)
wenzelm@31432
   288
use "Isar/proof_node.ML";
wenzelm@31432
   289
use "Isar/toplevel.ML";
wenzelm@31432
   290
wenzelm@56206
   291
(*proof term operations*)
wenzelm@56206
   292
use "Proof/reconstruct.ML";
wenzelm@56206
   293
use "Proof/proof_syntax.ML";
wenzelm@56206
   294
use "Proof/proof_rewrite_rules.ML";
wenzelm@56206
   295
use "Proof/proof_checker.ML";
wenzelm@56206
   296
use "Proof/extraction.ML";
wenzelm@56206
   297
wenzelm@38271
   298
(*theory documents*)
wenzelm@40743
   299
use "System/isabelle_system.ML";
wenzelm@31432
   300
use "Thy/term_style.ML";
wenzelm@58928
   301
use "Isar/outer_syntax.ML";
wenzelm@31432
   302
use "Thy/thy_output.ML";
wenzelm@61619
   303
use "Thy/document_antiquotations.ML";
wenzelm@49561
   304
use "General/graph_display.ML";
wenzelm@43712
   305
use "Thy/present.ML";
wenzelm@58928
   306
use "pure_syn.ML";
wenzelm@52510
   307
use "PIDE/command.ML";
wenzelm@52865
   308
use "PIDE/query_operation.ML";
wenzelm@56208
   309
use "PIDE/resources.ML";
wenzelm@31432
   310
use "Thy/thy_info.ML";
wenzelm@59086
   311
use "PIDE/session.ML";
wenzelm@59714
   312
use "PIDE/protocol_message.ML";
wenzelm@44185
   313
use "PIDE/document.ML";
wenzelm@31432
   314
wenzelm@31432
   315
(*theory and proof operations*)
wenzelm@31432
   316
use "Isar/isar_cmd.ML";
wenzelm@31432
   317
wenzelm@31432
   318
wenzelm@31432
   319
(* Isabelle/Isar system *)
wenzelm@31432
   320
wenzelm@48681
   321
use "System/command_line.ML";
wenzelm@45029
   322
use "System/system_channel.ML";
wenzelm@52584
   323
use "System/message_channel.ML";
wenzelm@38412
   324
use "System/isabelle_process.ML";
wenzelm@43748
   325
use "System/invoke_scala.ML";
wenzelm@45709
   326
use "PIDE/protocol.ML";
wenzelm@30173
   327
wenzelm@31432
   328
wenzelm@31432
   329
(* miscellaneous tools and packages for Pure Isabelle *)
wenzelm@31432
   330
wenzelm@50686
   331
use "Tools/build.ML";
wenzelm@31432
   332
use "Tools/named_thms.ML";
wenzelm@31432
   333
wenzelm@55387
   334
structure Output: OUTPUT = Output;  (*seal system channels!*)
wenzelm@55387
   335
wenzelm@31432
   336
wenzelm@62354
   337
use "ML/install_pp_polyml.ML";
wenzelm@48732
   338
wenzelm@48732
   339
wenzelm@49862
   340
(* the Pure theory *)
wenzelm@49862
   341
wenzelm@58928
   342
use "ML/ml_file.ML";
wenzelm@56303
   343
Runtime.toplevel_program (fn () => Thy_Info.use_thy ("Pure", Position.none));
wenzelm@49862
   344
Context.set_thread_data NONE;
wenzelm@60937
   345
structure Pure = struct val thy = Thy_Info.pure_theory () end;
wenzelm@49862
   346
wenzelm@49862
   347
wenzelm@48879
   348
(* ML toplevel commands *)
wenzelm@48879
   349
wenzelm@56303
   350
fun use_thys args =
wenzelm@56303
   351
  Runtime.toplevel_program (fn () => Thy_Info.use_thys (map (rpair Position.none) args));
wenzelm@48927
   352
val use_thy = use_thys o single;
wenzelm@48732
   353
wenzelm@48732
   354
val cd = File.cd o Path.explode;
wenzelm@48732
   355
wenzelm@52487
   356
Proofterm.proofs := 0;