(* ========================================================================= *) (* HOL LIGHT *) (* *) (* Modern OCaml version of the HOL theorem prover *) (* *) (* John Harrison *) (* *) (* (c) Copyright, University of Cambridge 1998 *) (* (c) Copyright, John Harrison 1998-2007 *) (* ========================================================================= *) let hol_version = "2.20++";; let hol_dir = ref (try Sys.getenv "HOLLIGHT_DIR" with Not_found -> Sys.getcwd());; (* ------------------------------------------------------------------------- *) (* Should eventually change to "ref(Filename.temp_dir_name)". *) (* However that's not available in 3.08, which is still the default *) (* in Cygwin, and I don't want to force people to upgrade Ocaml. *) (* ------------------------------------------------------------------------- *) let temp_path = ref "/tmp";; (* ------------------------------------------------------------------------- *) (* Load in parsing extensions. *) (* For Ocaml < 3.10, use the built-in camlp4 *) (* and for Ocaml >= 3.10, use camlp5 instead. *) (* ------------------------------------------------------------------------- *) Opttopdirs.dir_directory "+camlp5";; Opttopdirs.dir_load Format.std_formatter "camlp5o.cmxa";; Opttopdirs.dir_load Format.std_formatter (Filename.concat (!hol_dir) "pa_jnat.cmx");; (* ------------------------------------------------------------------------- *) (* Load files from system and/or user-settable directories. *) (* Paths map initial "$/" to !hol_dir dynamically; use $$ to get the actual *) (* $ character at the start of a directory. *) (* ------------------------------------------------------------------------- *) let use_file s = if Opttoploop.use_file Format.std_formatter s then () else (Format.print_string("Error in included file "^s); Format.print_newline());; let hol_expand_directory s = if s = "$" or s = "$/" then !hol_dir else if s = "$$" then "$" else if String.length s <= 2 then s else if String.sub s 0 2 = "$$" then (String.sub s 1 (String.length s - 1)) else if String.sub s 0 2 = "$/" then Filename.concat (!hol_dir) (String.sub s 2 (String.length s - 2)) else s;; let load_path = ref ["."; "$"];; let loaded_files = ref [];; let file_on_path p s = if not (Filename.is_relative s) then s else let p' = List.map hol_expand_directory p in let d = List.find (fun d -> Sys.file_exists(Filename.concat d s)) p' in Filename.concat (if d = "." then Sys.getcwd() else d) s;; let load_on_path p s = let s' = file_on_path p s in let fileid = (Filename.basename s',Digest.file s') in (use_file s'; loaded_files := fileid::(!loaded_files));; let loads s = load_on_path ["$"] s;; let loadt s = load_on_path (!load_path) s;; let needs s = let s' = file_on_path (!load_path) s in let fileid = (Filename.basename s',Digest.file s') in if List.mem fileid (!loaded_files) then Format.print_string("File \""^s^"\" already loaded\n") else loadt s;; #load "nums.cmxa";; include Num;; #load "holcore.cmx";; include Holcore;; #load "proved1.cmx";; include Proved1;; #load "proved2.cmx";; include Proved2;; #load "proved3.cmx";; include Proved3;; #install_printer print_num;; #install_printer print_fpf;; #install_printer print_qtype;; #install_printer print_qterm;; #install_printer print_thm;; #install_printer print_goal;; #install_printer print_goalstack;;