src/Pure/ROOT.ML
author wenzelm
Mon Sep 29 09:57:34 2014 +0200 (2014-09-29)
changeset 58470 890d8286fd4e
parent 58032 e92cdae8b3b5
child 58660 8d4aebb9e327
permissions -rw-r--r--
pro-forma support for polyml-5.5.3 (presently SVN 1960);
     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/simple_thread.ML";
    22 
    23 use "Concurrent/synchronized.ML";
    24 if Multithreading.available then ()
    25 else use "Concurrent/synchronized_sequential.ML";
    26 use "Concurrent/counter.ML";
    27 
    28 use "General/properties.ML";
    29 use "General/output.ML";
    30 use "PIDE/markup.ML";
    31 fun legacy_feature s = warning (Markup.markup Markup.legacy ("Legacy feature! " ^ s));
    32 use "General/scan.ML";
    33 use "General/source.ML";
    34 use "General/symbol.ML";
    35 use "General/position.ML";
    36 use "General/symbol_pos.ML";
    37 use "General/antiquote.ML";
    38 use "ML/ml_lex.ML";
    39 use "ML/ml_parse.ML";
    40 use "General/secure.ML";
    41 
    42 val use_text = Secure.use_text;
    43 val use_file = Secure.use_file;
    44 
    45 fun use s =
    46   Position.setmp_thread_data (Position.file_only s)
    47     (fn () =>
    48       Secure.use_file ML_Parse.global_context true s
    49         handle ERROR msg => (writeln msg; error "ML error")) ();
    50 
    51 val toplevel_pp = Secure.toplevel_pp;
    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 "General/path.ML";
    69 use "General/url.ML";
    70 use "General/file.ML";
    71 use "General/long_name.ML";
    72 use "General/binding.ML";
    73 use "General/socket_io.ML";
    74 use "General/seq.ML";
    75 use "General/timing.ML";
    76 
    77 use "General/sha1.ML";
    78 if ML_System.is_polyml then use "General/sha1_polyml.ML" else ();
    79 use "General/sha1_samples.ML";
    80 
    81 use "PIDE/xml.ML";
    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 use "System/options.ML";
    89 
    90 
    91 (* concurrency within the ML runtime *)
    92 
    93 if ML_System.is_polyml
    94 then use "ML/exn_properties_polyml.ML"
    95 else use "ML/exn_properties_dummy.ML";
    96 
    97 if ML_System.name = "polyml-5.5.1"
    98   orelse ML_System.name = "polyml-5.5.2"
    99   orelse ML_System.name = "polyml-5.5.3"
   100 then use "ML/exn_trace_polyml-5.5.1.ML"
   101 else ();
   102 
   103 if ML_System.name = "polyml-5.5.0"
   104   orelse ML_System.name = "polyml-5.5.1"
   105   orelse ML_System.name = "polyml-5.5.2"
   106   orelse ML_System.name = "polyml-5.5.3"
   107 then use "ML/ml_statistics_polyml-5.5.0.ML"
   108 else use "ML/ml_statistics_dummy.ML";
   109 
   110 use "Concurrent/single_assignment.ML";
   111 if Multithreading.available then ()
   112 else use "Concurrent/single_assignment_sequential.ML";
   113 
   114 if Multithreading.available
   115 then use "Concurrent/bash.ML"
   116 else use "Concurrent/bash_sequential.ML";
   117 
   118 use "Concurrent/par_exn.ML";
   119 use "Concurrent/task_queue.ML";
   120 use "Concurrent/future.ML";
   121 use "Concurrent/event_timer.ML";
   122 
   123 if ML_System.is_polyml then use "Concurrent/time_limit.ML" else ();
   124 
   125 use "Concurrent/lazy.ML";
   126 if Multithreading.available then ()
   127 else use "Concurrent/lazy_sequential.ML";
   128 
   129 use "Concurrent/par_list.ML";
   130 if Multithreading.available then ()
   131 else use "Concurrent/par_list_sequential.ML";
   132 
   133 use "Concurrent/mailbox.ML";
   134 use "Concurrent/cache.ML";
   135 
   136 use "PIDE/active.ML";
   137 
   138 
   139 (* fundamental structures *)
   140 
   141 use "name.ML";
   142 use "term.ML";
   143 use "context.ML";
   144 use "context_position.ML";
   145 use "config.ML";
   146 
   147 
   148 (* inner syntax *)
   149 
   150 use "Syntax/type_annotation.ML";
   151 use "Syntax/term_position.ML";
   152 use "Syntax/lexicon.ML";
   153 use "Syntax/ast.ML";
   154 use "Syntax/syntax_ext.ML";
   155 use "Syntax/parser.ML";
   156 use "Syntax/syntax_trans.ML";
   157 use "Syntax/mixfix.ML";
   158 use "Syntax/printer.ML";
   159 use "Syntax/syntax.ML";
   160 
   161 
   162 (* core of tactical proof system *)
   163 
   164 use "term_ord.ML";
   165 use "term_subst.ML";
   166 use "term_xml.ML";
   167 use "General/completion.ML";
   168 use "General/name_space.ML";
   169 use "sorts.ML";
   170 use "type.ML";
   171 use "logic.ML";
   172 use "Syntax/simple_syntax.ML";
   173 use "net.ML";
   174 use "item_net.ML";
   175 use "envir.ML";
   176 use "consts.ML";
   177 use "primitive_defs.ML";
   178 use "defs.ML";
   179 use "sign.ML";
   180 use "term_sharing.ML";
   181 use "pattern.ML";
   182 use "unify.ML";
   183 use "theory.ML";
   184 use "interpretation.ML";
   185 use "proofterm.ML";
   186 use "thm.ML";
   187 use "more_thm.ML";
   188 use "facts.ML";
   189 use "global_theory.ML";
   190 use "pure_thy.ML";
   191 use "drule.ML";
   192 use "morphism.ML";
   193 use "variable.ML";
   194 use "conv.ML";
   195 use "goal_display.ML";
   196 use "tactical.ML";
   197 use "search.ML";
   198 use "tactic.ML";
   199 use "raw_simplifier.ML";
   200 use "conjunction.ML";
   201 use "assumption.ML";
   202 use "display.ML";
   203 
   204 
   205 (* Isar -- Intelligible Semi-Automated Reasoning *)
   206 
   207 (*ML support and global execution*)
   208 use "ML/ml_syntax.ML";
   209 use "ML/ml_env.ML";
   210 use "ML/ml_options.ML";
   211 use "ML/exn_output.ML";
   212 if ML_System.is_polyml then use "ML/exn_output_polyml.ML" else ();
   213 use "ML/ml_options.ML";
   214 use "Isar/runtime.ML";
   215 use "PIDE/execution.ML";
   216 use "ML/ml_compiler.ML";
   217 if ML_System.is_polyml then use "ML/ml_compiler_polyml.ML" else ();
   218 
   219 use "skip_proof.ML";
   220 use "goal.ML";
   221 
   222 (*proof context*)
   223 use "Isar/object_logic.ML";
   224 use "Isar/rule_cases.ML";
   225 use "Isar/auto_bind.ML";
   226 use "type_infer.ML";
   227 use "Syntax/local_syntax.ML";
   228 use "Isar/proof_context.ML";
   229 use "type_infer_context.ML";
   230 use "Syntax/syntax_phases.ML";
   231 use "Isar/local_defs.ML";
   232 
   233 (*outer syntax*)
   234 use "Isar/token.ML";
   235 use "Isar/keyword.ML";
   236 use "Isar/parse.ML";
   237 use "Isar/args.ML";
   238 
   239 (*theory specifications*)
   240 use "Isar/local_theory.ML";
   241 use "Thy/thy_header.ML";
   242 use "PIDE/command_span.ML";
   243 use "Thy/thy_syntax.ML";
   244 use "Thy/html.ML";
   245 use "Thy/latex.ML";
   246 
   247 (*ML with context and antiquotations*)
   248 use "ML/ml_context.ML";
   249 use "ML/ml_antiquotation.ML";
   250 
   251 fun use s =
   252   ML_Context.eval_file (ML_Compiler.verbose true ML_Compiler.flags) (Path.explode s)
   253     handle ERROR msg => (writeln msg; error "ML error");
   254 
   255 
   256 
   257 (** bootstrap phase 2: towards Pure.thy and final ML toplevel setup *)
   258 
   259 (*basic proof engine*)
   260 use "par_tactical.ML";
   261 use "Isar/proof_display.ML";
   262 use "Isar/attrib.ML";
   263 use "Isar/context_rules.ML";
   264 use "Isar/method.ML";
   265 use "Isar/proof.ML";
   266 use "Isar/element.ML";
   267 use "Isar/obtain.ML";
   268 
   269 (*local theories and targets*)
   270 use "Isar/locale.ML";
   271 use "Isar/generic_target.ML";
   272 use "Isar/overloading.ML";
   273 use "axclass.ML";
   274 use "Isar/class.ML";
   275 use "Isar/named_target.ML";
   276 use "Isar/expression.ML";
   277 use "Isar/class_declaration.ML";
   278 use "Isar/bundle.ML";
   279 
   280 use "simplifier.ML";
   281 
   282 (*executable theory content*)
   283 use "Isar/code.ML";
   284 
   285 (*specifications*)
   286 use "Isar/parse_spec.ML";
   287 use "Isar/spec_rules.ML";
   288 use "Isar/specification.ML";
   289 use "Isar/typedecl.ML";
   290 
   291 (*toplevel transactions*)
   292 use "Isar/proof_node.ML";
   293 use "Isar/toplevel.ML";
   294 
   295 (*proof term operations*)
   296 use "Proof/reconstruct.ML";
   297 use "Proof/proof_syntax.ML";
   298 use "Proof/proof_rewrite_rules.ML";
   299 use "Proof/proof_checker.ML";
   300 use "Proof/extraction.ML";
   301 
   302 (*theory documents*)
   303 use "System/isabelle_system.ML";
   304 use "Thy/term_style.ML";
   305 use "Thy/thy_output.ML";
   306 use "Isar/outer_syntax.ML";
   307 use "General/graph_display.ML";
   308 use "Thy/present.ML";
   309 use "PIDE/command.ML";
   310 use "PIDE/query_operation.ML";
   311 use "PIDE/resources.ML";
   312 use "Thy/thy_info.ML";
   313 use "PIDE/document.ML";
   314 
   315 (*theory and proof operations*)
   316 use "Isar/isar_cmd.ML";
   317 
   318 use "subgoal.ML";
   319 
   320 
   321 (* Isabelle/Isar system *)
   322 
   323 use "PIDE/session.ML";
   324 use "System/command_line.ML";
   325 use "System/system_channel.ML";
   326 use "System/message_channel.ML";
   327 use "System/isabelle_process.ML";
   328 use "System/invoke_scala.ML";
   329 use "PIDE/protocol.ML";
   330 use "System/isar.ML";
   331 
   332 
   333 (* miscellaneous tools and packages for Pure Isabelle *)
   334 
   335 use "Tools/build.ML";
   336 use "Tools/named_thms.ML";
   337 use "Tools/proof_general.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 ["Task_Queue", "task"] "Pretty.str o Task_Queue.str_of_task";
   346 toplevel_pp ["Task_Queue", "group"] "Pretty.str o Task_Queue.str_of_group";
   347 toplevel_pp ["Position", "T"] "Pretty.position";
   348 toplevel_pp ["Binding", "binding"] "Binding.pp";
   349 toplevel_pp ["Thm", "thm"] "Proof_Display.pp_thm";
   350 toplevel_pp ["Thm", "cterm"] "Proof_Display.pp_cterm";
   351 toplevel_pp ["Thm", "ctyp"] "Proof_Display.pp_ctyp";
   352 toplevel_pp ["Context", "theory"] "Context.pretty_thy";
   353 toplevel_pp ["Context", "Proof", "context"] "Proof_Display.pp_context";
   354 toplevel_pp ["Ast", "ast"] "Ast.pretty_ast";
   355 toplevel_pp ["Path", "T"] "Path.pretty";
   356 toplevel_pp ["SHA1", "digest"] "Pretty.str o quote o SHA1.rep";
   357 toplevel_pp ["Proof", "state"] "(fn _: Proof.state => Pretty.str \"<Proof.state>\")";
   358 toplevel_pp ["Toplevel", "state"] "Toplevel.pretty_abstract";
   359 toplevel_pp ["Morphism", "morphism"] "Morphism.pretty";
   360 
   361 if ML_System.is_polyml then use "ML/install_pp_polyml.ML" else ();
   362 
   363 
   364 (* the Pure theory *)
   365 
   366 use "pure_syn.ML";
   367 Runtime.toplevel_program (fn () => Thy_Info.use_thy ("Pure", Position.none));
   368 Context.set_thread_data NONE;
   369 structure Pure = struct val thy = Thy_Info.get_theory "Pure" end;
   370 
   371 toplevel_pp ["typ"] "Proof_Display.pp_typ Pure.thy";
   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;
   383