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