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