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