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;
     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 
   147 use "General/sha1.ML";
   148 use "General/sha1_polyml.ML";
   149 use "General/sha1_samples.ML";
   150 
   151 val _ = List.app ML_Name_Space.forget_structure ML_Name_Space.critical_structures;
   152 
   153 use "PIDE/yxml.ML";
   154 use "PIDE/document_id.ML";
   155 
   156 use "General/change_table.ML";
   157 use "General/graph.ML";
   158 
   159 
   160 (* fundamental structures *)
   161 
   162 use "name.ML";
   163 use "term.ML";
   164 use "context.ML";
   165 use "context_position.ML";
   166 use "System/options.ML";
   167 use "config.ML";
   168 
   169 
   170 (* concurrency within the ML runtime *)
   171 
   172 use "ML/exn_properties.ML";
   173 
   174 use "ML/ml_statistics.ML";
   175 
   176 use "Concurrent/standard_thread.ML";
   177 use "Concurrent/single_assignment.ML";
   178 
   179 use "Concurrent/par_exn.ML";
   180 use "Concurrent/task_queue.ML";
   181 use "Concurrent/future.ML";
   182 use "Concurrent/event_timer.ML";
   183 use "Concurrent/timeout.ML";
   184 use "Concurrent/lazy.ML";
   185 use "Concurrent/par_list.ML";
   186 
   187 use "Concurrent/mailbox.ML";
   188 use "Concurrent/cache.ML";
   189 
   190 use "PIDE/active.ML";
   191 
   192 
   193 (* inner syntax *)
   194 
   195 use "Syntax/type_annotation.ML";
   196 use "Syntax/term_position.ML";
   197 use "Syntax/lexicon.ML";
   198 use "Syntax/ast.ML";
   199 use "Syntax/syntax_ext.ML";
   200 use "Syntax/parser.ML";
   201 use "Syntax/syntax_trans.ML";
   202 use "Syntax/mixfix.ML";
   203 use "Syntax/printer.ML";
   204 use "Syntax/syntax.ML";
   205 
   206 
   207 (* core of tactical proof system *)
   208 
   209 use "term_ord.ML";
   210 use "term_subst.ML";
   211 use "term_xml.ML";
   212 use "General/completion.ML";
   213 use "General/name_space.ML";
   214 use "sorts.ML";
   215 use "type.ML";
   216 use "logic.ML";
   217 use "Syntax/simple_syntax.ML";
   218 use "net.ML";
   219 use "item_net.ML";
   220 use "envir.ML";
   221 use "consts.ML";
   222 use "primitive_defs.ML";
   223 use "sign.ML";
   224 use "defs.ML";
   225 use "term_sharing.ML";
   226 use "pattern.ML";
   227 use "unify.ML";
   228 use "theory.ML";
   229 use "proofterm.ML";
   230 use "thm.ML";
   231 use "more_pattern.ML";
   232 use "more_unify.ML";
   233 use "more_thm.ML";
   234 use "facts.ML";
   235 use "global_theory.ML";
   236 use "pure_thy.ML";
   237 use "drule.ML";
   238 use "morphism.ML";
   239 use "variable.ML";
   240 use "conv.ML";
   241 use "goal_display.ML";
   242 use "tactical.ML";
   243 use "search.ML";
   244 use "tactic.ML";
   245 use "raw_simplifier.ML";
   246 use "conjunction.ML";
   247 use "assumption.ML";
   248 
   249 
   250 (* Isar -- Intelligible Semi-Automated Reasoning *)
   251 
   252 (*ML support and global execution*)
   253 use "ML/ml_syntax.ML";
   254 use "ML/ml_env.ML";
   255 use "ML/ml_options.ML";
   256 use_no_debug "ML/exn_debugger.ML";
   257 use "ML/ml_options.ML";
   258 use_no_debug "Isar/runtime.ML";
   259 use "PIDE/execution.ML";
   260 use "ML/ml_compiler.ML";
   261 
   262 use "skip_proof.ML";
   263 use "goal.ML";
   264 
   265 (*proof context*)
   266 use "Isar/object_logic.ML";
   267 use "Isar/rule_cases.ML";
   268 use "Isar/auto_bind.ML";
   269 use "type_infer.ML";
   270 use "Syntax/local_syntax.ML";
   271 use "Isar/proof_context.ML";
   272 use "type_infer_context.ML";
   273 use "Syntax/syntax_phases.ML";
   274 use "Isar/local_defs.ML";
   275 
   276 (*outer syntax*)
   277 use "Isar/keyword.ML";
   278 use "Isar/token.ML";
   279 use "Isar/parse.ML";
   280 use "Isar/args.ML";
   281 
   282 (*theory specifications*)
   283 use "Isar/local_theory.ML";
   284 use "Thy/thy_header.ML";
   285 use "PIDE/command_span.ML";
   286 use "Thy/thy_syntax.ML";
   287 use "Thy/markdown.ML";
   288 use "Thy/html.ML";
   289 use "Thy/latex.ML";
   290 
   291 (*ML with context and antiquotations*)
   292 use "ML/ml_context.ML";
   293 use "ML/ml_antiquotation.ML";
   294 
   295 val {use, use_debug, use_no_debug} =
   296   ML_Compiler0.use_operations (fn opt_debug => fn file =>
   297     let val flags = ML_Compiler.verbose true (ML_Compiler.debug_flags opt_debug) in
   298       ML_Context.eval_file flags (Path.explode file)
   299         handle ERROR msg => (writeln msg; error "ML error")
   300     end);
   301 
   302 
   303 
   304 (** bootstrap phase 3: towards Pure.thy and final ML toplevel setup *)
   305 
   306 (*basic proof engine*)
   307 use "par_tactical.ML";
   308 use "Isar/proof_display.ML";
   309 use "Isar/attrib.ML";
   310 use "Isar/context_rules.ML";
   311 use "Isar/method.ML";
   312 use "Isar/proof.ML";
   313 use "Isar/element.ML";
   314 use "Isar/obtain.ML";
   315 use "Isar/subgoal.ML";
   316 
   317 (*local theories and targets*)
   318 use "Isar/locale.ML";
   319 use "Isar/generic_target.ML";
   320 use "Isar/overloading.ML";
   321 use "axclass.ML";
   322 use "Isar/class.ML";
   323 use "Isar/named_target.ML";
   324 use "Isar/expression.ML";
   325 use "Isar/interpretation.ML";
   326 use "Isar/class_declaration.ML";
   327 use "Isar/bundle.ML";
   328 use "Isar/experiment.ML";
   329 
   330 use "simplifier.ML";
   331 use "Tools/plugin.ML";
   332 
   333 (*executable theory content*)
   334 use "Isar/code.ML";
   335 
   336 (*specifications*)
   337 use "Isar/parse_spec.ML";
   338 use "Isar/spec_rules.ML";
   339 use "Isar/specification.ML";
   340 use "Isar/typedecl.ML";
   341 
   342 (*toplevel transactions*)
   343 use "Isar/proof_node.ML";
   344 use "Isar/toplevel.ML";
   345 
   346 (*proof term operations*)
   347 use "Proof/reconstruct.ML";
   348 use "Proof/proof_syntax.ML";
   349 use "Proof/proof_rewrite_rules.ML";
   350 use "Proof/proof_checker.ML";
   351 use "Proof/extraction.ML";
   352 
   353 (*Isabelle system*)
   354 if ML_System.platform_is_windows
   355 then use "System/bash_windows.ML"
   356 else use "System/bash.ML";
   357 use "System/isabelle_system.ML";
   358 
   359 (*theory documents*)
   360 use "Thy/term_style.ML";
   361 use "Isar/outer_syntax.ML";
   362 use "Thy/thy_output.ML";
   363 use "Thy/document_antiquotations.ML";
   364 use "General/graph_display.ML";
   365 use "Thy/present.ML";
   366 use "pure_syn.ML";
   367 use "PIDE/command.ML";
   368 use "PIDE/query_operation.ML";
   369 use "PIDE/resources.ML";
   370 use "Thy/thy_info.ML";
   371 use "PIDE/session.ML";
   372 use "PIDE/protocol_message.ML";
   373 use "PIDE/document.ML";
   374 
   375 (*theory and proof operations*)
   376 use "Isar/isar_cmd.ML";
   377 
   378 
   379 (* Isabelle/Isar system *)
   380 
   381 use "System/command_line.ML";
   382 use "System/system_channel.ML";
   383 use "System/message_channel.ML";
   384 use "System/isabelle_process.ML";
   385 use "System/invoke_scala.ML";
   386 use "PIDE/protocol.ML";
   387 
   388 
   389 (* miscellaneous tools and packages for Pure Isabelle *)
   390 
   391 use "Tools/build.ML";
   392 use "Tools/named_thms.ML";
   393 
   394 structure Output: OUTPUT = Output;  (*seal system channels!*)
   395 
   396 use "ML/ml_pp.ML";
   397 
   398 
   399 (* the Pure theory *)
   400 
   401 use "ML/ml_file.ML";
   402 Runtime.toplevel_program (fn () => Thy_Info.use_thy ("Pure", Position.none));
   403 Context.set_thread_data NONE;
   404 structure Pure = struct val thy = Thy_Info.pure_theory () end;
   405 
   406 
   407 (* ML toplevel commands *)
   408 
   409 fun use_thys args =
   410   Runtime.toplevel_program (fn () => Thy_Info.use_thys (map (rpair Position.none) args));
   411 val use_thy = use_thys o single;
   412 
   413 Proofterm.proofs := 0;