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