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