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