src/Pure/ROOT.ML
author wenzelm
Fri Nov 20 21:52:05 2015 +0100 (2015-11-20)
changeset 61715 5dc95d957569
parent 61669 27ca6147e3b3
child 61794 4c232a2ddeab
permissions -rw-r--r--
speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
     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 if Multithreading.available then ()
    23 else use "Concurrent/synchronized_sequential.ML";
    24 use "Concurrent/counter.ML";
    25 use "Concurrent/random.ML";
    26 
    27 use "General/properties.ML";
    28 use "General/output.ML";
    29 use "PIDE/markup.ML";
    30 use "General/scan.ML";
    31 use "General/source.ML";
    32 use "General/symbol.ML";
    33 use "General/position.ML";
    34 use "General/symbol_pos.ML";
    35 use "General/input.ML";
    36 use "General/antiquote.ML";
    37 use "ML/ml_lex.ML";
    38 use "ML/ml_parse.ML";
    39 use "General/secure.ML";
    40 
    41 val use_text = Secure.use_text;
    42 val use_file = Secure.use_file;
    43 
    44 fun use file =
    45   Position.setmp_thread_data (Position.file_only file)
    46     (fn () =>
    47       Secure.use_file ML_Parse.global_context {verbose = true, debug = false} file
    48         handle ERROR msg => (writeln msg; error "ML error")) ();
    49 
    50 val toplevel_pp = Secure.toplevel_pp;
    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 if ML_System.is_polyml then use "General/sha1_polyml.ML" else ();
    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 if ML_System.is_polyml
   102 then use "ML/exn_properties_polyml.ML"
   103 else use "ML/exn_properties_dummy.ML";
   104 
   105 if ML_System.name = "polyml-5.5.0"
   106   orelse ML_System.name = "polyml-5.5.1"
   107   orelse ML_System.name = "polyml-5.5.2"
   108   orelse ML_System.name = "polyml-5.5.3"
   109   orelse ML_System.name = "polyml-5.6"
   110 then use "ML/ml_statistics_polyml-5.5.0.ML"
   111 else use "ML/ml_statistics_dummy.ML";
   112 
   113 use "Concurrent/standard_thread.ML";
   114 
   115 use "Concurrent/single_assignment.ML";
   116 if Multithreading.available then ()
   117 else use "Concurrent/single_assignment_sequential.ML";
   118 
   119 if not Multithreading.available then use "Concurrent/bash_sequential.ML"
   120 else if ML_System.platform_is_windows then use "Concurrent/bash_windows.ML"
   121 else use "Concurrent/bash.ML";
   122 
   123 use "Concurrent/par_exn.ML";
   124 use "Concurrent/task_queue.ML";
   125 use "Concurrent/future.ML";
   126 use "Concurrent/event_timer.ML";
   127 
   128 if ML_System.is_polyml then use "Concurrent/time_limit.ML" else ();
   129 
   130 use "Concurrent/lazy.ML";
   131 if Multithreading.available then ()
   132 else use "Concurrent/lazy_sequential.ML";
   133 
   134 use "Concurrent/par_list.ML";
   135 if Multithreading.available then ()
   136 else use "Concurrent/par_list_sequential.ML";
   137 
   138 use "Concurrent/mailbox.ML";
   139 use "Concurrent/cache.ML";
   140 
   141 use "PIDE/active.ML";
   142 
   143 
   144 (* inner syntax *)
   145 
   146 use "Syntax/type_annotation.ML";
   147 use "Syntax/term_position.ML";
   148 use "Syntax/lexicon.ML";
   149 use "Syntax/ast.ML";
   150 use "Syntax/syntax_ext.ML";
   151 use "Syntax/parser.ML";
   152 use "Syntax/syntax_trans.ML";
   153 use "Syntax/mixfix.ML";
   154 use "Syntax/printer.ML";
   155 use "Syntax/syntax.ML";
   156 
   157 
   158 (* core of tactical proof system *)
   159 
   160 use "term_ord.ML";
   161 use "term_subst.ML";
   162 use "term_xml.ML";
   163 use "General/completion.ML";
   164 use "General/name_space.ML";
   165 use "sorts.ML";
   166 use "type.ML";
   167 use "logic.ML";
   168 use "Syntax/simple_syntax.ML";
   169 use "net.ML";
   170 use "item_net.ML";
   171 use "envir.ML";
   172 use "consts.ML";
   173 use "primitive_defs.ML";
   174 use "sign.ML";
   175 use "defs.ML";
   176 use "term_sharing.ML";
   177 use "pattern.ML";
   178 use "unify.ML";
   179 use "theory.ML";
   180 use "proofterm.ML";
   181 use "thm.ML";
   182 use "more_pattern.ML";
   183 use "more_unify.ML";
   184 use "more_thm.ML";
   185 use "facts.ML";
   186 use "global_theory.ML";
   187 use "pure_thy.ML";
   188 use "drule.ML";
   189 use "morphism.ML";
   190 use "variable.ML";
   191 use "conv.ML";
   192 use "goal_display.ML";
   193 use "tactical.ML";
   194 use "search.ML";
   195 use "tactic.ML";
   196 use "raw_simplifier.ML";
   197 use "conjunction.ML";
   198 use "assumption.ML";
   199 
   200 
   201 (* Isar -- Intelligible Semi-Automated Reasoning *)
   202 
   203 (*ML support and global execution*)
   204 use "ML/ml_syntax.ML";
   205 use "ML/ml_env.ML";
   206 use "ML/ml_options.ML";
   207 use "ML/exn_output.ML";
   208 if ML_System.is_polyml then use "ML/exn_output_polyml.ML" else ();
   209 use "ML/ml_options.ML";
   210 use "Isar/runtime.ML";
   211 use "PIDE/execution.ML";
   212 use "ML/ml_compiler.ML";
   213 if ML_System.is_polyml then use "ML/ml_compiler_polyml.ML" else ();
   214 
   215 use "skip_proof.ML";
   216 use "goal.ML";
   217 
   218 (*proof context*)
   219 use "Isar/object_logic.ML";
   220 use "Isar/rule_cases.ML";
   221 use "Isar/auto_bind.ML";
   222 use "type_infer.ML";
   223 use "Syntax/local_syntax.ML";
   224 use "Isar/proof_context.ML";
   225 use "type_infer_context.ML";
   226 use "Syntax/syntax_phases.ML";
   227 use "Isar/local_defs.ML";
   228 
   229 (*outer syntax*)
   230 use "Isar/keyword.ML";
   231 use "Isar/token.ML";
   232 use "Isar/parse.ML";
   233 use "Isar/args.ML";
   234 
   235 (*theory specifications*)
   236 use "Isar/local_theory.ML";
   237 use "Thy/thy_header.ML";
   238 use "PIDE/command_span.ML";
   239 use "Thy/thy_syntax.ML";
   240 use "Thy/markdown.ML";
   241 use "Thy/html.ML";
   242 use "Thy/latex.ML";
   243 
   244 (*ML with context and antiquotations*)
   245 use "ML/ml_context.ML";
   246 use "ML/ml_antiquotation.ML";
   247 
   248 fun use s =
   249   ML_Context.eval_file (ML_Compiler.verbose true ML_Compiler.flags) (Path.explode s)
   250     handle ERROR msg => (writeln msg; error "ML error");
   251 
   252 
   253 
   254 (** bootstrap phase 2: towards Pure.thy and final ML toplevel setup *)
   255 
   256 (*basic proof engine*)
   257 use "par_tactical.ML";
   258 use "Isar/proof_display.ML";
   259 use "Isar/attrib.ML";
   260 use "Isar/context_rules.ML";
   261 use "Isar/method.ML";
   262 use "Isar/proof.ML";
   263 use "Isar/element.ML";
   264 use "Isar/obtain.ML";
   265 use "Isar/subgoal.ML";
   266 
   267 (*local theories and targets*)
   268 use "Isar/locale.ML";
   269 use "Isar/generic_target.ML";
   270 use "Isar/overloading.ML";
   271 use "axclass.ML";
   272 use "Isar/class.ML";
   273 use "Isar/named_target.ML";
   274 use "Isar/expression.ML";
   275 use "Isar/interpretation.ML";
   276 use "Isar/class_declaration.ML";
   277 use "Isar/bundle.ML";
   278 use "Isar/experiment.ML";
   279 
   280 use "simplifier.ML";
   281 use "Tools/plugin.ML";
   282 
   283 (*executable theory content*)
   284 use "Isar/code.ML";
   285 
   286 (*specifications*)
   287 use "Isar/parse_spec.ML";
   288 use "Isar/spec_rules.ML";
   289 use "Isar/specification.ML";
   290 use "Isar/typedecl.ML";
   291 
   292 (*toplevel transactions*)
   293 use "Isar/proof_node.ML";
   294 use "Isar/toplevel.ML";
   295 
   296 (*proof term operations*)
   297 use "Proof/reconstruct.ML";
   298 use "Proof/proof_syntax.ML";
   299 use "Proof/proof_rewrite_rules.ML";
   300 use "Proof/proof_checker.ML";
   301 use "Proof/extraction.ML";
   302 
   303 (*theory documents*)
   304 use "System/isabelle_system.ML";
   305 use "Thy/term_style.ML";
   306 use "Isar/outer_syntax.ML";
   307 use "Thy/thy_output.ML";
   308 use "Thy/document_antiquotations.ML";
   309 use "General/graph_display.ML";
   310 use "Thy/present.ML";
   311 use "pure_syn.ML";
   312 use "PIDE/command.ML";
   313 use "PIDE/query_operation.ML";
   314 use "PIDE/resources.ML";
   315 use "Thy/thy_info.ML";
   316 use "PIDE/session.ML";
   317 use "PIDE/protocol_message.ML";
   318 use "PIDE/document.ML";
   319 
   320 (*theory and proof operations*)
   321 use "Isar/isar_cmd.ML";
   322 
   323 
   324 (* Isabelle/Isar system *)
   325 
   326 use "System/command_line.ML";
   327 use "System/system_channel.ML";
   328 use "System/message_channel.ML";
   329 use "System/isabelle_process.ML";
   330 use "System/invoke_scala.ML";
   331 use "PIDE/protocol.ML";
   332 
   333 
   334 (* miscellaneous tools and packages for Pure Isabelle *)
   335 
   336 use "Tools/build.ML";
   337 use "Tools/named_thms.ML";
   338 
   339 structure Output: OUTPUT = Output;  (*seal system channels!*)
   340 
   341 
   342 (* ML toplevel pretty printing *)
   343 
   344 toplevel_pp ["Pretty", "T"] "(fn _: Pretty.T => Pretty.str \"<pretty>\")";
   345 toplevel_pp ["Scan", "lexicon"] "Lexicon.pp_lexicon";
   346 toplevel_pp ["Task_Queue", "task"] "Pretty.str o Task_Queue.str_of_task";
   347 toplevel_pp ["Task_Queue", "group"] "Pretty.str o Task_Queue.str_of_group";
   348 toplevel_pp ["Position", "T"] "Pretty.position";
   349 toplevel_pp ["Binding", "binding"] "Binding.pp";
   350 toplevel_pp ["Thm", "thm"] "Proof_Display.pp_thm Thy_Info.pure_theory";
   351 toplevel_pp ["Thm", "cterm"] "Proof_Display.pp_cterm Thy_Info.pure_theory";
   352 toplevel_pp ["Thm", "ctyp"] "Proof_Display.pp_ctyp Thy_Info.pure_theory";
   353 toplevel_pp ["typ"] "Proof_Display.pp_typ Thy_Info.pure_theory";
   354 toplevel_pp ["Context", "theory"] "Context.pretty_thy";
   355 toplevel_pp ["Context", "Proof", "context"] "Proof_Display.pp_context";
   356 toplevel_pp ["Ast", "ast"] "Ast.pretty_ast";
   357 toplevel_pp ["Path", "T"] "Path.pretty";
   358 toplevel_pp ["SHA1", "digest"] "Pretty.str o quote o SHA1.rep";
   359 toplevel_pp ["Proof", "state"] "(fn _: Proof.state => Pretty.str \"<Proof.state>\")";
   360 toplevel_pp ["Toplevel", "state"] "Toplevel.pretty_abstract";
   361 toplevel_pp ["Morphism", "morphism"] "Morphism.pretty";
   362 
   363 if ML_System.is_polyml then use "ML/install_pp_polyml.ML" else ();
   364 
   365 
   366 (* the Pure theory *)
   367 
   368 use "ML/ml_file.ML";
   369 Runtime.toplevel_program (fn () => Thy_Info.use_thy ("Pure", Position.none));
   370 Context.set_thread_data NONE;
   371 structure Pure = struct val thy = Thy_Info.pure_theory () end;
   372 
   373 
   374 (* ML toplevel commands *)
   375 
   376 fun use_thys args =
   377   Runtime.toplevel_program (fn () => Thy_Info.use_thys (map (rpair Position.none) args));
   378 val use_thy = use_thys o single;
   379 
   380 val cd = File.cd o Path.explode;
   381 
   382 Proofterm.proofs := 0;