diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_BaseTypes.ml b/engine/backends/fstar/fstar-surface-ast/FStar_BaseTypes.ml index 66b018bd1..cb3dbc318 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_BaseTypes.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_BaseTypes.ml @@ -1,10 +1,10 @@ type char = FStar_Char.char[@@deriving yojson,show] -type float = FStar_Float.float[@@deriving yojson,show] -type double = FStar_Float.double[@@deriving yojson,show] -type byte = FStar_UInt8.byte[@@deriving yojson,show] -type int8 = FStar_Int8.int8 -type uint8 = FStar_UInt8.uint8 -type int16 = FStar_Int16.int16 -type uint16 = FStar_UInt16.uint16 -type int32 = FStar_Int32.int32 -type int64 = FStar_Int64.int64 +type float = Base.Float.t +type double = Base.Float.t +type byte = Base.Int.t +type int8 = Stdint.Int8.t +type uint8 = Stdint.Uint8.t +type int16 = Stdint.Int16.t +type uint16 = Stdint.Uint16.t +type int32 = Stdint.Int32.t +type int64 = Stdint.Int64.t diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_BigInt.ml b/engine/backends/fstar/fstar-surface-ast/FStar_BigInt.ml deleted file mode 100644 index 2314ae4ff..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_BigInt.ml +++ /dev/null @@ -1,44 +0,0 @@ -type bigint = Z.t -type t = bigint - -let zero = Z.zero -let one = Z.one -let two = Z.of_string "2" - -let succ_big_int = Z.succ -let pred_big_int = Z.pred -let minus_big_int = Z.neg -let abs_big_int = Z.abs - -let add_big_int = Z.add -let mult_big_int = Z.mul -let sub_big_int = Z.sub -let div_big_int = Z.ediv -let mod_big_int = Z.erem - -let eq_big_int = Z.equal -let le_big_int = Z.leq -let lt_big_int = Z.lt -let ge_big_int = Z.geq -let gt_big_int = Z.gt - -let logand_big_int = Z.logand -let logor_big_int = Z.logor -let logxor_big_int = Z.logxor -let lognot_big_int = Z.lognot - -let shift_left_big_int x y = Z.shift_left x (Z.to_int y) -let shift_right_big_int x y = Z.shift_right x (Z.to_int y) - -let sqrt_big_int = Z.sqrt - -let string_of_big_int = Z.to_string -let big_int_of_string = Z.of_string - -let of_int = Z.of_int -let to_int = Z.to_int - -let of_int_fs x = x -let to_int_fs x = x - -let of_hex x = Z.of_string ("0x" ^ x) diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Char.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Char.ml index 2727e7236..4f17aaa6b 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Char.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Char.ml @@ -1,21 +1,2 @@ module UChar = BatUChar - -module U32 = FStar_UInt32 - type char = int[@@deriving yojson,show] -type char_code = U32.t - -(* FIXME(adl) UChar.lowercase/uppercase removed from recent Batteries. Use Camomile? *) -let lowercase (x:char) : char = - try Char.code (Char.lowercase_ascii (Char.chr x)) - with _ -> x - -let uppercase (x:char) : char = - try Char.code (Char.uppercase_ascii (Char.chr x)) - with _ -> x - -let int_of_char (x:char) : Z.t= Z.of_int x -let char_of_int (i:Z.t) : char = Z.to_int i - -let u32_of_char (x:char) : char_code = U32.of_native_int x -let char_of_u32 (x:char_code) : char = U32.to_native_int x diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Common.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Common.ml deleted file mode 100644 index 373232355..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Common.ml +++ /dev/null @@ -1,177 +0,0 @@ -open Prims -let (has_cygpath : Prims.bool) = - try - (fun uu___ -> - match () with - | () -> - let t_out = - FStar_Compiler_Util.run_process "has_cygpath" "which" - ["cygpath"] FStar_Pervasives_Native.None in - (FStar_Compiler_Util.trim_string t_out) = "/usr/bin/cygpath") () - with | uu___ -> false -let (try_convert_file_name_to_mixed : Prims.string -> Prims.string) = - let cache = FStar_Compiler_Util.smap_create (Prims.of_int (20)) in - fun s -> - if has_cygpath && (FStar_Compiler_Util.starts_with s "/") - then - let uu___ = FStar_Compiler_Util.smap_try_find cache s in - match uu___ with - | FStar_Pervasives_Native.Some s1 -> s1 - | FStar_Pervasives_Native.None -> - let label = "try_convert_file_name_to_mixed" in - let out = - let uu___1 = - FStar_Compiler_Util.run_process label "cygpath" ["-m"; s] - FStar_Pervasives_Native.None in - FStar_Compiler_Effect.op_Bar_Greater uu___1 - FStar_Compiler_Util.trim_string in - (FStar_Compiler_Util.smap_add cache s out; out) - else s -let snapshot : - 'a 'b 'c . - ('a -> 'b) -> - 'c Prims.list FStar_Compiler_Effect.ref -> 'a -> (Prims.int * 'b) - = - fun push -> - fun stackref -> - fun arg -> - FStar_Compiler_Util.atomically - (fun uu___ -> - let len = - let uu___1 = FStar_Compiler_Effect.op_Bang stackref in - FStar_Compiler_List.length uu___1 in - let arg' = push arg in (len, arg')) -let rollback : - 'a 'c . - (unit -> 'a) -> - 'c Prims.list FStar_Compiler_Effect.ref -> - Prims.int FStar_Pervasives_Native.option -> 'a - = - fun pop -> - fun stackref -> - fun depth -> - let rec aux n = - if n <= Prims.int_zero - then failwith "Too many pops" - else - if n = Prims.int_one - then pop () - else ((let uu___3 = pop () in ()); aux (n - Prims.int_one)) in - let curdepth = - let uu___ = FStar_Compiler_Effect.op_Bang stackref in - FStar_Compiler_List.length uu___ in - let n = - match depth with - | FStar_Pervasives_Native.Some d -> curdepth - d - | FStar_Pervasives_Native.None -> Prims.int_one in - FStar_Compiler_Util.atomically (fun uu___ -> aux n) -let raise_failed_assertion : 'uuuuu . Prims.string -> 'uuuuu = - fun msg -> - let uu___ = FStar_Compiler_Util.format1 "Assertion failed: %s" msg in - failwith uu___ -let (runtime_assert : Prims.bool -> Prims.string -> unit) = - fun b -> - fun msg -> if Prims.op_Negation b then raise_failed_assertion msg else () -let __string_of_list : - 'a . Prims.string -> ('a -> Prims.string) -> 'a Prims.list -> Prims.string - = - fun delim -> - fun f -> - fun l -> - match l with - | [] -> "[]" - | x::xs -> - let strb = FStar_Compiler_Util.new_string_builder () in - (FStar_Compiler_Util.string_builder_append strb "["; - (let uu___2 = f x in - FStar_Compiler_Util.string_builder_append strb uu___2); - FStar_Compiler_List.iter - (fun x1 -> - FStar_Compiler_Util.string_builder_append strb delim; - (let uu___4 = f x1 in - FStar_Compiler_Util.string_builder_append strb uu___4)) xs; - FStar_Compiler_Util.string_builder_append strb "]"; - FStar_Compiler_Util.string_of_string_builder strb) -let string_of_list : - 'uuuuu . - unit -> ('uuuuu -> Prims.string) -> 'uuuuu Prims.list -> Prims.string - = fun uu___ -> __string_of_list ", " -let string_of_list' : - 'uuuuu . - unit -> ('uuuuu -> Prims.string) -> 'uuuuu Prims.list -> Prims.string - = fun uu___ -> __string_of_list "; " -let string_of_set : - 'a . ('a -> Prims.string) -> 'a FStar_Compiler_Util.set -> Prims.string = - fun f -> - fun l -> - let uu___ = FStar_Compiler_Util.set_elements l in - match uu___ with - | [] -> "{}" - | x::xs -> - let strb = FStar_Compiler_Util.new_string_builder () in - (FStar_Compiler_Util.string_builder_append strb "{"; - (let uu___3 = f x in - FStar_Compiler_Util.string_builder_append strb uu___3); - FStar_Compiler_List.iter - (fun x1 -> - FStar_Compiler_Util.string_builder_append strb ", "; - (let uu___5 = f x1 in - FStar_Compiler_Util.string_builder_append strb uu___5)) xs; - FStar_Compiler_Util.string_builder_append strb "}"; - FStar_Compiler_Util.string_of_string_builder strb) -let list_of_option : 'a . 'a FStar_Pervasives_Native.option -> 'a Prims.list - = - fun o -> - match o with - | FStar_Pervasives_Native.None -> [] - | FStar_Pervasives_Native.Some x -> [x] -let string_of_option : - 'uuuuu . - ('uuuuu -> Prims.string) -> - 'uuuuu FStar_Pervasives_Native.option -> Prims.string - = - fun f -> - fun uu___ -> - match uu___ with - | FStar_Pervasives_Native.None -> "None" - | FStar_Pervasives_Native.Some x -> - let uu___1 = f x in Prims.op_Hat "Some " uu___1 -let tabulate : 'a . Prims.int -> (Prims.int -> 'a) -> 'a Prims.list = - fun n -> - fun f -> - let rec aux i = - if i < n - then - let uu___ = f i in - let uu___1 = aux (i + Prims.int_one) in uu___ :: uu___1 - else [] in - aux Prims.int_zero -let rec max_prefix : - 'a . ('a -> Prims.bool) -> 'a Prims.list -> ('a Prims.list * 'a Prims.list) - = - fun f -> - fun xs -> - match xs with - | [] -> ([], []) - | x::xs1 when f x -> - let uu___ = max_prefix f xs1 in - (match uu___ with | (l, r) -> ((x :: l), r)) - | x::xs1 -> ([], (x :: xs1)) -let max_suffix : - 'a . ('a -> Prims.bool) -> 'a Prims.list -> ('a Prims.list * 'a Prims.list) - = - fun f -> - fun xs -> - let rec aux acc xs1 = - match xs1 with - | [] -> (acc, []) - | x::xs2 when f x -> aux (x :: acc) xs2 - | x::xs2 -> (acc, (x :: xs2)) in - let uu___ = - let uu___1 = - FStar_Compiler_Effect.op_Bar_Greater xs FStar_Compiler_List.rev in - FStar_Compiler_Effect.op_Bar_Greater uu___1 (aux []) in - FStar_Compiler_Effect.op_Bar_Greater uu___ - (fun uu___1 -> - match uu___1 with - | (xs1, ys) -> ((FStar_Compiler_List.rev ys), xs1)) \ No newline at end of file diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_CommonST.ml b/engine/backends/fstar/fstar-surface-ast/FStar_CommonST.ml deleted file mode 100644 index 2a7984389..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_CommonST.ml +++ /dev/null @@ -1,19 +0,0 @@ -open FStar_Monotonic_Heap - -let read x = !x - -let op_Bang x = read x - -let write x y = x := y - -let op_Colon_Equals x y = write x y - -let alloc contents = ref contents - -let recall = (fun r -> ()) -let get () = () - -type 'a witnessed = | C - -let gst_witness = (fun r -> ()) -let gst_recall = (fun r -> ()) diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Option.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Option.ml deleted file mode 100644 index aeb9eeabb..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Option.ml +++ /dev/null @@ -1,37 +0,0 @@ -open Prims -let isNone : 'a . 'a FStar_Pervasives_Native.option -> Prims.bool = - fun uu___ -> - match uu___ with - | FStar_Pervasives_Native.None -> true - | FStar_Pervasives_Native.Some uu___1 -> false -let isSome : 'a . 'a FStar_Pervasives_Native.option -> Prims.bool = - fun uu___ -> - match uu___ with - | FStar_Pervasives_Native.Some uu___1 -> true - | FStar_Pervasives_Native.None -> false -let map : - 'a 'b . - ('a -> 'b) -> - 'a FStar_Pervasives_Native.option -> 'b FStar_Pervasives_Native.option - = - fun f -> - fun uu___ -> - match uu___ with - | FStar_Pervasives_Native.Some x -> - let uu___1 = f x in FStar_Pervasives_Native.Some uu___1 - | FStar_Pervasives_Native.None -> FStar_Pervasives_Native.None -let mapTot : - 'a 'b . - ('a -> 'b) -> - 'a FStar_Pervasives_Native.option -> 'b FStar_Pervasives_Native.option - = - fun f -> - fun uu___ -> - match uu___ with - | FStar_Pervasives_Native.Some x -> FStar_Pervasives_Native.Some (f x) - | FStar_Pervasives_Native.None -> FStar_Pervasives_Native.None -let get : 'a . 'a FStar_Pervasives_Native.option -> 'a = - fun uu___ -> - match uu___ with - | FStar_Pervasives_Native.Some x -> x - | FStar_Pervasives_Native.None -> failwith "empty option" \ No newline at end of file diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Range.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Range.ml index 9910cb409..fb7330196 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Range.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Range.ml @@ -101,22 +101,7 @@ let (string_of_pos : pos -> Prims.string) = FStar_Compiler_Util.format2 "%s,%s" uu___ uu___1 let (string_of_file_name : Prims.string -> Prims.string) = fun f -> - let uu___ = FStar_Options.ide () in - if uu___ - then - try - (fun uu___1 -> - match () with - | () -> - let uu___2 = - let uu___3 = FStar_Compiler_Util.basename f in - FStar_Options.find_file uu___3 in - (match uu___2 with - | FStar_Pervasives_Native.None -> f - | FStar_Pervasives_Native.Some absolute_path -> absolute_path)) - () - with | uu___1 -> f - else f + f let (file_of_range : range -> Prims.string) = fun r -> let f = (r.def_range).file_name in string_of_file_name f let (set_file_of_range : range -> Prims.string -> range) = @@ -181,69 +166,3 @@ let (extend_to_end_of_line : range -> range) = let uu___1 = start_of_range r in let uu___2 = let uu___3 = end_of_range r in end_of_line uu___3 in mk_range uu___ uu___1 uu___2 -let (prims_to_fstar_range : - ((Prims.string * (Prims.int * Prims.int) * (Prims.int * Prims.int)) * - (Prims.string * (Prims.int * Prims.int) * (Prims.int * Prims.int))) -> - range) - = - fun r -> - let uu___ = r in - match uu___ with - | (r1, r2) -> - let uu___1 = r1 in - (match uu___1 with - | (f1, s1, e1) -> - let uu___2 = r2 in - (match uu___2 with - | (f2, s2, e2) -> - let s11 = - mk_pos (FStar_Pervasives_Native.fst s1) - (FStar_Pervasives_Native.snd s1) in - let e11 = - mk_pos (FStar_Pervasives_Native.fst e1) - (FStar_Pervasives_Native.snd e1) in - let s21 = - mk_pos (FStar_Pervasives_Native.fst s2) - (FStar_Pervasives_Native.snd s2) in - let e21 = - mk_pos (FStar_Pervasives_Native.fst e2) - (FStar_Pervasives_Native.snd e2) in - let r11 = mk_rng f1 s11 e11 in - let r21 = mk_rng f2 s21 e21 in - { def_range = r11; use_range = r21 })) -let (json_of_pos : pos -> FStar_Compiler_Util.json) = - fun pos1 -> - let uu___ = - let uu___1 = - let uu___2 = line_of_pos pos1 in FStar_Compiler_Util.JsonInt uu___2 in - let uu___2 = - let uu___3 = - let uu___4 = col_of_pos pos1 in FStar_Compiler_Util.JsonInt uu___4 in - [uu___3] in - uu___1 :: uu___2 in - FStar_Compiler_Util.JsonList uu___ -let (json_of_range_fields : - Prims.string -> pos -> pos -> FStar_Compiler_Util.json) = - fun file -> - fun b -> - fun e -> - let uu___ = - let uu___1 = - let uu___2 = let uu___3 = json_of_pos b in ("beg", uu___3) in - let uu___3 = - let uu___4 = let uu___5 = json_of_pos e in ("end", uu___5) in - [uu___4] in - uu___2 :: uu___3 in - ("fname", (FStar_Compiler_Util.JsonStr file)) :: uu___1 in - FStar_Compiler_Util.JsonAssoc uu___ -let (json_of_use_range : range -> FStar_Compiler_Util.json) = - fun r -> - let uu___ = file_of_use_range r in - let uu___1 = start_of_use_range r in - let uu___2 = end_of_use_range r in - json_of_range_fields uu___ uu___1 uu___2 -let (json_of_def_range : range -> FStar_Compiler_Util.json) = - fun r -> - let uu___ = file_of_range r in - let uu___1 = start_of_range r in - let uu___2 = end_of_range r in json_of_range_fields uu___ uu___1 uu___2 \ No newline at end of file diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Util.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Util.ml index 2294217ee..6da6ede86 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Util.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Compiler_Util.ml @@ -1,3 +1,6 @@ +let ensure_decimal s = Z.to_string (Z.of_string s) + + let max_int = Z.of_int max_int let is_letter c = if c > 255 then false else BatChar.is_letter (BatChar.chr c) let is_digit c = if c > 255 then false else BatChar.is_digit (BatChar.chr c) @@ -12,18 +15,6 @@ let is_punctuation c = List.mem c [33; 34; 35; 37; 38; 39; 40; 41; 42; 44; 45; 4 let return_all x = x -type time = float -let now () = BatUnix.gettimeofday () -let now_ms () = Z.of_int (int_of_float (now () *. 1000.0)) -let time_diff (t1:time) (t2:time) : float * Prims.int = - let n = t2 -. t1 in - n, - Z.of_float (n *. 1000.0) -let record_time f = - let start = now () in - let res = f () in - let _, elapsed = time_diff start (now()) in - res, elapsed let get_file_last_modification_time f = (BatUnix.stat f).BatUnix.st_mtime let is_before t1 t2 = compare t1 t2 < 0 let string_of_time = string_of_float @@ -69,195 +60,6 @@ let with_sigint_handler handler f = (fun () -> set_sigint_handler handler; f ()) () -type proc = - {pid: int; - inc : in_channel; - outc : out_channel; - mutable killed : bool; - stop_marker: (string -> bool) option; - id : string; - start_time : time} - -let all_procs : (proc list) ref = ref [] - -let lock () = () -let release () = () -let sleep n = Thread.delay ((Z.to_float n) /. 1000.) - -let mlock = Mutex.create () - -let monitor_enter _ = Mutex.lock mlock -let monitor_exit _ = Mutex.unlock mlock -let monitor_wait _ = () -let monitor_pulse _ = () -let current_tid _ = Z.zero - -let atomically f = (* This function only protects against signals *) - let finalizer () = - decr sigint_delay; - if !sigint_pending && !sigint_delay = 0 then - raise_sigint () in - let body f = - incr sigint_delay; f () in - BatPervasives.finally finalizer body f - -let with_monitor _ f x = atomically (fun () -> - monitor_enter (); - BatPervasives.finally monitor_exit f x) - -let spawn f = - let _ = Thread.create f () in () - -let stack_dump () = Printexc.raw_backtrace_to_string (Printexc.get_callstack 1000) - -(* On the OCaml side it would make more sense to take stop_marker in - ask_process, but the F# side isn't built that way *) -let start_process' - (id: string) (prog: string) (args: string list) - (stop_marker: (string -> bool) option) : proc = - let (stdout_r, stdout_w) = Unix.pipe () in - let (stdin_r, stdin_w) = Unix.pipe () in - Unix.set_close_on_exec stdin_w; - Unix.set_close_on_exec stdout_r; - let pid = Unix.create_process prog (Array.of_list (prog :: args)) stdin_r stdout_w stdout_w in - Unix.close stdin_r; - Unix.close stdout_w; - let proc = { pid = pid; id = prog ^ ":" ^ id; - inc = Unix.in_channel_of_descr stdout_r; - outc = Unix.out_channel_of_descr stdin_w; - stop_marker = stop_marker; - killed = false; - start_time = now()} in - (* print_string ("Started process " ^ proc.id ^ "\n" ^ (stack_dump())); *) - all_procs := proc :: !all_procs; - proc - -let start_process - (id: string) (prog: string) (args: string list) - (stop_marker: string -> bool) : proc = - start_process' id prog args (Some stop_marker) - -let rec waitpid_ignore_signals pid = - try ignore (Unix.waitpid [] pid) - with Unix.Unix_error (Unix.EINTR, _, _) -> - waitpid_ignore_signals pid - -let kill_process (p: proc) = - if not p.killed then begin - (* Close the fds directly: close_in and close_out both call `flush`, - potentially forcing us to wait until p starts reading again. They - might have been closed already (e.g. `run_process`), so we - just `attempt` it. *) - let attempt f = - try f () with | _ -> () - in - attempt (fun () -> Unix.close (Unix.descr_of_in_channel p.inc)); - attempt (fun () -> Unix.close (Unix.descr_of_out_channel p.outc)); - (try Unix.kill p.pid Sys.sigkill - with Unix.Unix_error (Unix.ESRCH, _, _) -> ()); - (* Avoid zombie processes (Unix.close_process does the same thing. *) - waitpid_ignore_signals p.pid; - (* print_string ("Killed process " ^ p.id ^ "\n" ^ (stack_dump())); *) - p.killed <- true - end - -let kill_all () = - BatList.iter kill_process !all_procs - -let process_read_all_output (p: proc) = - (* Pass cleanup:false because kill_process closes both fds already. *) - BatIO.read_all (BatIO.input_channel ~autoclose:true ~cleanup:false p.inc) - -(** Feed `stdin` to `p`, and call `reader_fn` in a separate thread to read the - response. - - Signal handling makes this function fairly hairy. The usual design is to - launch a reader thread, then write to the process on the main thread and use - `Thread.join` to wait for the reader to complete. - - When we get a signal, Caml routes it to either of the threads. If it - reaches the reader thread, we're good: the reader thread is most likely - waiting in input_line at that point, and input_line polls for signals fairly - frequently. If the signal reaches the writer (main) thread, on the other - hand, we're toast: `Thread.join` isn't interruptible, so Caml will save the - signal until the child thread exits and `join` returns, and at that point the - Z3 query is complete and the signal is useless. - - There are three possible solutions to this problem: - 1. Use an interruptible version of Thread.join written in C - 2. Ensure that signals are always delivered to the reader thread - 3. Use a different synchronization mechanism between the reader and the writer. - - Option 1 is bad because building F* doesn't currently require a C compiler. - Option 2 is easy to implement with `Unix.sigprocmask`, but that isn't - available on Windows. Option 3 is what the code below does: it uses a pipe - and a 1-byte write as a way for the writer thread to wait on the reader - thread. That's why `reader_fn` is passed a `signal_exit` function. - - If a SIGINT reaches the reader, it should still call `signal_exit`. If - a SIGINT reaches the writer, it should make sure that the reader exits. - These two things are the responsibility of the caller of this function. **) - -let process_read_async p stdin reader_fn = - let fd_r, fd_w = Unix.pipe () in - BatPervasives.finally (fun () -> Unix.close fd_w; Unix.close fd_r) - (fun () -> - let wait_for_exit () = - ignore (Unix.read fd_r (Bytes.create 1) 0 1) in - let signal_exit () = - try ignore (Unix.write fd_w (Bytes.create 1) 0 1) - with (* ‘write’ will fail if called after the finalizer above *) - | Unix.Unix_error (Unix.EBADF, _, _) -> () in - - let write_input = function - | Some str -> output_string p.outc str; flush p.outc - | None -> () in - - (* In the following we can get a signal at any point; it's the caller's - responsibility to ensure that reader_fn will exit in that case *) - let t = Thread.create reader_fn signal_exit in - write_input stdin; - wait_for_exit (); - Thread.join t) () - -let run_process (id: string) (prog: string) (args: string list) (stdin: string option): string = - let p = start_process' id prog args None in - (match stdin with - | None -> () - | Some str -> output_string p.outc str); - flush p.outc; - close_out p.outc; - process_read_all_output p - -type read_result = EOF | SIGINT - -let ask_process - (p: proc) (stdin: string) - (exn_handler: unit -> string): string = - let result = ref None in - let out = Buffer.create 16 in - let stop_marker = BatOption.default (fun s -> false) p.stop_marker in - - let reader_fn signal_fn = - let rec loop p out = - let line = BatString.trim (input_line p.inc) in (* raises EOF *) - if not (stop_marker line) then - (Buffer.add_string out (line ^ "\n"); loop p out) in - (try loop p out - with | SigInt -> result := Some SIGINT - | End_of_file -> result := Some EOF); - signal_fn () in - - try - process_read_async p (Some stdin) reader_fn; - (match !result with - | Some EOF -> kill_process p; Buffer.add_string out (exn_handler ()) - | Some SIGINT -> raise SigInt - | None -> ()); - Buffer.contents out - with e -> (* Ensure that reader_fn gets an EOF and exits *) - kill_process p; raise e - let get_file_extension (fn:string) : string = snd (BatString.rsplit fn ".") let is_path_absolute path_str = let open Batteries.Incubator in @@ -355,80 +157,80 @@ let set_symmetric_difference ((s1, eq):'a set) ((s2, _):'a set) : 'a set = let set_eq ((s1, eq):'a set) ((s2, _):'a set) : bool = set_is_empty (set_symmetric_difference (s1, eq) (s2, eq)) -module StringOps = - struct - type t = string - let equal (x:t) (y:t) = x=y - let compare (x:t) (y:t) = BatString.compare x y - let hash (x:t) = BatHashtbl.hash x - end - -module StringHashtbl = BatHashtbl.Make(StringOps) -module StringMap = BatMap.Make(StringOps) - -type 'value smap = 'value StringHashtbl.t -let smap_create (i:Z.t) : 'value smap = StringHashtbl.create (Z.to_int i) -let smap_clear (s:('value smap)) = StringHashtbl.clear s -let smap_add (m:'value smap) k (v:'value) = StringHashtbl.replace m k v -let smap_of_list (l: (string * 'value) list) = - let s = StringHashtbl.create (BatList.length l) in - FStar_List.iter (fun (x,y) -> smap_add s x y) l; - s -let smap_try_find (m:'value smap) k = StringHashtbl.find_option m k -let smap_fold (m:'value smap) f a = StringHashtbl.fold f m a -let smap_remove (m:'value smap) k = StringHashtbl.remove m k -let smap_keys (m:'value smap) = smap_fold m (fun k _ acc -> k::acc) [] -let smap_copy (m:'value smap) = StringHashtbl.copy m -let smap_size (m:'value smap) = StringHashtbl.length m -let smap_iter (m:'value smap) f = StringHashtbl.iter f m - -exception PSMap_Found -type 'value psmap = 'value StringMap.t -let psmap_empty (_: unit) : 'value psmap = StringMap.empty -let psmap_add (map: 'value psmap) (key: string) (value: 'value) = StringMap.add key value map -let psmap_find_default (map: 'value psmap) (key: string) (dflt: 'value) = - StringMap.find_default dflt key map -let psmap_try_find (map: 'value psmap) (key: string) = - StringMap.Exceptionless.find key map -let psmap_fold (m:'value psmap) f a = StringMap.fold f m a -let psmap_find_map (m:'value psmap) f = - let res = ref None in - let upd k v = - let r = f k v in - if r <> None then (res := r; raise PSMap_Found) in - (try StringMap.iter upd m with PSMap_Found -> ()); - !res -let psmap_modify (m: 'value psmap) (k: string) (upd: 'value option -> 'value) = - StringMap.modify_opt k (fun vopt -> Some (upd vopt)) m - -let psmap_merge (m1: 'value psmap) (m2: 'value psmap) : 'value psmap = - psmap_fold m1 (fun k v m -> psmap_add m k v) m2 - -module ZHashtbl = BatHashtbl.Make(Z) -module ZMap = BatMap.Make(Z) - -type 'value imap = 'value ZHashtbl.t -let imap_create (i:Z.t) : 'value imap = ZHashtbl.create (Z.to_int i) -let imap_clear (s:('value imap)) = ZHashtbl.clear s -let imap_add (m:'value imap) k (v:'value) = ZHashtbl.replace m k v -let imap_of_list (l: (Z.t * 'value) list) = - let s = ZHashtbl.create (BatList.length l) in - FStar_List.iter (fun (x,y) -> imap_add s x y) l; - s -let imap_try_find (m:'value imap) k = ZHashtbl.find_option m k -let imap_fold (m:'value imap) f a = ZHashtbl.fold f m a -let imap_remove (m:'value imap) k = ZHashtbl.remove m k -let imap_keys (m:'value imap) = imap_fold m (fun k _ acc -> k::acc) [] -let imap_copy (m:'value imap) = ZHashtbl.copy m - -type 'value pimap = 'value ZMap.t -let pimap_empty (_: unit) : 'value pimap = ZMap.empty -let pimap_add (map: 'value pimap) (key: Z.t) (value: 'value) = ZMap.add key value map -let pimap_find_default (map: 'value pimap) (key: Z.t) (dflt: 'value) = - ZMap.find_default dflt key map -let pimap_try_find (map: 'value pimap) (key: Z.t) = - ZMap.Exceptionless.find key map -let pimap_fold (m:'value pimap) f a = ZMap.fold f m a +(* module StringOps = *) +(* struct *) +(* type t = string *) +(* let equal (x:t) (y:t) = x=y *) +(* let compare (x:t) (y:t) = BatString.compare x y *) +(* let hash (x:t) = BatHashtbl.hash x *) +(* end *) + +(* module StringHashtbl = BatHashtbl.Make(StringOps) *) +(* module StringMap = BatMap.Make(StringOps) *) + +(* type 'value smap = 'value StringHashtbl.t *) +(* let smap_create (i:Z.t) : 'value smap = StringHashtbl.create (Z.to_int i) *) +(* let smap_clear (s:('value smap)) = StringHashtbl.clear s *) +(* let smap_add (m:'value smap) k (v:'value) = StringHashtbl.replace m k v *) +(* let smap_of_list (l: (string * 'value) list) = *) +(* let s = StringHashtbl.create (BatList.length l) in *) +(* FStar_List.iter (fun (x,y) -> smap_add s x y) l; *) +(* s *) +(* let smap_try_find (m:'value smap) k = StringHashtbl.find_option m k *) +(* let smap_fold (m:'value smap) f a = StringHashtbl.fold f m a *) +(* let smap_remove (m:'value smap) k = StringHashtbl.remove m k *) +(* let smap_keys (m:'value smap) = smap_fold m (fun k _ acc -> k::acc) [] *) +(* let smap_copy (m:'value smap) = StringHashtbl.copy m *) +(* let smap_size (m:'value smap) = StringHashtbl.length m *) +(* let smap_iter (m:'value smap) f = StringHashtbl.iter f m *) + +(* exception PSMap_Found *) +(* type 'value psmap = 'value StringMap.t *) +(* let psmap_empty (_: unit) : 'value psmap = StringMap.empty *) +(* let psmap_add (map: 'value psmap) (key: string) (value: 'value) = StringMap.add key value map *) +(* let psmap_find_default (map: 'value psmap) (key: string) (dflt: 'value) = *) +(* StringMap.find_default dflt key map *) +(* let psmap_try_find (map: 'value psmap) (key: string) = *) +(* StringMap.Exceptionless.find key map *) +(* let psmap_fold (m:'value psmap) f a = StringMap.fold f m a *) +(* let psmap_find_map (m:'value psmap) f = *) +(* let res = ref None in *) +(* let upd k v = *) +(* let r = f k v in *) +(* if r <> None then (res := r; raise PSMap_Found) in *) +(* (try StringMap.iter upd m with PSMap_Found -> ()); *) +(* !res *) +(* let psmap_modify (m: 'value psmap) (k: string) (upd: 'value option -> 'value) = *) +(* StringMap.modify_opt k (fun vopt -> Some (upd vopt)) m *) + +(* let psmap_merge (m1: 'value psmap) (m2: 'value psmap) : 'value psmap = *) +(* psmap_fold m1 (fun k v m -> psmap_add m k v) m2 *) + +(* module ZHashtbl = BatHashtbl.Make(Z) *) +(* module ZMap = BatMap.Make(Z) *) + +(* type 'value imap = 'value ZHashtbl.t *) +(* let imap_create (i:Z.t) : 'value imap = ZHashtbl.create (Z.to_int i) *) +(* let imap_clear (s:('value imap)) = ZHashtbl.clear s *) +(* let imap_add (m:'value imap) k (v:'value) = ZHashtbl.replace m k v *) +(* let imap_of_list (l: (Z.t * 'value) list) = *) +(* let s = ZHashtbl.create (BatList.length l) in *) +(* FStar_List.iter (fun (x,y) -> imap_add s x y) l; *) +(* s *) +(* let imap_try_find (m:'value imap) k = ZHashtbl.find_option m k *) +(* let imap_fold (m:'value imap) f a = ZHashtbl.fold f m a *) +(* let imap_remove (m:'value imap) k = ZHashtbl.remove m k *) +(* let imap_keys (m:'value imap) = imap_fold m (fun k _ acc -> k::acc) [] *) +(* let imap_copy (m:'value imap) = ZHashtbl.copy m *) + +(* type 'value pimap = 'value ZMap.t *) +(* let pimap_empty (_: unit) : 'value pimap = ZMap.empty *) +(* let pimap_add (map: 'value pimap) (key: Z.t) (value: 'value) = ZMap.add key value map *) +(* let pimap_find_default (map: 'value pimap) (key: Z.t) (dflt: 'value) = *) +(* ZMap.find_default dflt key map *) +(* let pimap_try_find (map: 'value pimap) (key: Z.t) = *) +(* ZMap.Exceptionless.find key map *) +(* let pimap_fold (m:'value pimap) f a = ZMap.fold f m a *) (* restore pre-2.11 BatString.nsplit behavior, see https://github.com/ocaml-batteries-team/batteries-included/issues/845 *) @@ -563,7 +365,7 @@ let replace_char (s:string) c1 c2 = BatUTF8.map (fun x -> if x = c1 then c2 else x) s let replace_chars (s:string) c (by:string) = BatString.replace_chars (fun x -> if x = Char.chr c then by else BatString.of_char x) s -let hashcode s = Z.of_int (StringOps.hash s) +(* let hashcode s = Z.of_int (StringOps.hash s) *) let compare s1 s2 = Z.of_int (BatString.compare s1 s2) let split s sep = BatString.split_on_string sep s let splitlines s = split s "\n" @@ -631,14 +433,6 @@ let remove_dups f l = | _ -> out in aux [] l -let is_none = function - | None -> true - | Some _ -> false - -let is_some = function - | None -> false - | Some _ -> true - let must = function | Some x -> x | None -> failwith "Empty option" @@ -647,86 +441,20 @@ let dflt x = function | None -> x | Some x -> x -let find_opt f l = - let rec aux = function - | [] -> None - | hd::tl -> if f hd then Some hd else aux tl in - aux l - -(* JP: why so many duplicates? :'( *) -let sort_with = FStar_List.sortWith - let bind_opt opt f = match opt with | None -> None | Some x -> f x -let catch_opt opt f = - match opt with - | Some x -> opt - | None -> f () - let map_opt opt f = match opt with | None -> None | Some x -> Some (f x) -let iter_opt opt f = - ignore (map_opt opt f) - -let rec find_map l f = - match l with - | [] -> None - | x::tl -> - match f x with - | None -> find_map tl f - | y -> y - let try_find f l = BatList.find_opt f l -let try_find_index f l = - let rec aux i = function - | [] -> None - | hd::tl -> if f hd then Some (Z.of_int i) else aux (i+1) tl in - aux 0 l - -let fold_map f state s = - let fold (state, acc) x = - let state, v = f state x in (state, v :: acc) in - let (state, rs) = BatList.fold_left fold (state, []) s in - (state, BatList.rev rs) - -let choose_map f state s = - let fold (state, acc) x = - match f state x with - | state, None -> (state, acc) - | state, Some v -> (state, v :: acc) in - let (state, rs) = BatList.fold_left fold (state, []) s in - (state, BatList.rev rs) - let for_all f l = BatList.for_all f l let for_some f l = BatList.exists f l -let forall_exists rel l1 l2 = - for_all (fun x -> for_some (rel x) l2) l1 -let multiset_equiv rel l1 l2 = - BatList.length l1 = BatList.length l2 && forall_exists rel l1 l2 -let take p l = - let rec take_aux acc = function - | [] -> l, [] - | x::xs when p x -> take_aux (x::acc) xs - | x::xs -> List.rev acc, x::xs - in take_aux [] l - -let rec fold_flatten f acc l = - match l with - | [] -> acc - | x :: xs -> let acc, xs' = f acc x in fold_flatten f acc (xs' @ xs) - -let add_unique f x l = - if for_some (f x) l then - l - else - x::l let first_N n l = let n = Z.to_int n in @@ -749,528 +477,4 @@ let prefix l = | hd::tl -> BatList.rev tl, hd | _ -> failwith "impossible" -let prefix_until f l = - let rec aux prefix = function - | [] -> None - | hd::tl -> - if f hd then Some (BatList.rev prefix, hd, tl) - else aux (hd::prefix) tl in - aux [] l - -let string_to_ascii_bytes (s:string) : char array = - BatArray.of_list (BatString.explode s) -let ascii_bytes_to_string (b:char array) : string = - BatString.implode (BatArray.to_list b) -let mk_ref a = FStar_ST.alloc a - -(* A simple state monad *) -type ('s,'a) state = 's -> ('a*'s) -let get : ('s,'s) state = fun s -> (s,s) -let upd (f:'s -> 's) : ('s,unit) state = fun s -> ((), f s) -let put (s:'s) : ('s,unit) state = fun _ -> ((), s) -let ret (x:'a) : ('s,'a) state = fun s -> (x, s) -let bind (sa:('s,'a) state) (f : 'a -> ('s,'b) state) : ('s,'b) state = - fun s1 -> let (a, s2) = sa s1 in f a s2 -let (>>) s f = bind s f -let run_st init (s:('s,'a) state) = s init - -let rec stmap (l:'a list) (f: 'a -> ('s,'b) state) : ('s, ('b list)) state = - match l with - | [] -> ret [] - | hd::tl -> bind (f hd) - (fun b -> - let stl = stmap tl f in - bind stl (fun tl -> ret (b::tl))) - -let stmapi (l:'a list) (f:int -> 'a -> ('s, 'b) state) : ('s, ('b list)) state = - let rec aux i l = - match l with - | [] -> ret [] - | hd::tl -> - bind (f i hd) - (fun b -> - let stl = aux (i + 1) tl in - bind stl (fun tl -> ret (b::tl))) in - aux 0 l - -let rec stiter (l:'a list) (f: 'a -> ('s,unit) state) : ('s,unit) state = - match l with - | [] -> ret () - | hd::tl -> bind (f hd) (fun () -> stiter tl f) - -let rec stfoldr_pfx (l:'a list) (f: 'a list -> 'a -> ('s,unit) state) : ('s,unit) state = - match l with - | [] -> ret () - | hd::tl -> (stfoldr_pfx tl f) >> (fun _ -> f tl hd) - -let rec stfold (init:'b) (l:'a list) (f: 'b -> 'a -> ('s,'b) state) : ('s,'b) state = - match l with - | [] -> ret init - | hd::tl -> (f init hd) >> (fun next -> stfold next tl f) - -type file_handle = out_channel -let open_file_for_writing (fn:string) : file_handle = open_out_bin fn -let append_to_file (fh:file_handle) s = fpr fh "%s\n" s; flush fh -let close_file (fh:file_handle) = close_out fh -let write_file (fn:string) s = - let fh = open_file_for_writing fn in - append_to_file fh s; - close_file fh -let copy_file input_name output_name = - (* see https://ocaml.github.io/ocamlunix/ocamlunix.html#sec33 *) - let open Unix in - let buffer_size = 8192 in - let buffer = Bytes.create buffer_size in - let fd_in = openfile input_name [O_RDONLY] 0 in - let fd_out = openfile output_name [O_WRONLY; O_CREAT; O_TRUNC] 0o666 in - let rec copy_loop () = - match read fd_in buffer 0 buffer_size with - | 0 -> () - | r -> ignore (write fd_out buffer 0 r); copy_loop () - in - copy_loop (); - close fd_in; - close fd_out -let flush_file (fh:file_handle) = flush fh -let delete_file (fn:string) = Sys.remove fn -let file_get_contents f = - let ic = open_in_bin f in - let l = in_channel_length ic in - let s = really_input_string ic l in - close_in ic; - s -let file_get_lines f = - let ic = open_in f in - let rec aux accu = - let l = - try - Some (input_line ic) - with - | End_of_file -> None - in - match l with - | None -> accu - | Some l -> aux (l::accu) - in - let l = aux [] in - close_in ic; - List.rev l -let concat_dir_filename d f = Filename.concat d f -let mkdir clean nm = - let remove_all_in_dir nm = - let open Sys in - Array.iter remove (Array.map (concat_dir_filename nm) (readdir nm)) in - let open Unix in - (match Sys.os_type with - | "Unix" -> ignore (umask 0o002) - | _ -> (* unimplemented*) ()); - try mkdir nm 0o777 - with Unix_error (EEXIST,_,_) -> - if clean then remove_all_in_dir nm - -let for_range lo hi f = - for i = Z.to_int lo to Z.to_int hi do - f (Z.of_int i) - done - - -let incr r = FStar_ST.(Z.(write r (read r + one))) -let decr r = FStar_ST.(Z.(write r (read r - one))) -let geq (i:int) (j:int) = i >= j - -let get_exec_dir () = Filename.dirname (Sys.executable_name) -let expand_environment_variable x = try Some (Sys.getenv x) with Not_found -> None - -let physical_equality (x:'a) (y:'a) = x == y -let check_sharing a b msg = if physical_equality a b then print1 "Sharing OK: %s\n" msg else print1 "Sharing broken in %s\n" msg - -type oWriter = { - write_byte: char -> unit; - write_bool: bool -> unit; - write_int: int -> unit; - write_int32: int32 -> unit; - write_int64: int64 -> unit; - write_char: char -> unit; - write_double: float -> unit; - write_bytearray: char array -> unit; - write_string: string -> unit; - - close: unit -> unit -} - -type oReader = { - read_byte: unit -> char; - read_bool: unit -> bool; - read_int: unit -> int; - read_int32: unit -> int32; - read_int64: unit -> int64; - read_char: unit -> char; - read_double: unit -> float; - read_bytearray: unit -> char array; - read_string: unit -> string; - - close: unit -> unit -} - -module MkoReader = struct - let read_byte r x = r.read_byte x - let read_bool r x = r.read_bool x - let read_int r x = r.read_int32 x - let read_int32 r x = r.read_int32 x - let read_int64 r x = r.read_int64 x - let read_char r x = r.read_char x - let read_double r x = r.read_double x - let read_bytearray r x = r.read_bytearray x - let read_string r x = r.read_string x - - let close r x = r.close x -end - -module MkoWriter = struct - let write_byte w x = w.write_byte x - let write_bool w x = w.write_bool x - let write_int w x = w.write_int32 x - let write_int32 w x = w.write_int32 x - let write_int64 w x = w.write_int64 x - let write_char w x = w.write_char x - let write_double w x = w.write_double x - let write_bytearray w x = w.write_bytearray x - let write_string w x = w.write_string x - - let close w x = w.close x -end - -(* - * TODO: these functions need to be filled in - *) -let get_owriter (filename:string) : oWriter = { - write_byte = (fun _ -> ()); - write_bool = (fun _ -> ()); - write_int = (fun _ -> ()); - write_int32 = (fun _ -> ()); - write_int64 = (fun _ -> ()); - write_char = (fun _ -> ()); - write_double = (fun _ -> ()); - write_bytearray = (fun _ -> ()); - write_string = (fun _ -> ()); - - close = (fun _ -> ()); -} - -let get_oreader (filename:string) : oReader = { - read_byte = (fun _ -> 'a'); - read_bool = (fun _ -> true); - read_int = (fun _ -> 0); - read_int32 = (fun _ -> failwith "NYI"); - read_int64 = (fun _ -> 0L); - read_char = (fun _ -> 'a'); - read_double = (fun _ -> 0.0); - read_bytearray = (fun _ -> [||]); - read_string = (fun _ -> ""); - - close = (fun _ -> ()); -} - -let getcwd = Sys.getcwd - -let readdir dir = "." :: ".." :: Array.to_list (Sys.readdir dir) - -let paths_to_same_file f g = - let open Unix in - let { st_dev = i; st_ino = j } = stat f in - let { st_dev = i'; st_ino = j' } = stat g in - (i,j) = (i',j') - -let file_exists = Sys.file_exists -(* Sys.is_directory raises Sys_error if the path does not exist *) -let is_directory f = Sys.file_exists f && Sys.is_directory f - - -let basename = Filename.basename -let dirname = Filename.dirname -let print_endline = print_endline - -let map_option f opt = BatOption.map f opt - -let save_value_to_file (fname:string) value = - (* BatFile.with_file_out uses Unix.openfile (which isn't available in - js_of_ocaml) instead of Pervasives.open_out, so we don't use it here. *) - let channel = open_out_bin fname in - BatPervasives.finally - (fun () -> close_out channel) - (fun channel -> output_value channel value) - channel - -let load_value_from_file (fname:string) = - (* BatFile.with_file_in uses Unix.openfile (which isn't available in - js_of_ocaml) instead of Pervasives.open_in, so we don't use it here. *) - try - let channel = open_in_bin fname in - BatPervasives.finally - (fun () -> close_in channel) - (fun channel -> Some (input_value channel)) - channel - with | _ -> None - -let save_2values_to_file (fname:string) value1 value2 = - try - let channel = open_out_bin fname in - BatPervasives.finally - (fun () -> close_out channel) - (fun channel -> - output_value channel value1; - output_value channel value2) - channel - with - | e -> delete_file fname; - raise e - -let load_2values_from_file (fname:string) = - try - let channel = open_in_bin fname in - BatPervasives.finally - (fun () -> close_in channel) - (fun channel -> - let v1 = input_value channel in - let v2 = input_value channel in - Some (v1, v2)) - channel - with | _ -> None - -let print_exn e = - Printexc.to_string e - -let digest_of_file = - let cache = smap_create (Z.of_int 101) in - fun (fname:string) -> - match smap_try_find cache fname with - | Some dig -> dig - | None -> - let dig = BatDigest.file fname in - smap_add cache fname dig; - dig - -let digest_of_string (s:string) = - BatDigest.to_hex (BatDigest.string s) - -(* Precondition: file exists *) -let touch_file (fname:string) : unit = - (* Sets access and modification times to current time *) - Unix.utimes fname 0.0 0.0 - -let ensure_decimal s = Z.to_string (Z.of_string s) - -let measure_execution_time tag f = - let t = Sys.time () in - let retv = f () in - print2 "Execution time of %s: %s ms\n" tag (string_of_float (1000.0 *. (Sys.time() -. t))); - retv - -let return_execution_time f = - let t1 = Sys.time () in - let retv = f () in - let t2 = Sys.time () in - (retv, 1000.0 *. (t2 -. t1)) - -(** Hints. *) -type hint = { - hint_name:string; - hint_index:Z.t; - fuel:Z.t; - ifuel:Z.t; - unsat_core:string list option; - query_elapsed_time:Z.t; - hash:string option -} - -type hints = hint option list - -type hints_db = { - module_digest:string; - hints: hints -} - -type hints_read_result = - | HintsOK of hints_db - | MalformedJson - | UnableToOpen - -let write_hints (filename: string) (hints: hints_db): unit = - let json = `List [ - `String hints.module_digest; - `List (List.map (function - | None -> `Null - | Some { hint_name; hint_index; fuel; ifuel; unsat_core; query_elapsed_time; hash } -> - `List [ - `String hint_name; - `Int (Z.to_int hint_index); - `Int (Z.to_int fuel); - `Int (Z.to_int ifuel); - (match unsat_core with - | None -> `Null - | Some strings -> - `List (List.map (fun s -> `String s) strings)); - `Int (Z.to_int query_elapsed_time); - `String (match hash with | Some(h) -> h | _ -> "") - ] - ) hints.hints) - ] in - let channel = open_out_bin filename in - BatPervasives.finally - (fun () -> close_out channel) - (fun channel -> Yojson.Safe.pretty_to_channel channel json) - channel - -let read_hints (filename: string) : hints_read_result = - let mk_hint nm ix fuel ifuel unsat_core time hash_opt = { - hint_name = nm; - hint_index = Z.of_int ix; - fuel = Z.of_int fuel; - ifuel = Z.of_int ifuel; - unsat_core = begin - match unsat_core with - | `Null -> - None - | `List strings -> - Some (List.map (function - | `String s -> s - | _ -> raise Exit) - strings) - | _ -> - raise Exit - end; - query_elapsed_time = Z.of_int time; - hash = hash_opt - } - in - try - let chan = open_in filename in - let json = Yojson.Safe.from_channel chan in - close_in chan; - HintsOK ( - match json with - | `List [ - `String module_digest; - `List hints - ] -> { - module_digest; - hints = List.map (function - | `Null -> None - | `List [ `String hint_name; - `Int hint_index; - `Int fuel; - `Int ifuel; - unsat_core; - `Int query_elapsed_time ] -> - (* This case is for dealing with old-style hint files - that lack a query-hashes field. We should remove this - case once we definitively remove support for old hints *) - Some (mk_hint hint_name hint_index fuel ifuel unsat_core query_elapsed_time None) - | `List [ `String hint_name; - `Int hint_index; - `Int fuel; - `Int ifuel; - unsat_core; - `Int query_elapsed_time; - `String hash ] -> - let hash_opt = if hash <> "" then Some(hash) else None in - Some (mk_hint hint_name hint_index fuel ifuel unsat_core query_elapsed_time hash_opt) - | _ -> - raise Exit - ) hints - } - | _ -> - raise Exit - ) - with - | Exit -> - MalformedJson - | Sys_error _ -> - UnableToOpen - -(** Interactive protocol **) - -exception UnsupportedJson - -let json_of_yojson yjs: json option = - let rec aux yjs = - match yjs with - | `Null -> JsonNull - | `Bool b -> JsonBool b - | `Int i -> JsonInt (Z.of_int i) - | `String s -> JsonStr s - | `List l -> JsonList (List.map aux l) - | `Assoc a -> JsonAssoc (List.map (fun (k, v) -> (k, aux v)) a) - | _ -> raise UnsupportedJson in - try Some (aux yjs) with UnsupportedJson -> None - -let rec yojson_of_json js = - match js with - | JsonNull -> `Null - | JsonBool b -> `Bool b - | JsonInt i -> `Int (Z.to_int i) - | JsonStr s -> `String s - | JsonList l -> `List (List.map yojson_of_json l) - | JsonAssoc a -> `Assoc (List.map (fun (k, v) -> (k, yojson_of_json v)) a) - -let json_of_string str : json option = - let open Yojson.Basic in - try - json_of_yojson (Yojson.Basic.from_string str) - with Yojson.Json_error _ -> None - -let string_of_json json = - Yojson.Basic.to_string (yojson_of_json json) - -(* Outside of this file the reference to FStar_Util.ref must use the following combinators *) -(* Export it at the end of the file so that we don't break other internal uses of ref *) -type 'a ref = 'a FStar_Monotonic_Heap.ref -let read = FStar_ST.read -let write = FStar_ST.write -let (!) = FStar_ST.read -let (:=) = FStar_ST.write - -let marshal (x:'a) : string = Marshal.to_string x [] -let unmarshal (x:string) : 'a = Marshal.from_string x 0 - -type signedness = | Unsigned | Signed -type width = | Int8 | Int16 | Int32 | Int64 - -let rec z_pow2 n = - if n = Z.zero then Z.one - else Z.mul (Z.of_string "2") (z_pow2 (Z.sub n Z.one)) - -let bounds signedness width = - let n = - match width with - | Int8 -> Z.of_string "8" - | Int16 -> Z.of_string "16" - | Int32 -> Z.of_string "32" - | Int64 -> Z.of_string "64" - in - let lower, upper = - match signedness with - | Unsigned -> - Z.zero, Z.sub (z_pow2 n) Z.one - | Signed -> - let upper = z_pow2 (Z.sub n Z.one) in - Z.neg upper, Z.sub upper Z.one - in - lower, upper - -let within_bounds repr signedness width = - let lower, upper = bounds signedness width in - let value = Z.of_string (ensure_decimal repr) in - Z.leq lower value && Z.leq value upper - -let print_array (f: 'a -> string) - (s: 'a array) - : string - = let ls = Array.fold_left (fun out a -> f a :: out) [] s in - format1 "[| %s |]" (String.concat "; " (List.rev ls)) - -let array_of_list (l:'a list) = FStar_ImmutableArray_Base.of_list l - -let array_length (l:'a FStar_ImmutableArray_Base.t) = FStar_ImmutableArray_Base.length l - -let array_index (l:'a FStar_ImmutableArray_Base.t) (i:Z.t) = FStar_ImmutableArray_Base.index l i +let mk_ref a = ref a diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Const.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Const.ml index a1fcff708..5223a3acf 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Const.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Const.ml @@ -2,26 +2,12 @@ open Prims type signedness = | Unsigned | Signed [@@deriving yojson,show] -let (uu___is_Unsigned : signedness -> Prims.bool) = - fun projectee -> match projectee with | Unsigned -> true | uu___ -> false -let (uu___is_Signed : signedness -> Prims.bool) = - fun projectee -> match projectee with | Signed -> true | uu___ -> false type width = | Int8 | Int16 | Int32 | Int64 | Sizet [@@deriving yojson,show] -let (uu___is_Int8 : width -> Prims.bool) = - fun projectee -> match projectee with | Int8 -> true | uu___ -> false -let (uu___is_Int16 : width -> Prims.bool) = - fun projectee -> match projectee with | Int16 -> true | uu___ -> false -let (uu___is_Int32 : width -> Prims.bool) = - fun projectee -> match projectee with | Int32 -> true | uu___ -> false -let (uu___is_Int64 : width -> Prims.bool) = - fun projectee -> match projectee with | Int64 -> true | uu___ -> false -let (uu___is_Sizet : width -> Prims.bool) = - fun projectee -> match projectee with | Sizet -> true | uu___ -> false type sconst = | Const_effect | Const_unit @@ -36,61 +22,6 @@ type sconst = | Const_range of FStar_Compiler_Range.range | Const_reify of FStar_Ident.lid FStar_Pervasives_Native.option | Const_reflect of FStar_Ident.lid [@@deriving yojson,show] -let (uu___is_Const_effect : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_effect -> true | uu___ -> false -let (uu___is_Const_unit : sconst -> Prims.bool) = - fun projectee -> match projectee with | Const_unit -> true | uu___ -> false -let (uu___is_Const_bool : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_bool _0 -> true | uu___ -> false -let (__proj__Const_bool__item___0 : sconst -> Prims.bool) = - fun projectee -> match projectee with | Const_bool _0 -> _0 -let (uu___is_Const_int : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_int _0 -> true | uu___ -> false -let (__proj__Const_int__item___0 : - sconst -> - (Prims.string * (signedness * width) FStar_Pervasives_Native.option)) - = fun projectee -> match projectee with | Const_int _0 -> _0 -let (uu___is_Const_char : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_char _0 -> true | uu___ -> false -let (__proj__Const_char__item___0 : sconst -> FStar_BaseTypes.char) = - fun projectee -> match projectee with | Const_char _0 -> _0 -let (uu___is_Const_real : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_real _0 -> true | uu___ -> false -let (__proj__Const_real__item___0 : sconst -> Prims.string) = - fun projectee -> match projectee with | Const_real _0 -> _0 -let (uu___is_Const_string : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_string _0 -> true | uu___ -> false -let (__proj__Const_string__item___0 : - sconst -> (Prims.string * FStar_Compiler_Range.range)) = - fun projectee -> match projectee with | Const_string _0 -> _0 -let (uu___is_Const_range_of : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_range_of -> true | uu___ -> false -let (uu___is_Const_set_range_of : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_set_range_of -> true | uu___ -> false -let (uu___is_Const_range : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_range _0 -> true | uu___ -> false -let (__proj__Const_range__item___0 : sconst -> FStar_Compiler_Range.range) = - fun projectee -> match projectee with | Const_range _0 -> _0 -let (uu___is_Const_reify : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_reify _0 -> true | uu___ -> false -let (__proj__Const_reify__item___0 : - sconst -> FStar_Ident.lid FStar_Pervasives_Native.option) = - fun projectee -> match projectee with | Const_reify _0 -> _0 -let (uu___is_Const_reflect : sconst -> Prims.bool) = - fun projectee -> - match projectee with | Const_reflect _0 -> true | uu___ -> false -let (__proj__Const_reflect__item___0 : sconst -> FStar_Ident.lid) = - fun projectee -> match projectee with | Const_reflect _0 -> _0 let (eq_const : sconst -> sconst -> Prims.bool) = fun c1 -> fun c2 -> @@ -103,46 +34,3 @@ let (eq_const : sconst -> sconst -> Prims.bool) = | (Const_reflect l1, Const_reflect l2) -> FStar_Ident.lid_equals l1 l2 | (Const_reify uu___, Const_reify uu___1) -> true | uu___ -> c1 = c2 -let rec (pow2 : FStar_BigInt.bigint -> FStar_BigInt.bigint) = - fun x -> - let uu___ = FStar_BigInt.eq_big_int x FStar_BigInt.zero in - if uu___ - then FStar_BigInt.one - else - (let uu___2 = let uu___3 = FStar_BigInt.pred_big_int x in pow2 uu___3 in - FStar_BigInt.mult_big_int FStar_BigInt.two uu___2) -let (bounds : - signedness -> width -> (FStar_BigInt.bigint * FStar_BigInt.bigint)) = - fun signedness1 -> - fun width1 -> - let n = - match width1 with - | Int8 -> FStar_BigInt.big_int_of_string "8" - | Int16 -> FStar_BigInt.big_int_of_string "16" - | Int32 -> FStar_BigInt.big_int_of_string "32" - | Int64 -> FStar_BigInt.big_int_of_string "64" - | Sizet -> FStar_BigInt.big_int_of_string "16" in - let uu___ = - match signedness1 with - | Unsigned -> - let uu___1 = - let uu___2 = pow2 n in FStar_BigInt.pred_big_int uu___2 in - (FStar_BigInt.zero, uu___1) - | Signed -> - let upper = - let uu___1 = FStar_BigInt.pred_big_int n in pow2 uu___1 in - let uu___1 = FStar_BigInt.minus_big_int upper in - let uu___2 = FStar_BigInt.pred_big_int upper in (uu___1, uu___2) in - match uu___ with | (lower, upper) -> (lower, upper) -let (within_bounds : Prims.string -> signedness -> width -> Prims.bool) = - fun repr -> - fun signedness1 -> - fun width1 -> - let uu___ = bounds signedness1 width1 in - match uu___ with - | (lower, upper) -> - let value = - let uu___1 = FStar_Compiler_Util.ensure_decimal repr in - FStar_BigInt.big_int_of_string uu___1 in - (FStar_BigInt.le_big_int lower value) && - (FStar_BigInt.le_big_int value upper) \ No newline at end of file diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Errors.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Errors.ml index 461ed330e..043b26699 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Errors.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Errors.ml @@ -228,15 +228,7 @@ exception Empty_frag let (uu___is_Empty_frag : Prims.exn -> Prims.bool) = fun projectee -> match projectee with | Empty_frag -> true | uu___ -> false let (ctx_string : Prims.string Prims.list -> Prims.string) = - fun ctx -> - let uu___ = FStar_Options.error_contexts () in - if uu___ - then - let uu___1 = - FStar_Compiler_Effect.op_Bar_Greater ctx - (FStar_Compiler_List.map (fun s -> FStar_String.op_Hat "\n> " s)) in - FStar_Compiler_Effect.op_Bar_Greater uu___1 (FStar_String.concat "") - else "" + fun ctx -> "" let (issue_message : issue -> Prims.string) = fun i -> let uu___ = ctx_string i.issue_ctx in @@ -335,13 +327,12 @@ let (mk_default_handler : Prims.bool -> error_handler) = else (); (match e.issue_level with | EInfo -> print_issue e - | uu___2 when print && (FStar_Options.debug_any ()) -> print_issue e | uu___2 -> let uu___3 = let uu___4 = FStar_Compiler_Effect.op_Bang issues in e :: uu___4 in FStar_Compiler_Effect.op_Colon_Equals issues uu___3); (let uu___3 = - (FStar_Options.defensive_abort ()) && + (false) && (e.issue_number = (FStar_Pervasives_Native.Some defensive_errno)) in if uu___3 then failwith "Aborting due to --defensive abort" else ()) in let count_errors uu___ = FStar_Compiler_Effect.op_Bang err_count in @@ -394,30 +385,15 @@ let (wrapped_eh_add_one : error_handler -> issue -> unit) = fun h -> fun issue1 -> h.eh_add_one issue1; - if issue1.issue_level <> EInfo - then - ((let uu___2 = - let uu___3 = - FStar_Compiler_Effect.op_Bang FStar_Options.abort_counter in - uu___3 - Prims.int_one in - FStar_Compiler_Effect.op_Colon_Equals FStar_Options.abort_counter - uu___2); - (let uu___2 = - let uu___3 = - FStar_Compiler_Effect.op_Bang FStar_Options.abort_counter in - uu___3 = Prims.int_zero in - if uu___2 then failwith "Aborting due to --abort_on" else ())) - else () + () let (add_one : issue -> unit) = fun issue1 -> - FStar_Compiler_Util.atomically - (fun uu___ -> + ( let uu___1 = FStar_Compiler_Effect.op_Bang current_handler in wrapped_eh_add_one uu___1 issue1) let (add_many : issue Prims.list -> unit) = fun issues -> - FStar_Compiler_Util.atomically - (fun uu___ -> + ( let uu___1 = let uu___2 = FStar_Compiler_Effect.op_Bang current_handler in wrapped_eh_add_one uu___2 in @@ -483,8 +459,7 @@ let (get_ctx : unit -> Prims.string Prims.list) = let (diag : FStar_Compiler_Range.range -> Prims.string -> unit) = fun r -> fun msg -> - let uu___ = FStar_Options.debug_any () in - if uu___ + if false then add_one (mk_issue EInfo (FStar_Pervasives_Native.Some r) msg @@ -495,72 +470,28 @@ let (warn_unsafe_options : Prims.string -> unit) = fun rng_opt -> - fun msg -> - let uu___ = FStar_Options.report_assumes () in - match uu___ with - | FStar_Pervasives_Native.Some "warn" -> - let uu___1 = - let uu___2 = - FStar_String.op_Hat - "Every use of this option triggers a warning: " msg in - mk_issue EWarning rng_opt uu___2 - (FStar_Pervasives_Native.Some warn_on_use_errno) [] in - add_one uu___1 - | FStar_Pervasives_Native.Some "error" -> - let uu___1 = - let uu___2 = - FStar_String.op_Hat - "Every use of this option triggers an error: " msg in - mk_issue EError rng_opt uu___2 - (FStar_Pervasives_Native.Some warn_on_use_errno) [] in - add_one uu___1 - | uu___1 -> () + fun msg -> () let (set_option_warning_callback_range : FStar_Compiler_Range.range FStar_Pervasives_Native.option -> unit) = fun ropt -> - FStar_Options.set_option_warning_callback (warn_unsafe_options ropt) + () + (* FStar_Options.set_option_warning_callback (warn_unsafe_options ropt) *) let (uu___279 : (((Prims.string -> FStar_Errors_Codes.error_setting Prims.list) -> unit) * (unit -> FStar_Errors_Codes.error_setting Prims.list))) = let parser_callback = FStar_Compiler_Util.mk_ref FStar_Pervasives_Native.None in - let error_flags = FStar_Compiler_Util.smap_create (Prims.of_int (10)) in - let set_error_flags uu___ = - let parse s = - let uu___1 = FStar_Compiler_Effect.op_Bang parser_callback in - match uu___1 with - | FStar_Pervasives_Native.None -> - failwith "Callback for parsing warn_error strings is not set" - | FStar_Pervasives_Native.Some f -> f s in - let we = FStar_Options.warn_error () in - try - (fun uu___1 -> - match () with - | () -> - let r = parse we in - (FStar_Compiler_Util.smap_add error_flags we - (FStar_Pervasives_Native.Some r); - FStar_Getopt.Success)) () - with - | Invalid_warn_error_setting msg -> - (FStar_Compiler_Util.smap_add error_flags we - FStar_Pervasives_Native.None; - (let uu___3 = - FStar_String.op_Hat "Invalid --warn_error setting: " msg in - FStar_Getopt.Error uu___3)) in + (* let error_flags = FStar_Compiler_Util.smap_create (Prims.of_int (10)) in *) + let set_error_flags uu___ = () in let get_error_flags uu___ = - let we = FStar_Options.warn_error () in - let uu___1 = FStar_Compiler_Util.smap_try_find error_flags we in - match uu___1 with - | FStar_Pervasives_Native.Some (FStar_Pervasives_Native.Some w) -> w - | uu___2 -> FStar_Errors_Codes.default_settings in + FStar_Errors_Codes.default_settings in let set_callbacks f = FStar_Compiler_Effect.op_Colon_Equals parser_callback - (FStar_Pervasives_Native.Some f); - FStar_Options.set_error_flags_callback set_error_flags; - FStar_Options.set_option_warning_callback - (warn_unsafe_options FStar_Pervasives_Native.None) in + (FStar_Pervasives_Native.Some f) + (* FStar_Options.set_option_warning_callback *) + (* (warn_unsafe_options FStar_Pervasives_Native.None) *) + in (set_callbacks, get_error_flags) let (t_set_parse_warn_error : (Prims.string -> FStar_Errors_Codes.error_setting Prims.list) -> unit) = @@ -581,29 +512,31 @@ let (lookup : | (v, level, i) -> let with_level level1 = (v, level1, i) in (match v with - | FStar_Errors_Codes.Warning_Defensive when - (FStar_Options.defensive_error ()) || - (FStar_Options.defensive_abort ()) - -> with_level FStar_Errors_Codes.CAlwaysError - | FStar_Errors_Codes.Warning_WarnOnUse -> - let level' = - let uu___1 = FStar_Options.report_assumes () in - match uu___1 with - | FStar_Pervasives_Native.None -> level - | FStar_Pervasives_Native.Some "warn" -> - (match level with - | FStar_Errors_Codes.CSilent -> - FStar_Errors_Codes.CWarning - | uu___2 -> level) - | FStar_Pervasives_Native.Some "error" -> - (match level with - | FStar_Errors_Codes.CWarning -> - FStar_Errors_Codes.CError - | FStar_Errors_Codes.CSilent -> FStar_Errors_Codes.CError - | uu___2 -> level) - | FStar_Pervasives_Native.Some uu___2 -> level in - with_level level' | uu___1 -> with_level level) + +let raise_error : + 'a . + (FStar_Errors_Codes.raw_error * Prims.string) -> + FStar_Compiler_Range.range -> 'a + = + fun uu___ -> + fun r -> + match uu___ with + | (e, msg) -> + let uu___1 = + let uu___2 = + let uu___3 = error_context.get () in (e, msg, r, uu___3) in + Error uu___2 in + FStar_Compiler_Effect.raise uu___1 +let raise_err : 'a . (FStar_Errors_Codes.raw_error * Prims.string) -> 'a = + fun uu___ -> + match uu___ with + | (e, msg) -> + let uu___1 = + let uu___2 = let uu___3 = error_context.get () in (e, msg, uu___3) in + Err uu___2 in + FStar_Compiler_Effect.raise uu___1 + let (log_issue_ctx : FStar_Compiler_Range.range -> (FStar_Errors_Codes.raw_error * Prims.string) -> @@ -633,7 +566,7 @@ let (log_issue_ctx : let i = mk_issue EError (FStar_Pervasives_Native.Some r) msg (FStar_Pervasives_Native.Some errno1) ctx in - let uu___3 = FStar_Options.ide () in + let uu___3 = false in if uu___3 then add_one i else @@ -652,162 +585,3 @@ let (log_issue : match uu___ with | (e, msg) -> let ctx = error_context.get () in log_issue_ctx r (e, msg) ctx -let (add_errors : error Prims.list -> unit) = - fun errs -> - FStar_Compiler_Util.atomically - (fun uu___ -> - FStar_Compiler_List.iter - (fun uu___1 -> - match uu___1 with - | (e, msg, r, ctx) -> log_issue_ctx r (e, msg) ctx) errs) -let (issue_of_exn : Prims.exn -> issue FStar_Pervasives_Native.option) = - fun e -> - match e with - | Error (e1, msg, r, ctx) -> - let errno1 = let uu___ = lookup e1 in error_number uu___ in - FStar_Pervasives_Native.Some - (mk_issue EError (FStar_Pervasives_Native.Some r) msg - (FStar_Pervasives_Native.Some errno1) ctx) - | Err (e1, msg, ctx) -> - let errno1 = let uu___ = lookup e1 in error_number uu___ in - FStar_Pervasives_Native.Some - (mk_issue EError FStar_Pervasives_Native.None msg - (FStar_Pervasives_Native.Some errno1) ctx) - | uu___ -> FStar_Pervasives_Native.None -let (err_exn : Prims.exn -> unit) = - fun exn -> - if exn = Stop - then () - else - (let uu___1 = issue_of_exn exn in - match uu___1 with - | FStar_Pervasives_Native.Some issue1 -> add_one issue1 - | FStar_Pervasives_Native.None -> FStar_Compiler_Effect.raise exn) -let (handleable : Prims.exn -> Prims.bool) = - fun uu___ -> - match uu___ with - | Error uu___1 -> true - | Stop -> true - | Err uu___1 -> true - | uu___1 -> false -let (stop_if_err : unit -> unit) = - fun uu___ -> - let uu___1 = let uu___2 = get_err_count () in uu___2 > Prims.int_zero in - if uu___1 then FStar_Compiler_Effect.raise Stop else () -let raise_error : - 'a . - (FStar_Errors_Codes.raw_error * Prims.string) -> - FStar_Compiler_Range.range -> 'a - = - fun uu___ -> - fun r -> - match uu___ with - | (e, msg) -> - let uu___1 = - let uu___2 = - let uu___3 = error_context.get () in (e, msg, r, uu___3) in - Error uu___2 in - FStar_Compiler_Effect.raise uu___1 -let raise_err : 'a . (FStar_Errors_Codes.raw_error * Prims.string) -> 'a = - fun uu___ -> - match uu___ with - | (e, msg) -> - let uu___1 = - let uu___2 = let uu___3 = error_context.get () in (e, msg, uu___3) in - Err uu___2 in - FStar_Compiler_Effect.raise uu___1 -let with_ctx : 'a . Prims.string -> (unit -> 'a) -> 'a = - fun s -> - fun f -> - error_context.push s; - (let r = - let uu___1 = FStar_Options.trace_error () in - if uu___1 - then let uu___2 = f () in FStar_Pervasives.Inr uu___2 - else - (try - (fun uu___3 -> - match () with - | () -> let uu___4 = f () in FStar_Pervasives.Inr uu___4) () - with - | FStar_Compiler_Effect.Failure msg -> - let uu___4 = - let uu___5 = - let uu___6 = - let uu___7 = error_context.get () in ctx_string uu___7 in - FStar_String.op_Hat msg uu___6 in - FStar_Compiler_Effect.Failure uu___5 in - FStar_Pervasives.Inl uu___4 - | ex -> FStar_Pervasives.Inl ex) in - (let uu___2 = error_context.pop () in ()); - (match r with - | FStar_Pervasives.Inr r1 -> r1 - | FStar_Pervasives.Inl e -> FStar_Compiler_Effect.raise e)) -let with_ctx_if : 'a . Prims.bool -> Prims.string -> (unit -> 'a) -> 'a = - fun b -> fun s -> fun f -> if b then with_ctx s f else f () -let no_ctx : 'a . (unit -> 'a) -> 'a = - fun f -> - let save = error_context.get () in - error_context.clear (); (let res = f () in error_context.set save; res) -let catch_errors : - 'a . (unit -> 'a) -> (issue Prims.list * 'a FStar_Pervasives_Native.option) - = - fun f -> - let newh = mk_default_handler false in - let old = FStar_Compiler_Effect.op_Bang current_handler in - FStar_Compiler_Effect.op_Colon_Equals current_handler newh; - (let r = - try - (fun uu___1 -> - match () with - | () -> let uu___2 = f () in FStar_Pervasives_Native.Some uu___2) - () - with | uu___1 -> (err_exn uu___1; FStar_Pervasives_Native.None) in - let all_issues = newh.eh_report () in - FStar_Compiler_Effect.op_Colon_Equals current_handler old; - (let uu___2 = - FStar_Compiler_List.partition (fun i -> i.issue_level = EError) - all_issues in - match uu___2 with - | (errs, rest) -> - (FStar_Compiler_List.iter old.eh_add_one rest; (errs, r)))) -let (find_multiset_discrepancy : - Prims.int Prims.list -> - Prims.int Prims.list -> - (Prims.int * Prims.int * Prims.int) FStar_Pervasives_Native.option) - = - fun l1 -> - fun l2 -> - let sort = FStar_Compiler_List.sortWith (fun x -> fun y -> x - y) in - let rec collect l = - match l with - | [] -> [] - | hd::tl -> - let uu___ = collect tl in - (match uu___ with - | [] -> [(hd, Prims.int_one)] - | (h, n)::t -> - if h = hd - then (h, (n + Prims.int_one)) :: t - else (hd, Prims.int_one) :: (h, n) :: t) in - let summ l = collect l in - let l11 = let uu___ = sort l1 in summ uu___ in - let l21 = let uu___ = sort l2 in summ uu___ in - let rec aux l12 l22 = - match (l12, l22) with - | ([], []) -> FStar_Pervasives_Native.None - | ((e, n)::uu___, []) -> - FStar_Pervasives_Native.Some (e, n, Prims.int_zero) - | ([], (e, n)::uu___) -> - FStar_Pervasives_Native.Some (e, Prims.int_zero, n) - | ((hd1, n1)::tl1, (hd2, n2)::tl2) -> - if hd1 < hd2 - then FStar_Pervasives_Native.Some (hd1, n1, Prims.int_zero) - else - if hd1 > hd2 - then FStar_Pervasives_Native.Some (hd2, Prims.int_zero, n2) - else - if n1 <> n2 - then FStar_Pervasives_Native.Some (hd1, n1, n2) - else aux tl1 tl2 in - aux l11 l21 \ No newline at end of file diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Float.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Float.ml deleted file mode 100644 index 39546f959..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Float.ml +++ /dev/null @@ -1,2 +0,0 @@ -type double = float[@@deriving yojson,show] -type float = double[@@deriving yojson,show] diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Int16.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Int16.ml deleted file mode 100644 index 2d50e807f..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Int16.ml +++ /dev/null @@ -1,105 +0,0 @@ -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) -(* THIS IS AN AUTOGENERATED FILE! See ulib/ml/Makefile *) -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) - -(* This file is meant to be concatenated to FStar_Ints.ml.body *) -module M = Stdint.Int16 -type int16 = M.t -type t = M.t -let n = Prims.of_int 16 - -let int_to_t x = M.of_string (Z.to_string x) -let __int_to_t = int_to_t -(* This .ml.body file is concatenated to every .ml.prefix file in this - * directory (ulib/ml/) to generate the OCaml realizations for machine - * integers, as they all pretty much share their definitions and are - * based on Stdint. *) - -let v (x:t) : Prims.int = Prims.parse_int (M.to_string x) - -let zero = M.zero -let one = M.one -let ones = M.pred M.zero - -(* Reexport add, plus aliases *) -let add = M.add -let add_underspec = M.add -let add_mod = M.add - -(* Reexport sub, plus aliases *) -let sub = M.sub -let sub_underspec = M.sub -let sub_mod = M.sub - -(* Reexport mul, plus aliases *) -let mul = M.mul -let mul_underspec = M.mul -let mul_mod = M.mul - -(* Conversions to Zarith's int *) -let to_int (x:t) : Z.t = Z.of_string (M.to_string x) -let of_int (x:Z.t) : t = M.of_string (Z.to_string x) - -(* Conversion to native ints; these are potentially unsafe and not part - * of the interface: they are meant to be called only from OCaml code - * that is doing the right thing *) -let of_native_int (x:int) : t = M.of_int x -let to_native_int (x:t) : int = M.to_int x - -(* Just reexport these *) -let div = M.div -let rem = M.rem -let logand = M.logand -let logxor = M.logxor -let logor = M.logor -let lognot = M.lognot -let to_string = M.to_string -let of_string = M.of_string - -let to_string_hex = M.to_string_hex - -let to_string_hex_pad i = - let s0 = M.to_string_hex i in - let len = (String.length s0 - 2) in - let s1 = String.sub s0 2 len in (* Remove leading "0x" *) - let zeroes = String.make ((Z.to_int n / 4) - len) '0' in - zeroes ^ s1 - -(* The shifts take a uint32 argument, so we need to convert *) -let shift_right n i = M.shift_right n (Stdint.Uint32.to_int i) -let shift_left n i = M.shift_left n (Stdint.Uint32.to_int i) -let shift_arithmetic_right = shift_right - -(* Comparison operators *) -let eq (a:t) (b:t) : bool = a = b -let gt (a:t) (b:t) : bool = a > b -let gte (a:t) (b:t) : bool = a >= b -let lt (a:t) (b:t) : bool = a < b -let lte (a:t) (b:t) : bool = a <= b - -(* NOT Constant time operators *) -let eq_mask (a:t) (b:t) : t = if a = b then ones else zero -let gte_mask (a:t) (b:t) : t = if a >= b then ones else zero - -(* Infix notations *) -let op_Plus_Hat = add -let op_Plus_Question_Hat = add_underspec -let op_Plus_Percent_Hat = add_mod -let op_Subtraction_Hat = sub -let op_Subtraction_Question_Hat = sub_underspec -let op_Subtraction_Percent_Hat = sub_mod -let op_Star_Hat = mul -let op_Star_Question_Hat = mul_underspec -let op_Star_Percent_Hat = mul_mod -let op_Slash_Hat = div -let op_Percent_Hat = rem -let op_Hat_Hat = logxor -let op_Amp_Hat = logand -let op_Bar_Hat = logor -let op_Less_Less_Hat = shift_left -let op_Greater_Greater_Hat = shift_right -let op_Equals_Hat = eq -let op_Greater_Hat = gt -let op_Greater_Equals_Hat = gte -let op_Less_Hat = lt -let op_Less_Equals_Hat = lte diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Int32.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Int32.ml deleted file mode 100644 index 07bfb0ee7..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Int32.ml +++ /dev/null @@ -1,104 +0,0 @@ -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) -(* THIS IS AN AUTOGENERATED FILE! See ulib/ml/Makefile *) -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) - -module M = Stdint.Int32 -type int32 = M.t -type t = M.t -let n = Prims.of_int 32 - -let int_to_t x = M.of_string (Z.to_string x) -let __int_to_t = int_to_t -(* This .ml.body file is concatenated to every .ml.prefix file in this - * directory (ulib/ml/) to generate the OCaml realizations for machine - * integers, as they all pretty much share their definitions and are - * based on Stdint. *) - -let v (x:t) : Prims.int = Prims.parse_int (M.to_string x) - -let zero = M.zero -let one = M.one -let ones = M.pred M.zero - -(* Reexport add, plus aliases *) -let add = M.add -let add_underspec = M.add -let add_mod = M.add - -(* Reexport sub, plus aliases *) -let sub = M.sub -let sub_underspec = M.sub -let sub_mod = M.sub - -(* Reexport mul, plus aliases *) -let mul = M.mul -let mul_underspec = M.mul -let mul_mod = M.mul - -(* Conversions to Zarith's int *) -let to_int (x:t) : Z.t = Z.of_string (M.to_string x) -let of_int (x:Z.t) : t = M.of_string (Z.to_string x) - -(* Conversion to native ints; these are potentially unsafe and not part - * of the interface: they are meant to be called only from OCaml code - * that is doing the right thing *) -let of_native_int (x:int) : t = M.of_int x -let to_native_int (x:t) : int = M.to_int x - -(* Just reexport these *) -let div = M.div -let rem = M.rem -let logand = M.logand -let logxor = M.logxor -let logor = M.logor -let lognot = M.lognot -let to_string = M.to_string -let of_string = M.of_string - -let to_string_hex = M.to_string_hex - -let to_string_hex_pad i = - let s0 = M.to_string_hex i in - let len = (String.length s0 - 2) in - let s1 = String.sub s0 2 len in (* Remove leading "0x" *) - let zeroes = String.make ((Z.to_int n / 4) - len) '0' in - zeroes ^ s1 - -(* The shifts take a uint32 argument, so we need to convert *) -let shift_right n i = M.shift_right n (Stdint.Uint32.to_int i) -let shift_left n i = M.shift_left n (Stdint.Uint32.to_int i) -let shift_arithmetic_right = shift_right - -(* Comparison operators *) -let eq (a:t) (b:t) : bool = a = b -let gt (a:t) (b:t) : bool = a > b -let gte (a:t) (b:t) : bool = a >= b -let lt (a:t) (b:t) : bool = a < b -let lte (a:t) (b:t) : bool = a <= b - -(* NOT Constant time operators *) -let eq_mask (a:t) (b:t) : t = if a = b then ones else zero -let gte_mask (a:t) (b:t) : t = if a >= b then ones else zero - -(* Infix notations *) -let op_Plus_Hat = add -let op_Plus_Question_Hat = add_underspec -let op_Plus_Percent_Hat = add_mod -let op_Subtraction_Hat = sub -let op_Subtraction_Question_Hat = sub_underspec -let op_Subtraction_Percent_Hat = sub_mod -let op_Star_Hat = mul -let op_Star_Question_Hat = mul_underspec -let op_Star_Percent_Hat = mul_mod -let op_Slash_Hat = div -let op_Percent_Hat = rem -let op_Hat_Hat = logxor -let op_Amp_Hat = logand -let op_Bar_Hat = logor -let op_Less_Less_Hat = shift_left -let op_Greater_Greater_Hat = shift_right -let op_Equals_Hat = eq -let op_Greater_Hat = gt -let op_Greater_Equals_Hat = gte -let op_Less_Hat = lt -let op_Less_Equals_Hat = lte diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Int64.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Int64.ml deleted file mode 100644 index 33d2e0082..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Int64.ml +++ /dev/null @@ -1,105 +0,0 @@ -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) -(* THIS IS AN AUTOGENERATED FILE! See ulib/ml/Makefile *) -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) - -(* This file is meant to be concatenated to FStar_Ints.ml.body *) -module M = Stdint.Int64 -type int64 = M.t -type t = M.t -let n = Prims.of_int 64 - -let int_to_t x = M.of_string (Z.to_string x) -let __int_to_t = int_to_t -(* This .ml.body file is concatenated to every .ml.prefix file in this - * directory (ulib/ml/) to generate the OCaml realizations for machine - * integers, as they all pretty much share their definitions and are - * based on Stdint. *) - -let v (x:t) : Prims.int = Prims.parse_int (M.to_string x) - -let zero = M.zero -let one = M.one -let ones = M.pred M.zero - -(* Reexport add, plus aliases *) -let add = M.add -let add_underspec = M.add -let add_mod = M.add - -(* Reexport sub, plus aliases *) -let sub = M.sub -let sub_underspec = M.sub -let sub_mod = M.sub - -(* Reexport mul, plus aliases *) -let mul = M.mul -let mul_underspec = M.mul -let mul_mod = M.mul - -(* Conversions to Zarith's int *) -let to_int (x:t) : Z.t = Z.of_string (M.to_string x) -let of_int (x:Z.t) : t = M.of_string (Z.to_string x) - -(* Conversion to native ints; these are potentially unsafe and not part - * of the interface: they are meant to be called only from OCaml code - * that is doing the right thing *) -let of_native_int (x:int) : t = M.of_int x -let to_native_int (x:t) : int = M.to_int x - -(* Just reexport these *) -let div = M.div -let rem = M.rem -let logand = M.logand -let logxor = M.logxor -let logor = M.logor -let lognot = M.lognot -let to_string = M.to_string -let of_string = M.of_string - -let to_string_hex = M.to_string_hex - -let to_string_hex_pad i = - let s0 = M.to_string_hex i in - let len = (String.length s0 - 2) in - let s1 = String.sub s0 2 len in (* Remove leading "0x" *) - let zeroes = String.make ((Z.to_int n / 4) - len) '0' in - zeroes ^ s1 - -(* The shifts take a uint32 argument, so we need to convert *) -let shift_right n i = M.shift_right n (Stdint.Uint32.to_int i) -let shift_left n i = M.shift_left n (Stdint.Uint32.to_int i) -let shift_arithmetic_right = shift_right - -(* Comparison operators *) -let eq (a:t) (b:t) : bool = a = b -let gt (a:t) (b:t) : bool = a > b -let gte (a:t) (b:t) : bool = a >= b -let lt (a:t) (b:t) : bool = a < b -let lte (a:t) (b:t) : bool = a <= b - -(* NOT Constant time operators *) -let eq_mask (a:t) (b:t) : t = if a = b then ones else zero -let gte_mask (a:t) (b:t) : t = if a >= b then ones else zero - -(* Infix notations *) -let op_Plus_Hat = add -let op_Plus_Question_Hat = add_underspec -let op_Plus_Percent_Hat = add_mod -let op_Subtraction_Hat = sub -let op_Subtraction_Question_Hat = sub_underspec -let op_Subtraction_Percent_Hat = sub_mod -let op_Star_Hat = mul -let op_Star_Question_Hat = mul_underspec -let op_Star_Percent_Hat = mul_mod -let op_Slash_Hat = div -let op_Percent_Hat = rem -let op_Hat_Hat = logxor -let op_Amp_Hat = logand -let op_Bar_Hat = logor -let op_Less_Less_Hat = shift_left -let op_Greater_Greater_Hat = shift_right -let op_Equals_Hat = eq -let op_Greater_Hat = gt -let op_Greater_Equals_Hat = gte -let op_Less_Hat = lt -let op_Less_Equals_Hat = lte diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Int8.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Int8.ml deleted file mode 100644 index 5b0ca3d51..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Int8.ml +++ /dev/null @@ -1,105 +0,0 @@ -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) -(* THIS IS AN AUTOGENERATED FILE! See ulib/ml/Makefile *) -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) - -(* This file is meant to be concatenated to FStar_Ints.ml.body *) -module M = Stdint.Int8 -type int8 = M.t -type t = M.t -let n = Prims.of_int 8 - -let int_to_t x = M.of_string (Z.to_string x) -let __int_to_t = int_to_t -(* This .ml.body file is concatenated to every .ml.prefix file in this - * directory (ulib/ml/) to generate the OCaml realizations for machine - * integers, as they all pretty much share their definitions and are - * based on Stdint. *) - -let v (x:t) : Prims.int = Prims.parse_int (M.to_string x) - -let zero = M.zero -let one = M.one -let ones = M.pred M.zero - -(* Reexport add, plus aliases *) -let add = M.add -let add_underspec = M.add -let add_mod = M.add - -(* Reexport sub, plus aliases *) -let sub = M.sub -let sub_underspec = M.sub -let sub_mod = M.sub - -(* Reexport mul, plus aliases *) -let mul = M.mul -let mul_underspec = M.mul -let mul_mod = M.mul - -(* Conversions to Zarith's int *) -let to_int (x:t) : Z.t = Z.of_string (M.to_string x) -let of_int (x:Z.t) : t = M.of_string (Z.to_string x) - -(* Conversion to native ints; these are potentially unsafe and not part - * of the interface: they are meant to be called only from OCaml code - * that is doing the right thing *) -let of_native_int (x:int) : t = M.of_int x -let to_native_int (x:t) : int = M.to_int x - -(* Just reexport these *) -let div = M.div -let rem = M.rem -let logand = M.logand -let logxor = M.logxor -let logor = M.logor -let lognot = M.lognot -let to_string = M.to_string -let of_string = M.of_string - -let to_string_hex = M.to_string_hex - -let to_string_hex_pad i = - let s0 = M.to_string_hex i in - let len = (String.length s0 - 2) in - let s1 = String.sub s0 2 len in (* Remove leading "0x" *) - let zeroes = String.make ((Z.to_int n / 4) - len) '0' in - zeroes ^ s1 - -(* The shifts take a uint32 argument, so we need to convert *) -let shift_right n i = M.shift_right n (Stdint.Uint32.to_int i) -let shift_left n i = M.shift_left n (Stdint.Uint32.to_int i) -let shift_arithmetic_right = shift_right - -(* Comparison operators *) -let eq (a:t) (b:t) : bool = a = b -let gt (a:t) (b:t) : bool = a > b -let gte (a:t) (b:t) : bool = a >= b -let lt (a:t) (b:t) : bool = a < b -let lte (a:t) (b:t) : bool = a <= b - -(* NOT Constant time operators *) -let eq_mask (a:t) (b:t) : t = if a = b then ones else zero -let gte_mask (a:t) (b:t) : t = if a >= b then ones else zero - -(* Infix notations *) -let op_Plus_Hat = add -let op_Plus_Question_Hat = add_underspec -let op_Plus_Percent_Hat = add_mod -let op_Subtraction_Hat = sub -let op_Subtraction_Question_Hat = sub_underspec -let op_Subtraction_Percent_Hat = sub_mod -let op_Star_Hat = mul -let op_Star_Question_Hat = mul_underspec -let op_Star_Percent_Hat = mul_mod -let op_Slash_Hat = div -let op_Percent_Hat = rem -let op_Hat_Hat = logxor -let op_Amp_Hat = logand -let op_Bar_Hat = logor -let op_Less_Less_Hat = shift_left -let op_Greater_Greater_Hat = shift_right -let op_Equals_Hat = eq -let op_Greater_Hat = gt -let op_Greater_Equals_Hat = gte -let op_Less_Hat = lt -let op_Less_Equals_Hat = lte diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_List.ml b/engine/backends/fstar/fstar-surface-ast/FStar_List.ml index d1b052be0..9e35917fe 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_List.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_List.ml @@ -1,79 +1,39 @@ (* We give an implementation here using OCaml's BatList, which provides tail-recursive versions of most functions *) -include FStar_List_Tot_Base - let isEmpty l = l = [] -let singleton x = [x] -let mem = BatList.mem -let memT = mem let hd = BatList.hd -let tl = BatList.tl let tail = BatList.tl +let tl = BatList.tl -let nth l i = BatList.nth l (Z.to_int i) +let rec last = function + | x :: [] -> x + | _ :: tl -> last tl let length l = Z.of_int (BatList.length l) let rev = BatList.rev +let append = BatList.append +let op_At = append +let flatten = BatList.flatten let map = BatList.map -let mapT = map let mapi f l = BatList.mapi (fun i x -> f (Z.of_int i) x) l -let map2 = BatList.map2 -let rec map3 f l1 l2 l3 = - match l1, l2, l3 with - | [], [], [] -> [] - | x::xs, y::ys, z::zs -> (f x y z)::(map3 f xs ys zs) - | _, _, _ -> failwith "The lists do not have the same length" -let iter = BatList.iter -let iter2 = BatList.iter2 -let iteri_aux _ _ _ = failwith "FStar_List.ml: Not implemented: iteri_aux" -let iteri f l = BatList.iteri (fun i x -> f (Z.of_int i) x) l -let partition = BatList.partition -let append = BatList.append -let rev_append = BatList.rev_append let fold_left = BatList.fold_left let fold_right = BatList.fold_right let fold_left2 = BatList.fold_left2 -let fold_right2 = BatList.fold_right2 -let rev_map_onto f l acc = fold_left (fun acc x -> f x :: acc) acc l -let rec init = function - | [] -> failwith "init: empty list" - | [h] -> [] - | h::t -> h::(init t) -let last = BatList.last -let last_opt l = List.fold_left (fun _ x -> Some x) None l -let collect f l = BatList.flatten (BatList.map f l) -let unzip = BatList.split -let rec unzip3 = function - | [] -> ([],[],[]) - | (x,y,z)::xyzs -> - let (xs,ys,zs) = unzip3 xyzs in - (x::xs,y::ys,z::zs) +let existsb f l = BatList.exists f l +let find f l = try Some (BatList.find f l) with | Not_found -> None let filter = BatList.filter -let sortWith f l = BatList.sort (fun x y -> Z.to_int (f x y)) l let for_all = BatList.for_all -let forall2 = BatList.for_all2 -let tryFind f l = try Some (BatList.find f l) with | Not_found -> None -let tryFindT = tryFind -let find = tryFind -let tryPick f l = try f (BatList.find (fun x -> f x <> None) l) with | Not_found -> None -let flatten = BatList.flatten -let concat = flatten -let split = unzip +let collect f l = BatList.flatten (BatList.map f l) +let tryFind = find let choose = BatList.filter_map -let existsb f l = BatList.exists f l -let existsML f l = BatList.exists f l -let contains x l = BatList.exists (fun y -> x = y) l -let zip = BatList.combine -let splitAt x l = BatList.split_at (Z.to_int x) l -let filter_map = BatList.filter_map -let index f l = - Z.of_int (fst (BatList.findi (fun _ x -> f x) l)) - -let rec zip3 l1 l2 l3 = - match l1, l2, l3 with - | [], [], [] -> [] - | h1::t1, h2::t2, h3::t3 -> (h1, h2, h3) :: (zip3 t1 t2 t3) - | _ -> failwith "zip3" -let unique = BatList.unique -let map_flatten f l = flatten (map f l) +let partition = BatList.partition +let sortWith f l = BatList.sort (fun x y -> Z.to_int (f x y)) l -let span = BatList.span +let isEmpty l = l = [] +let singleton x = [x] +let mem = BatList.mem +let memT = mem +let hd = BatList.hd +let tl = BatList.tl +let tail = BatList.tl +let iter = BatList.iter +let forall2 = BatList.for_all2 diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_List_Tot_Base.ml b/engine/backends/fstar/fstar-surface-ast/FStar_List_Tot_Base.ml deleted file mode 100644 index 537c03abb..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_List_Tot_Base.ml +++ /dev/null @@ -1,76 +0,0 @@ -(* We give an implementation here using OCaml's BatList, - which provide tail-recursive versions of most functions. - The rest we implement manually. *) - -let isEmpty l = l = [] -let hd = BatList.hd -let tail = BatList.tl -let tl = BatList.tl - -let rec last = function - | x :: [] -> x - | _ :: tl -> last tl - -let rec init = function - | _ :: [] -> [] - | hd :: tl -> hd :: init tl - -let length l = Z.of_int (BatList.length l) -let nth l i = try Some (BatList.nth l (Z.to_int i)) with _ -> None -let index l i = BatList.nth l (Z.to_int i) - -let rec count x = function - | [] -> Prims.int_zero - | hd::tl -> if x=hd then Z.add Prims.int_one (count x tl) else count x tl - -let rev_acc l r = BatList.rev_append l r -let rev = BatList.rev -let append = BatList.append -let op_At = append -let snoc (x, y) = append x [y] -let flatten = BatList.flatten -let map = BatList.map -let mapi_init _ _ _ = failwith "FStar_List_Tot_Base.ml: Not implemented: mapi_init" -let mapi f l = BatList.mapi (fun i x -> f (Z.of_int i) x) l -let concatMap f l = flatten (map f l) -let fold_left = BatList.fold_left -let fold_right = BatList.fold_right -let fold_left2 = BatList.fold_left2 -let mem = BatList.mem -type ('a, 'b, 'c) memP = unit -let contains x l = BatList.exists (fun y -> x = y) l -let existsb f l = BatList.exists f l -let find f l = try Some (BatList.find f l) with | Not_found -> None -let filter = BatList.filter -let for_all = BatList.for_all -let collect f l = BatList.flatten (BatList.map f l) -let tryFind = find -let tryPick f l = try f (BatList.find (fun x -> f x <> None) l) with | Not_found -> None -let choose = BatList.filter_map -let partition = BatList.partition -let subset la lb = BatList.subset (fun x y -> if x = y then 0 else 1) la lb - -let rec noRepeats = function - | [] -> true - | h :: tl -> not (mem h tl) && noRepeats tl - -let assoc x l = match List.assoc x l with exception Not_found -> None | x -> Some x -let split = BatList.split -let unzip = split -let rec unzip3 = function - | [] -> ([],[],[]) - | (x,y,z)::xyzs -> - let (xs,ys,zs) = unzip3 xyzs in - (x::xs,y::ys,z::zs) - -let splitAt n l = BatList.split_at (Z.to_int n) l -let unsnoc l = let l1, l2 = splitAt (Z.sub (length l) Z.one) l in l1, hd l2 -let split3 l i = let a, a1 = splitAt i l in let b :: c = a1 in a, b, c - -let bool_of_compare f x y = Z.gt (f x y) Z.zero -let compare_of_bool = - fun rel -> fun x -> fun y -> if (rel x y) then Z.one else (if x = y then Z.zero else (Z.neg Z.one)) -let sortWith f l = BatList.sort (fun x y -> Z.to_int (f x y)) l -let list_unref l = l -let list_ref _ l = l -let list_refb _ l = l diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Monotonic_Heap.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Monotonic_Heap.ml deleted file mode 100644 index 1c1cc85cb..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Monotonic_Heap.ml +++ /dev/null @@ -1,36 +0,0 @@ -type heap = unit - -type nonrec 'a ref = 'a ref - -type ('a, 'b) mref = 'a ref - -let emp = - () - -(* Logical functions on heap *) -(* TODO : complete the functions to have the same interface as in FStar.Heap.fsti *) - -let addr_of _ = Obj.magic () -let is_mm _ = Obj.magic () - -(* let compare_addrs *) - -type ('a, 'b, 'c, 'd) contains -type ('a, 'b) addr_unused_in -type ('a, 'b, 'c, 'd) unused_in -let fresh _ _ _ = Obj.magic () - -let sel _ _ = Obj.magic () -let upd _ _ _ = Obj.magic () -let alloc _ _ _ = Obj.magic () - -let free_mm _ _ = Obj.magic () -let sel_tot = sel -let upd_tot = upd - -(* Untyped view of references *) -type aref = - | Ref of (unit * unit) -let dummy_aref = Ref ((), ()) -let aref_of _ = dummy_aref -let ref_of _ _ = Obj.magic () diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Options.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Options.ml deleted file mode 100644 index e209731c2..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Options.ml +++ /dev/null @@ -1,2511 +0,0 @@ -open Prims -type debug_level_t = - | Low - | Medium - | High - | Extreme - | Other of Prims.string -let (uu___is_Low : debug_level_t -> Prims.bool) = - fun projectee -> match projectee with | Low -> true | uu___ -> false -let (uu___is_Medium : debug_level_t -> Prims.bool) = - fun projectee -> match projectee with | Medium -> true | uu___ -> false -let (uu___is_High : debug_level_t -> Prims.bool) = - fun projectee -> match projectee with | High -> true | uu___ -> false -let (uu___is_Extreme : debug_level_t -> Prims.bool) = - fun projectee -> match projectee with | Extreme -> true | uu___ -> false -let (uu___is_Other : debug_level_t -> Prims.bool) = - fun projectee -> match projectee with | Other _0 -> true | uu___ -> false -let (__proj__Other__item___0 : debug_level_t -> Prims.string) = - fun projectee -> match projectee with | Other _0 -> _0 -type option_val = - | Bool of Prims.bool - | String of Prims.string - | Path of Prims.string - | Int of Prims.int - | List of option_val Prims.list - | Unset -let (uu___is_Bool : option_val -> Prims.bool) = - fun projectee -> match projectee with | Bool _0 -> true | uu___ -> false -let (__proj__Bool__item___0 : option_val -> Prims.bool) = - fun projectee -> match projectee with | Bool _0 -> _0 -let (uu___is_String : option_val -> Prims.bool) = - fun projectee -> match projectee with | String _0 -> true | uu___ -> false -let (__proj__String__item___0 : option_val -> Prims.string) = - fun projectee -> match projectee with | String _0 -> _0 -let (uu___is_Path : option_val -> Prims.bool) = - fun projectee -> match projectee with | Path _0 -> true | uu___ -> false -let (__proj__Path__item___0 : option_val -> Prims.string) = - fun projectee -> match projectee with | Path _0 -> _0 -let (uu___is_Int : option_val -> Prims.bool) = - fun projectee -> match projectee with | Int _0 -> true | uu___ -> false -let (__proj__Int__item___0 : option_val -> Prims.int) = - fun projectee -> match projectee with | Int _0 -> _0 -let (uu___is_List : option_val -> Prims.bool) = - fun projectee -> match projectee with | List _0 -> true | uu___ -> false -let (__proj__List__item___0 : option_val -> option_val Prims.list) = - fun projectee -> match projectee with | List _0 -> _0 -let (uu___is_Unset : option_val -> Prims.bool) = - fun projectee -> match projectee with | Unset -> true | uu___ -> false -type optionstate = option_val FStar_Compiler_Util.smap -type opt_type = - | Const of option_val - | IntStr of Prims.string - | BoolStr - | PathStr of Prims.string - | SimpleStr of Prims.string - | EnumStr of Prims.string Prims.list - | OpenEnumStr of (Prims.string Prims.list * Prims.string) - | PostProcessed of ((option_val -> option_val) * opt_type) - | Accumulated of opt_type - | ReverseAccumulated of opt_type - | WithSideEffect of ((unit -> unit) * opt_type) -let (uu___is_Const : opt_type -> Prims.bool) = - fun projectee -> match projectee with | Const _0 -> true | uu___ -> false -let (__proj__Const__item___0 : opt_type -> option_val) = - fun projectee -> match projectee with | Const _0 -> _0 -let (uu___is_IntStr : opt_type -> Prims.bool) = - fun projectee -> match projectee with | IntStr _0 -> true | uu___ -> false -let (__proj__IntStr__item___0 : opt_type -> Prims.string) = - fun projectee -> match projectee with | IntStr _0 -> _0 -let (uu___is_BoolStr : opt_type -> Prims.bool) = - fun projectee -> match projectee with | BoolStr -> true | uu___ -> false -let (uu___is_PathStr : opt_type -> Prims.bool) = - fun projectee -> match projectee with | PathStr _0 -> true | uu___ -> false -let (__proj__PathStr__item___0 : opt_type -> Prims.string) = - fun projectee -> match projectee with | PathStr _0 -> _0 -let (uu___is_SimpleStr : opt_type -> Prims.bool) = - fun projectee -> - match projectee with | SimpleStr _0 -> true | uu___ -> false -let (__proj__SimpleStr__item___0 : opt_type -> Prims.string) = - fun projectee -> match projectee with | SimpleStr _0 -> _0 -let (uu___is_EnumStr : opt_type -> Prims.bool) = - fun projectee -> match projectee with | EnumStr _0 -> true | uu___ -> false -let (__proj__EnumStr__item___0 : opt_type -> Prims.string Prims.list) = - fun projectee -> match projectee with | EnumStr _0 -> _0 -let (uu___is_OpenEnumStr : opt_type -> Prims.bool) = - fun projectee -> - match projectee with | OpenEnumStr _0 -> true | uu___ -> false -let (__proj__OpenEnumStr__item___0 : - opt_type -> (Prims.string Prims.list * Prims.string)) = - fun projectee -> match projectee with | OpenEnumStr _0 -> _0 -let (uu___is_PostProcessed : opt_type -> Prims.bool) = - fun projectee -> - match projectee with | PostProcessed _0 -> true | uu___ -> false -let (__proj__PostProcessed__item___0 : - opt_type -> ((option_val -> option_val) * opt_type)) = - fun projectee -> match projectee with | PostProcessed _0 -> _0 -let (uu___is_Accumulated : opt_type -> Prims.bool) = - fun projectee -> - match projectee with | Accumulated _0 -> true | uu___ -> false -let (__proj__Accumulated__item___0 : opt_type -> opt_type) = - fun projectee -> match projectee with | Accumulated _0 -> _0 -let (uu___is_ReverseAccumulated : opt_type -> Prims.bool) = - fun projectee -> - match projectee with | ReverseAccumulated _0 -> true | uu___ -> false -let (__proj__ReverseAccumulated__item___0 : opt_type -> opt_type) = - fun projectee -> match projectee with | ReverseAccumulated _0 -> _0 -let (uu___is_WithSideEffect : opt_type -> Prims.bool) = - fun projectee -> - match projectee with | WithSideEffect _0 -> true | uu___ -> false -let (__proj__WithSideEffect__item___0 : - opt_type -> ((unit -> unit) * opt_type)) = - fun projectee -> match projectee with | WithSideEffect _0 -> _0 -let (debug_embedding : Prims.bool FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref false -let (eager_embedding : Prims.bool FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref false -let (__unit_tests__ : Prims.bool FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref false -let (__unit_tests : unit -> Prims.bool) = - fun uu___ -> FStar_Compiler_Effect.op_Bang __unit_tests__ -let (__set_unit_tests : unit -> unit) = - fun uu___ -> FStar_Compiler_Effect.op_Colon_Equals __unit_tests__ true -let (__clear_unit_tests : unit -> unit) = - fun uu___ -> FStar_Compiler_Effect.op_Colon_Equals __unit_tests__ false -let (as_bool : option_val -> Prims.bool) = - fun uu___ -> - match uu___ with - | Bool b -> b - | uu___1 -> failwith "Impos: expected Bool" -let (as_int : option_val -> Prims.int) = - fun uu___ -> - match uu___ with | Int b -> b | uu___1 -> failwith "Impos: expected Int" -let (as_string : option_val -> Prims.string) = - fun uu___ -> - match uu___ with - | String b -> b - | Path b -> FStar_Common.try_convert_file_name_to_mixed b - | uu___1 -> failwith "Impos: expected String" -let (as_list' : option_val -> option_val Prims.list) = - fun uu___ -> - match uu___ with - | List ts -> ts - | uu___1 -> failwith "Impos: expected List" -let as_list : - 'uuuuu . (option_val -> 'uuuuu) -> option_val -> 'uuuuu Prims.list = - fun as_t -> - fun x -> - let uu___ = as_list' x in - FStar_Compiler_Effect.op_Bar_Greater uu___ - (FStar_Compiler_List.map as_t) -let as_option : - 'uuuuu . - (option_val -> 'uuuuu) -> - option_val -> 'uuuuu FStar_Pervasives_Native.option - = - fun as_t -> - fun uu___ -> - match uu___ with - | Unset -> FStar_Pervasives_Native.None - | v -> let uu___1 = as_t v in FStar_Pervasives_Native.Some uu___1 -let (as_comma_string_list : option_val -> Prims.string Prims.list) = - fun uu___ -> - match uu___ with - | List ls -> - let uu___1 = - FStar_Compiler_List.map - (fun l -> - let uu___2 = as_string l in - FStar_Compiler_Util.split uu___2 ",") ls in - FStar_Compiler_Effect.op_Less_Bar FStar_Compiler_List.flatten uu___1 - | uu___1 -> failwith "Impos: expected String (comma list)" -let copy_optionstate : - 'uuuuu . 'uuuuu FStar_Compiler_Util.smap -> 'uuuuu FStar_Compiler_Util.smap - = fun m -> FStar_Compiler_Util.smap_copy m -let (fstar_options : - optionstate Prims.list Prims.list FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref [] -let (internal_peek : unit -> optionstate) = - fun uu___ -> - let uu___1 = - let uu___2 = FStar_Compiler_Effect.op_Bang fstar_options in - FStar_Compiler_List.hd uu___2 in - FStar_Compiler_List.hd uu___1 -let (peek : unit -> optionstate) = - fun uu___ -> let uu___1 = internal_peek () in copy_optionstate uu___1 -let (pop : unit -> unit) = - fun uu___ -> - let uu___1 = FStar_Compiler_Effect.op_Bang fstar_options in - match uu___1 with - | [] -> failwith "TOO MANY POPS!" - | uu___2::[] -> failwith "TOO MANY POPS!" - | uu___2::tl -> FStar_Compiler_Effect.op_Colon_Equals fstar_options tl -let (push : unit -> unit) = - fun uu___ -> - let uu___1 = - let uu___2 = - let uu___3 = - let uu___4 = FStar_Compiler_Effect.op_Bang fstar_options in - FStar_Compiler_List.hd uu___4 in - FStar_Compiler_List.map copy_optionstate uu___3 in - let uu___3 = FStar_Compiler_Effect.op_Bang fstar_options in uu___2 :: - uu___3 in - FStar_Compiler_Effect.op_Colon_Equals fstar_options uu___1 -let (internal_pop : unit -> Prims.bool) = - fun uu___ -> - let curstack = - let uu___1 = FStar_Compiler_Effect.op_Bang fstar_options in - FStar_Compiler_List.hd uu___1 in - match curstack with - | [] -> failwith "impossible: empty current option stack" - | uu___1::[] -> false - | uu___1::tl -> - ((let uu___3 = - let uu___4 = - let uu___5 = FStar_Compiler_Effect.op_Bang fstar_options in - FStar_Compiler_List.tl uu___5 in - tl :: uu___4 in - FStar_Compiler_Effect.op_Colon_Equals fstar_options uu___3); - true) -let (internal_push : unit -> unit) = - fun uu___ -> - let curstack = - let uu___1 = FStar_Compiler_Effect.op_Bang fstar_options in - FStar_Compiler_List.hd uu___1 in - let stack' = - let uu___1 = - let uu___2 = FStar_Compiler_List.hd curstack in - copy_optionstate uu___2 in - uu___1 :: curstack in - let uu___1 = - let uu___2 = - let uu___3 = FStar_Compiler_Effect.op_Bang fstar_options in - FStar_Compiler_List.tl uu___3 in - stack' :: uu___2 in - FStar_Compiler_Effect.op_Colon_Equals fstar_options uu___1 -let (set : optionstate -> unit) = - fun o -> - let uu___ = FStar_Compiler_Effect.op_Bang fstar_options in - match uu___ with - | [] -> failwith "set on empty option stack" - | []::uu___1 -> failwith "set on empty current option stack" - | (uu___1::tl)::os -> - FStar_Compiler_Effect.op_Colon_Equals fstar_options ((o :: tl) :: os) -let (snapshot : unit -> (Prims.int * unit)) = - fun uu___ -> FStar_Common.snapshot push fstar_options () -let (rollback : Prims.int FStar_Pervasives_Native.option -> unit) = - fun depth -> FStar_Common.rollback pop fstar_options depth -let (set_option : Prims.string -> option_val -> unit) = - fun k -> - fun v -> - let map = internal_peek () in - if k = "report_assumes" - then - let uu___ = FStar_Compiler_Util.smap_try_find map k in - match uu___ with - | FStar_Pervasives_Native.Some (String "error") -> () - | uu___1 -> FStar_Compiler_Util.smap_add map k v - else FStar_Compiler_Util.smap_add map k v -let (set_option' : (Prims.string * option_val) -> unit) = - fun uu___ -> match uu___ with | (k, v) -> set_option k v -let (set_admit_smt_queries : Prims.bool -> unit) = - fun b -> set_option "admit_smt_queries" (Bool b) -let (defaults : (Prims.string * option_val) Prims.list) = - [("__temp_fast_implicits", (Bool false)); - ("abort_on", (Int Prims.int_zero)); - ("admit_smt_queries", (Bool false)); - ("admit_except", Unset); - ("disallow_unification_guards", (Bool false)); - ("already_cached", Unset); - ("cache_checked_modules", (Bool false)); - ("cache_dir", Unset); - ("cache_off", (Bool false)); - ("compat_pre_core", Unset); - ("compat_pre_typed_indexed_effects", (Bool false)); - ("print_cache_version", (Bool false)); - ("cmi", (Bool false)); - ("codegen", Unset); - ("codegen-lib", (List [])); - ("debug", (List [])); - ("debug_level", (List [])); - ("defensive", (String "no")); - ("dep", Unset); - ("detail_errors", (Bool false)); - ("detail_hint_replay", (Bool false)); - ("dump_module", (List [])); - ("eager_subtyping", (Bool false)); - ("error_contexts", (Bool false)); - ("expose_interfaces", (Bool false)); - ("extract", Unset); - ("extract_all", (Bool false)); - ("extract_module", (List [])); - ("extract_namespace", (List [])); - ("full_context_dependency", (Bool true)); - ("hide_uvar_nums", (Bool false)); - ("hint_info", (Bool false)); - ("hint_dir", Unset); - ("hint_file", Unset); - ("in", (Bool false)); - ("ide", (Bool false)); - ("ide_id_info_off", (Bool false)); - ("lsp", (Bool false)); - ("include", (List [])); - ("print", (Bool false)); - ("print_in_place", (Bool false)); - ("force", (Bool false)); - ("fuel", Unset); - ("ifuel", Unset); - ("initial_fuel", (Int (Prims.of_int (2)))); - ("initial_ifuel", (Int Prims.int_one)); - ("keep_query_captions", (Bool true)); - ("lax", (Bool false)); - ("load", (List [])); - ("load_cmxs", (List [])); - ("log_queries", (Bool false)); - ("log_types", (Bool false)); - ("max_fuel", (Int (Prims.of_int (8)))); - ("max_ifuel", (Int (Prims.of_int (2)))); - ("MLish", (Bool false)); - ("no_default_includes", (Bool false)); - ("no_extract", (List [])); - ("no_location_info", (Bool false)); - ("no_smt", (Bool false)); - ("no_plugins", (Bool false)); - ("no_tactics", (Bool false)); - ("normalize_pure_terms_for_extraction", (Bool false)); - ("odir", Unset); - ("prims", Unset); - ("pretype", (Bool true)); - ("prims_ref", Unset); - ("print_bound_var_types", (Bool false)); - ("print_effect_args", (Bool false)); - ("print_expected_failures", (Bool false)); - ("print_full_names", (Bool false)); - ("print_implicits", (Bool false)); - ("print_universes", (Bool false)); - ("print_z3_statistics", (Bool false)); - ("prn", (Bool false)); - ("quake", (Int Prims.int_zero)); - ("quake_lo", (Int Prims.int_one)); - ("quake_hi", (Int Prims.int_one)); - ("quake_keep", (Bool false)); - ("query_stats", (Bool false)); - ("record_hints", (Bool false)); - ("record_options", (Bool false)); - ("report_assumes", Unset); - ("retry", (Bool false)); - ("reuse_hint_for", Unset); - ("silent", (Bool false)); - ("smt", Unset); - ("smtencoding.elim_box", (Bool false)); - ("smtencoding.nl_arith_repr", (String "boxwrap")); - ("smtencoding.l_arith_repr", (String "boxwrap")); - ("smtencoding.valid_intro", (Bool true)); - ("smtencoding.valid_elim", (Bool false)); - ("split_queries", (Bool false)); - ("tactics_failhard", (Bool false)); - ("tactics_info", (Bool false)); - ("tactic_raw_binders", (Bool false)); - ("tactic_trace", (Bool false)); - ("tactic_trace_d", (Int Prims.int_zero)); - ("tcnorm", (Bool true)); - ("timing", (Bool false)); - ("trace_error", (Bool false)); - ("ugly", (Bool false)); - ("unthrottle_inductives", (Bool false)); - ("unsafe_tactic_exec", (Bool false)); - ("use_native_tactics", Unset); - ("use_eq_at_higher_order", (Bool false)); - ("use_hints", (Bool false)); - ("use_hint_hashes", (Bool false)); - ("using_facts_from", Unset); - ("verify_module", (List [])); - ("warn_default_effects", (Bool false)); - ("z3refresh", (Bool false)); - ("z3rlimit", (Int (Prims.of_int (5)))); - ("z3rlimit_factor", (Int Prims.int_one)); - ("z3seed", (Int Prims.int_zero)); - ("z3cliopt", (List [])); - ("z3smtopt", (List [])); - ("__no_positivity", (Bool false)); - ("__tactics_nbe", (Bool false)); - ("warn_error", (List [])); - ("use_nbe", (Bool false)); - ("use_nbe_for_extraction", (Bool false)); - ("trivial_pre_for_unannotated_effectful_fns", (Bool true)); - ("profile_group_by_decl", (Bool false)); - ("profile_component", Unset); - ("profile", Unset)] -let (init : unit -> unit) = - fun uu___ -> - let o = internal_peek () in - FStar_Compiler_Util.smap_clear o; - FStar_Compiler_Effect.op_Bar_Greater defaults - (FStar_Compiler_List.iter set_option') -let (clear : unit -> unit) = - fun uu___ -> - let o = FStar_Compiler_Util.smap_create (Prims.of_int (50)) in - FStar_Compiler_Effect.op_Colon_Equals fstar_options [[o]]; init () -let (_run : unit) = clear () -let (get_option : Prims.string -> option_val) = - fun s -> - let uu___ = - let uu___1 = internal_peek () in - FStar_Compiler_Util.smap_try_find uu___1 s in - match uu___ with - | FStar_Pervasives_Native.None -> - let uu___1 = - let uu___2 = FStar_String.op_Hat s " not found" in - FStar_String.op_Hat "Impossible: option " uu___2 in - failwith uu___1 - | FStar_Pervasives_Native.Some s1 -> s1 -let (set_verification_options : optionstate -> unit) = - fun o -> - let verifopts = - ["initial_fuel"; - "max_fuel"; - "initial_ifuel"; - "max_ifuel"; - "detail_errors"; - "detail_hint_replay"; - "no_smt"; - "quake"; - "retry"; - "smtencoding.elim_box"; - "smtencoding.nl_arith_repr"; - "smtencoding.l_arith_repr"; - "smtencoding.valid_intro"; - "smtencoding.valid_elim"; - "tcnorm"; - "no_plugins"; - "no_tactics"; - "z3cliopt"; - "z3smtopt"; - "z3refresh"; - "z3rlimit"; - "z3rlimit_factor"; - "z3seed"; - "trivial_pre_for_unannotated_effectful_fns"] in - FStar_Compiler_List.iter - (fun k -> - let uu___ = - let uu___1 = FStar_Compiler_Util.smap_try_find o k in - FStar_Compiler_Effect.op_Bar_Greater uu___1 - FStar_Compiler_Util.must in - set_option k uu___) verifopts -let lookup_opt : 'uuuuu . Prims.string -> (option_val -> 'uuuuu) -> 'uuuuu = - fun s -> fun c -> let uu___ = get_option s in c uu___ -let (get_abort_on : unit -> Prims.int) = - fun uu___ -> lookup_opt "abort_on" as_int -let (get_admit_smt_queries : unit -> Prims.bool) = - fun uu___ -> lookup_opt "admit_smt_queries" as_bool -let (get_admit_except : unit -> Prims.string FStar_Pervasives_Native.option) - = fun uu___ -> lookup_opt "admit_except" (as_option as_string) -let (get_compat_pre_core : unit -> Prims.int FStar_Pervasives_Native.option) - = fun uu___ -> lookup_opt "compat_pre_core" (as_option as_int) -let (get_compat_pre_typed_indexed_effects : unit -> Prims.bool) = - fun uu___ -> lookup_opt "compat_pre_typed_indexed_effects" as_bool -let (get_disallow_unification_guards : unit -> Prims.bool) = - fun uu___ -> lookup_opt "disallow_unification_guards" as_bool -let (get_already_cached : - unit -> Prims.string Prims.list FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "already_cached" (as_option (as_list as_string)) -let (get_cache_checked_modules : unit -> Prims.bool) = - fun uu___ -> lookup_opt "cache_checked_modules" as_bool -let (get_cache_dir : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "cache_dir" (as_option as_string) -let (get_cache_off : unit -> Prims.bool) = - fun uu___ -> lookup_opt "cache_off" as_bool -let (get_print_cache_version : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print_cache_version" as_bool -let (get_cmi : unit -> Prims.bool) = fun uu___ -> lookup_opt "cmi" as_bool -let (get_codegen : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "codegen" (as_option as_string) -let (get_codegen_lib : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "codegen-lib" (as_list as_string) -let (get_debug : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "debug" as_comma_string_list -let (get_debug_level : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "debug_level" as_comma_string_list -let (get_defensive : unit -> Prims.string) = - fun uu___ -> lookup_opt "defensive" as_string -let (get_dep : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "dep" (as_option as_string) -let (get_detail_errors : unit -> Prims.bool) = - fun uu___ -> lookup_opt "detail_errors" as_bool -let (get_detail_hint_replay : unit -> Prims.bool) = - fun uu___ -> lookup_opt "detail_hint_replay" as_bool -let (get_dump_module : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "dump_module" (as_list as_string) -let (get_eager_subtyping : unit -> Prims.bool) = - fun uu___ -> lookup_opt "eager_subtyping" as_bool -let (get_error_contexts : unit -> Prims.bool) = - fun uu___ -> lookup_opt "error_contexts" as_bool -let (get_expose_interfaces : unit -> Prims.bool) = - fun uu___ -> lookup_opt "expose_interfaces" as_bool -let (get_extract : - unit -> Prims.string Prims.list FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "extract" (as_option (as_list as_string)) -let (get_extract_module : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "extract_module" (as_list as_string) -let (get_extract_namespace : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "extract_namespace" (as_list as_string) -let (get_force : unit -> Prims.bool) = - fun uu___ -> lookup_opt "force" as_bool -let (get_hide_uvar_nums : unit -> Prims.bool) = - fun uu___ -> lookup_opt "hide_uvar_nums" as_bool -let (get_hint_info : unit -> Prims.bool) = - fun uu___ -> lookup_opt "hint_info" as_bool -let (get_hint_dir : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "hint_dir" (as_option as_string) -let (get_hint_file : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "hint_file" (as_option as_string) -let (get_in : unit -> Prims.bool) = fun uu___ -> lookup_opt "in" as_bool -let (get_ide : unit -> Prims.bool) = fun uu___ -> lookup_opt "ide" as_bool -let (get_ide_id_info_off : unit -> Prims.bool) = - fun uu___ -> lookup_opt "ide_id_info_off" as_bool -let (get_lsp : unit -> Prims.bool) = fun uu___ -> lookup_opt "lsp" as_bool -let (get_include : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "include" (as_list as_string) -let (get_print : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print" as_bool -let (get_print_in_place : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print_in_place" as_bool -let (get_initial_fuel : unit -> Prims.int) = - fun uu___ -> lookup_opt "initial_fuel" as_int -let (get_initial_ifuel : unit -> Prims.int) = - fun uu___ -> lookup_opt "initial_ifuel" as_int -let (get_keep_query_captions : unit -> Prims.bool) = - fun uu___ -> lookup_opt "keep_query_captions" as_bool -let (get_lax : unit -> Prims.bool) = fun uu___ -> lookup_opt "lax" as_bool -let (get_load : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "load" (as_list as_string) -let (get_load_cmxs : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "load_cmxs" (as_list as_string) -let (get_log_queries : unit -> Prims.bool) = - fun uu___ -> lookup_opt "log_queries" as_bool -let (get_log_types : unit -> Prims.bool) = - fun uu___ -> lookup_opt "log_types" as_bool -let (get_max_fuel : unit -> Prims.int) = - fun uu___ -> lookup_opt "max_fuel" as_int -let (get_max_ifuel : unit -> Prims.int) = - fun uu___ -> lookup_opt "max_ifuel" as_int -let (get_MLish : unit -> Prims.bool) = - fun uu___ -> lookup_opt "MLish" as_bool -let (get_no_default_includes : unit -> Prims.bool) = - fun uu___ -> lookup_opt "no_default_includes" as_bool -let (get_no_extract : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "no_extract" (as_list as_string) -let (get_no_location_info : unit -> Prims.bool) = - fun uu___ -> lookup_opt "no_location_info" as_bool -let (get_no_plugins : unit -> Prims.bool) = - fun uu___ -> lookup_opt "no_plugins" as_bool -let (get_no_smt : unit -> Prims.bool) = - fun uu___ -> lookup_opt "no_smt" as_bool -let (get_normalize_pure_terms_for_extraction : unit -> Prims.bool) = - fun uu___ -> lookup_opt "normalize_pure_terms_for_extraction" as_bool -let (get_odir : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "odir" (as_option as_string) -let (get_ugly : unit -> Prims.bool) = fun uu___ -> lookup_opt "ugly" as_bool -let (get_prims : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "prims" (as_option as_string) -let (get_print_bound_var_types : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print_bound_var_types" as_bool -let (get_print_effect_args : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print_effect_args" as_bool -let (get_print_expected_failures : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print_expected_failures" as_bool -let (get_print_full_names : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print_full_names" as_bool -let (get_print_implicits : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print_implicits" as_bool -let (get_print_universes : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print_universes" as_bool -let (get_print_z3_statistics : unit -> Prims.bool) = - fun uu___ -> lookup_opt "print_z3_statistics" as_bool -let (get_prn : unit -> Prims.bool) = fun uu___ -> lookup_opt "prn" as_bool -let (get_quake_lo : unit -> Prims.int) = - fun uu___ -> lookup_opt "quake_lo" as_int -let (get_quake_hi : unit -> Prims.int) = - fun uu___ -> lookup_opt "quake_hi" as_int -let (get_quake_keep : unit -> Prims.bool) = - fun uu___ -> lookup_opt "quake_keep" as_bool -let (get_query_stats : unit -> Prims.bool) = - fun uu___ -> lookup_opt "query_stats" as_bool -let (get_record_hints : unit -> Prims.bool) = - fun uu___ -> lookup_opt "record_hints" as_bool -let (get_record_options : unit -> Prims.bool) = - fun uu___ -> lookup_opt "record_options" as_bool -let (get_retry : unit -> Prims.bool) = - fun uu___ -> lookup_opt "retry" as_bool -let (get_reuse_hint_for : - unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "reuse_hint_for" (as_option as_string) -let (get_report_assumes : - unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "report_assumes" (as_option as_string) -let (get_silent : unit -> Prims.bool) = - fun uu___ -> lookup_opt "silent" as_bool -let (get_smt : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "smt" (as_option as_string) -let (get_smtencoding_elim_box : unit -> Prims.bool) = - fun uu___ -> lookup_opt "smtencoding.elim_box" as_bool -let (get_smtencoding_nl_arith_repr : unit -> Prims.string) = - fun uu___ -> lookup_opt "smtencoding.nl_arith_repr" as_string -let (get_smtencoding_l_arith_repr : unit -> Prims.string) = - fun uu___ -> lookup_opt "smtencoding.l_arith_repr" as_string -let (get_smtencoding_valid_intro : unit -> Prims.bool) = - fun uu___ -> lookup_opt "smtencoding.valid_intro" as_bool -let (get_smtencoding_valid_elim : unit -> Prims.bool) = - fun uu___ -> lookup_opt "smtencoding.valid_elim" as_bool -let (get_split_queries : unit -> Prims.bool) = - fun uu___ -> lookup_opt "split_queries" as_bool -let (get_tactic_raw_binders : unit -> Prims.bool) = - fun uu___ -> lookup_opt "tactic_raw_binders" as_bool -let (get_tactics_failhard : unit -> Prims.bool) = - fun uu___ -> lookup_opt "tactics_failhard" as_bool -let (get_tactics_info : unit -> Prims.bool) = - fun uu___ -> lookup_opt "tactics_info" as_bool -let (get_tactic_trace : unit -> Prims.bool) = - fun uu___ -> lookup_opt "tactic_trace" as_bool -let (get_tactic_trace_d : unit -> Prims.int) = - fun uu___ -> lookup_opt "tactic_trace_d" as_int -let (get_tactics_nbe : unit -> Prims.bool) = - fun uu___ -> lookup_opt "__tactics_nbe" as_bool -let (get_tcnorm : unit -> Prims.bool) = - fun uu___ -> lookup_opt "tcnorm" as_bool -let (get_timing : unit -> Prims.bool) = - fun uu___ -> lookup_opt "timing" as_bool -let (get_trace_error : unit -> Prims.bool) = - fun uu___ -> lookup_opt "trace_error" as_bool -let (get_unthrottle_inductives : unit -> Prims.bool) = - fun uu___ -> lookup_opt "unthrottle_inductives" as_bool -let (get_unsafe_tactic_exec : unit -> Prims.bool) = - fun uu___ -> lookup_opt "unsafe_tactic_exec" as_bool -let (get_use_eq_at_higher_order : unit -> Prims.bool) = - fun uu___ -> lookup_opt "use_eq_at_higher_order" as_bool -let (get_use_hints : unit -> Prims.bool) = - fun uu___ -> lookup_opt "use_hints" as_bool -let (get_use_hint_hashes : unit -> Prims.bool) = - fun uu___ -> lookup_opt "use_hint_hashes" as_bool -let (get_use_native_tactics : - unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "use_native_tactics" (as_option as_string) -let (get_no_tactics : unit -> Prims.bool) = - fun uu___ -> lookup_opt "no_tactics" as_bool -let (get_using_facts_from : - unit -> Prims.string Prims.list FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "using_facts_from" (as_option (as_list as_string)) -let (get_verify_module : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "verify_module" (as_list as_string) -let (get_version : unit -> Prims.bool) = - fun uu___ -> lookup_opt "version" as_bool -let (get_warn_default_effects : unit -> Prims.bool) = - fun uu___ -> lookup_opt "warn_default_effects" as_bool -let (get_z3cliopt : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "z3cliopt" (as_list as_string) -let (get_z3smtopt : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "z3smtopt" (as_list as_string) -let (get_z3refresh : unit -> Prims.bool) = - fun uu___ -> lookup_opt "z3refresh" as_bool -let (get_z3rlimit : unit -> Prims.int) = - fun uu___ -> lookup_opt "z3rlimit" as_int -let (get_z3rlimit_factor : unit -> Prims.int) = - fun uu___ -> lookup_opt "z3rlimit_factor" as_int -let (get_z3seed : unit -> Prims.int) = - fun uu___ -> lookup_opt "z3seed" as_int -let (get_no_positivity : unit -> Prims.bool) = - fun uu___ -> lookup_opt "__no_positivity" as_bool -let (get_warn_error : unit -> Prims.string Prims.list) = - fun uu___ -> lookup_opt "warn_error" (as_list as_string) -let (get_use_nbe : unit -> Prims.bool) = - fun uu___ -> lookup_opt "use_nbe" as_bool -let (get_use_nbe_for_extraction : unit -> Prims.bool) = - fun uu___ -> lookup_opt "use_nbe_for_extraction" as_bool -let (get_trivial_pre_for_unannotated_effectful_fns : unit -> Prims.bool) = - fun uu___ -> lookup_opt "trivial_pre_for_unannotated_effectful_fns" as_bool -let (get_profile : - unit -> Prims.string Prims.list FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "profile" (as_option (as_list as_string)) -let (get_profile_group_by_decl : unit -> Prims.bool) = - fun uu___ -> lookup_opt "profile_group_by_decl" as_bool -let (get_profile_component : - unit -> Prims.string Prims.list FStar_Pervasives_Native.option) = - fun uu___ -> lookup_opt "profile_component" (as_option (as_list as_string)) -let (dlevel : Prims.string -> debug_level_t) = - fun uu___ -> - match uu___ with - | "Low" -> Low - | "Medium" -> Medium - | "High" -> High - | "Extreme" -> Extreme - | s -> Other s -let (one_debug_level_geq : debug_level_t -> debug_level_t -> Prims.bool) = - fun l1 -> - fun l2 -> - match l1 with - | Other uu___ -> l1 = l2 - | Low -> l1 = l2 - | Medium -> (l2 = Low) || (l2 = Medium) - | High -> ((l2 = Low) || (l2 = Medium)) || (l2 = High) - | Extreme -> - (((l2 = Low) || (l2 = Medium)) || (l2 = High)) || (l2 = Extreme) -let (debug_level_geq : debug_level_t -> Prims.bool) = - fun l2 -> - let uu___ = get_debug_level () in - FStar_Compiler_Effect.op_Bar_Greater uu___ - (FStar_Compiler_Util.for_some - (fun l1 -> one_debug_level_geq (dlevel l1) l2)) -let (universe_include_path_base_dirs : Prims.string Prims.list) = - let sub_dirs = ["legacy"; "experimental"; ".cache"] in - FStar_Compiler_Effect.op_Bar_Greater ["/ulib"; "/lib/fstar"] - (FStar_Compiler_List.collect - (fun d -> - let uu___ = - FStar_Compiler_Effect.op_Bar_Greater sub_dirs - (FStar_Compiler_List.map - (fun s -> - let uu___1 = FStar_String.op_Hat "/" s in - FStar_String.op_Hat d uu___1)) in - d :: uu___)) -let (_version : Prims.string FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref "" -let (_platform : Prims.string FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref "" -let (_compiler : Prims.string FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref "" -let (_date : Prims.string FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref " not set" -let (_commit : Prims.string FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref "" -let (display_version : unit -> unit) = - fun uu___ -> - let uu___1 = - let uu___2 = FStar_Compiler_Effect.op_Bang _version in - let uu___3 = FStar_Compiler_Effect.op_Bang _platform in - let uu___4 = FStar_Compiler_Effect.op_Bang _compiler in - let uu___5 = FStar_Compiler_Effect.op_Bang _date in - let uu___6 = FStar_Compiler_Effect.op_Bang _commit in - FStar_Compiler_Util.format5 - "F* %s\nplatform=%s\ncompiler=%s\ndate=%s\ncommit=%s\n" uu___2 uu___3 - uu___4 uu___5 uu___6 in - FStar_Compiler_Util.print_string uu___1 -let display_usage_aux : - 'uuuuu 'uuuuu1 . - ('uuuuu * Prims.string * 'uuuuu1 FStar_Getopt.opt_variant * Prims.string) - Prims.list -> unit - = - fun specs -> - FStar_Compiler_Util.print_string - "fstar.exe [options] file[s] [@respfile...]\n"; - (let uu___2 = - let uu___3 = FStar_Compiler_Util.colorize_bold "@" in - FStar_Compiler_Util.format1 - " %srespfile read options from respfile\n" uu___3 in - FStar_Compiler_Util.print_string uu___2); - FStar_Compiler_List.iter - (fun uu___2 -> - match uu___2 with - | (uu___3, flag, p, doc) -> - (match p with - | FStar_Getopt.ZeroArgs ig -> - if doc = "" - then - let uu___4 = - let uu___5 = FStar_Compiler_Util.colorize_bold flag in - FStar_Compiler_Util.format1 " --%s\n" uu___5 in - FStar_Compiler_Util.print_string uu___4 - else - (let uu___5 = - let uu___6 = FStar_Compiler_Util.colorize_bold flag in - FStar_Compiler_Util.format2 " --%s %s\n" uu___6 doc in - FStar_Compiler_Util.print_string uu___5) - | FStar_Getopt.OneArg (uu___4, argname) -> - if doc = "" - then - let uu___5 = - let uu___6 = FStar_Compiler_Util.colorize_bold flag in - let uu___7 = FStar_Compiler_Util.colorize_bold argname in - FStar_Compiler_Util.format2 " --%s %s\n" uu___6 uu___7 in - FStar_Compiler_Util.print_string uu___5 - else - (let uu___6 = - let uu___7 = FStar_Compiler_Util.colorize_bold flag in - let uu___8 = FStar_Compiler_Util.colorize_bold argname in - FStar_Compiler_Util.format3 " --%s %s %s\n" uu___7 - uu___8 doc in - FStar_Compiler_Util.print_string uu___6))) specs -let (mk_spec : - (FStar_BaseTypes.char * Prims.string * option_val FStar_Getopt.opt_variant - * Prims.string) -> FStar_Getopt.opt) - = - fun o -> - let uu___ = o in - match uu___ with - | (ns, name, arg, desc) -> - let arg1 = - match arg with - | FStar_Getopt.ZeroArgs f -> - let g uu___1 = let uu___2 = f () in set_option name uu___2 in - FStar_Getopt.ZeroArgs g - | FStar_Getopt.OneArg (f, d) -> - let g x = let uu___1 = f x in set_option name uu___1 in - FStar_Getopt.OneArg (g, d) in - (ns, name, arg1, desc) -let (accumulated_option : Prims.string -> option_val -> option_val) = - fun name -> - fun value -> - let prev_values = - let uu___ = lookup_opt name (as_option as_list') in - FStar_Compiler_Util.dflt [] uu___ in - List (value :: prev_values) -let (reverse_accumulated_option : Prims.string -> option_val -> option_val) = - fun name -> - fun value -> - let prev_values = - let uu___ = lookup_opt name (as_option as_list') in - FStar_Compiler_Util.dflt [] uu___ in - List (FStar_Compiler_List.op_At prev_values [value]) -let accumulate_string : - 'uuuuu . Prims.string -> ('uuuuu -> Prims.string) -> 'uuuuu -> unit = - fun name -> - fun post_processor -> - fun value -> - let uu___ = - let uu___1 = let uu___2 = post_processor value in String uu___2 in - accumulated_option name uu___1 in - set_option name uu___ -let (add_extract_module : Prims.string -> unit) = - fun s -> accumulate_string "extract_module" FStar_String.lowercase s -let (add_extract_namespace : Prims.string -> unit) = - fun s -> accumulate_string "extract_namespace" FStar_String.lowercase s -let (add_verify_module : Prims.string -> unit) = - fun s -> accumulate_string "verify_module" FStar_String.lowercase s -exception InvalidArgument of Prims.string -let (uu___is_InvalidArgument : Prims.exn -> Prims.bool) = - fun projectee -> - match projectee with | InvalidArgument uu___ -> true | uu___ -> false -let (__proj__InvalidArgument__item__uu___ : Prims.exn -> Prims.string) = - fun projectee -> match projectee with | InvalidArgument uu___ -> uu___ -let rec (parse_opt_val : - Prims.string -> opt_type -> Prims.string -> option_val) = - fun opt_name -> - fun typ -> - fun str_val -> - try - (fun uu___ -> - match () with - | () -> - (match typ with - | Const c -> c - | IntStr uu___1 -> - let uu___2 = - FStar_Compiler_Util.safe_int_of_string str_val in - (match uu___2 with - | FStar_Pervasives_Native.Some v -> Int v - | FStar_Pervasives_Native.None -> - FStar_Compiler_Effect.raise - (InvalidArgument opt_name)) - | BoolStr -> - let uu___1 = - if str_val = "true" - then true - else - if str_val = "false" - then false - else - FStar_Compiler_Effect.raise - (InvalidArgument opt_name) in - Bool uu___1 - | PathStr uu___1 -> Path str_val - | SimpleStr uu___1 -> String str_val - | EnumStr strs -> - if FStar_Compiler_List.mem str_val strs - then String str_val - else - FStar_Compiler_Effect.raise - (InvalidArgument opt_name) - | OpenEnumStr uu___1 -> String str_val - | PostProcessed (pp, elem_spec) -> - let uu___1 = parse_opt_val opt_name elem_spec str_val in - pp uu___1 - | Accumulated elem_spec -> - let v = parse_opt_val opt_name elem_spec str_val in - accumulated_option opt_name v - | ReverseAccumulated elem_spec -> - let v = parse_opt_val opt_name elem_spec str_val in - reverse_accumulated_option opt_name v - | WithSideEffect (side_effect, elem_spec) -> - (side_effect (); - parse_opt_val opt_name elem_spec str_val))) () - with - | InvalidArgument opt_name1 -> - let uu___1 = - FStar_Compiler_Util.format1 "Invalid argument to --%s" - opt_name1 in - failwith uu___1 -let rec (desc_of_opt_type : - opt_type -> Prims.string FStar_Pervasives_Native.option) = - fun typ -> - let desc_of_enum cases = - let uu___ = - let uu___1 = FStar_String.op_Hat (FStar_String.concat "|" cases) "]" in - FStar_String.op_Hat "[" uu___1 in - FStar_Pervasives_Native.Some uu___ in - match typ with - | Const c -> FStar_Pervasives_Native.None - | IntStr desc -> FStar_Pervasives_Native.Some desc - | BoolStr -> desc_of_enum ["true"; "false"] - | PathStr desc -> FStar_Pervasives_Native.Some desc - | SimpleStr desc -> FStar_Pervasives_Native.Some desc - | EnumStr strs -> desc_of_enum strs - | OpenEnumStr (strs, desc) -> - desc_of_enum (FStar_Compiler_List.op_At strs [desc]) - | PostProcessed (uu___, elem_spec) -> desc_of_opt_type elem_spec - | Accumulated elem_spec -> desc_of_opt_type elem_spec - | ReverseAccumulated elem_spec -> desc_of_opt_type elem_spec - | WithSideEffect (uu___, elem_spec) -> desc_of_opt_type elem_spec -let (arg_spec_of_opt_type : - Prims.string -> opt_type -> option_val FStar_Getopt.opt_variant) = - fun opt_name -> - fun typ -> - let parser = parse_opt_val opt_name typ in - let uu___ = desc_of_opt_type typ in - match uu___ with - | FStar_Pervasives_Native.None -> - FStar_Getopt.ZeroArgs ((fun uu___1 -> parser "")) - | FStar_Pervasives_Native.Some desc -> - FStar_Getopt.OneArg (parser, desc) -let (pp_validate_dir : option_val -> option_val) = - fun p -> let pp = as_string p in FStar_Compiler_Util.mkdir false pp; p -let (pp_lowercase : option_val -> option_val) = - fun s -> - let uu___ = let uu___1 = as_string s in FStar_String.lowercase uu___1 in - String uu___ -let (abort_counter : Prims.int FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref Prims.int_zero -let (interp_quake_arg : Prims.string -> (Prims.int * Prims.int * Prims.bool)) - = - fun s -> - let ios = FStar_Compiler_Util.int_of_string in - match FStar_Compiler_Util.split s "/" with - | f::[] -> - let uu___ = ios f in let uu___1 = ios f in (uu___, uu___1, false) - | f1::f2::[] -> - if f2 = "k" - then - let uu___ = ios f1 in let uu___1 = ios f1 in (uu___, uu___1, true) - else - (let uu___1 = ios f1 in - let uu___2 = ios f2 in (uu___1, uu___2, false)) - | f1::f2::k::[] -> - if k = "k" - then - let uu___ = ios f1 in let uu___1 = ios f2 in (uu___, uu___1, true) - else failwith "unexpected value for --quake" - | uu___ -> failwith "unexpected value for --quake" -let (uu___447 : (((Prims.string -> unit) -> unit) * (Prims.string -> unit))) - = - let cb = FStar_Compiler_Util.mk_ref FStar_Pervasives_Native.None in - let set1 f = - FStar_Compiler_Effect.op_Colon_Equals cb (FStar_Pervasives_Native.Some f) in - let call msg = - let uu___ = FStar_Compiler_Effect.op_Bang cb in - match uu___ with - | FStar_Pervasives_Native.None -> () - | FStar_Pervasives_Native.Some f -> f msg in - (set1, call) -let (set_option_warning_callback_aux : (Prims.string -> unit) -> unit) = - match uu___447 with - | (set_option_warning_callback_aux1, option_warning_callback) -> - set_option_warning_callback_aux1 -let (option_warning_callback : Prims.string -> unit) = - match uu___447 with - | (set_option_warning_callback_aux1, option_warning_callback1) -> - option_warning_callback1 -let (set_option_warning_callback : (Prims.string -> unit) -> unit) = - fun f -> set_option_warning_callback_aux f -let rec (specs_with_types : - Prims.bool -> - (FStar_BaseTypes.char * Prims.string * opt_type * Prims.string) - Prims.list) - = - fun warn_unsafe -> - [(FStar_Getopt.noshort, "abort_on", - (PostProcessed - (((fun uu___ -> - match uu___ with - | Int x -> - (FStar_Compiler_Effect.op_Colon_Equals abort_counter x; - Int x) - | x -> failwith "?")), (IntStr "non-negative integer"))), - "Abort on the n-th error or warning raised. Useful in combination with --trace_error. Count starts at 1, use 0 to disable. (default 0)"); - (FStar_Getopt.noshort, "admit_smt_queries", - (WithSideEffect - (((fun uu___ -> - if warn_unsafe - then option_warning_callback "admit_smt_queries" - else ())), BoolStr)), - "Admit SMT queries, unsafe! (default 'false')"); - (FStar_Getopt.noshort, "admit_except", - (WithSideEffect - (((fun uu___ -> - if warn_unsafe - then option_warning_callback "admit_except" - else ())), (SimpleStr "[symbol|(symbol, id)]"))), - "Admit all queries, except those with label ( symbol, id)) (e.g. --admit_except '(FStar.Fin.pigeonhole, 1)' or --admit_except FStar.Fin.pigeonhole)"); - (FStar_Getopt.noshort, "compat_pre_core", (IntStr "0, 1, 2"), - "Retain behavior of the tactic engine prior to the introduction of FStar.TypeChecker.Core (0 is most permissive, 2 is least permissive)"); - (FStar_Getopt.noshort, "compat_pre_typed_indexed_effects", - (Const (Bool true)), "Retain untyped indexed effects implicits"); - (FStar_Getopt.noshort, "disallow_unification_guards", BoolStr, - "Fail if the SMT guard are produced when the tactic engine re-checks solutions produced by the unifier (default 'false')"); - (FStar_Getopt.noshort, "already_cached", - (Accumulated - (SimpleStr - "One or more space-separated occurrences of '[+|-]( * | namespace | module)'")), - "\n\t\tExpects all modules whose names or namespaces match the provided options \n\t\t\tto already have valid .checked files in the include path"); - (FStar_Getopt.noshort, "cache_checked_modules", (Const (Bool true)), - "Write a '.checked' file for each module after verification and read from it if present, instead of re-verifying"); - (FStar_Getopt.noshort, "cache_dir", - (PostProcessed (pp_validate_dir, (PathStr "dir"))), - "Read and write .checked and .checked.lax in directory dir"); - (FStar_Getopt.noshort, "cache_off", (Const (Bool true)), - "Do not read or write any .checked files"); - (FStar_Getopt.noshort, "print_cache_version", (Const (Bool true)), - "Print the version for .checked files and exit."); - (FStar_Getopt.noshort, "cmi", (Const (Bool true)), - "Inline across module interfaces during extraction (aka. cross-module inlining)"); - (FStar_Getopt.noshort, "codegen", - (EnumStr ["OCaml"; "FSharp"; "krml"; "Plugin"]), - "Generate code for further compilation to executable code, or build a compiler plugin"); - (FStar_Getopt.noshort, "codegen-lib", - (Accumulated (SimpleStr "namespace")), - "External runtime library (i.e. M.N.x extracts to M.N.X instead of M_N.x)"); - (FStar_Getopt.noshort, "debug", (Accumulated (SimpleStr "module_name")), - "Print lots of debugging information while checking module"); - (FStar_Getopt.noshort, "debug_level", - (Accumulated - (OpenEnumStr (["Low"; "Medium"; "High"; "Extreme"], "..."))), - "Control the verbosity of debugging info"); - (FStar_Getopt.noshort, "defensive", - (EnumStr ["no"; "warn"; "error"; "abort"]), - "Enable several internal sanity checks, useful to track bugs and report issues.\n\t\tif 'no', no checks are performed\n\t\tif 'warn', checks are performed and raise a warning when they fail\n\t\tif 'error, like 'warn', but the compiler raises a hard error instead \n\t\tif 'abort, like 'warn', but the compiler immediately aborts on an error\n\t\t(default 'no')"); - (FStar_Getopt.noshort, "dep", (EnumStr ["make"; "graph"; "full"; "raw"]), - "Output the transitive closure of the full dependency graph in three formats:\n\t 'graph': a format suitable the 'dot' tool from 'GraphViz'\n\t 'full': a format suitable for 'make', including dependences for producing .ml and .krml files\n\t 'make': (deprecated) a format suitable for 'make', including only dependences among source files"); - (FStar_Getopt.noshort, "detail_errors", (Const (Bool true)), - "Emit a detailed error report by asking the SMT solver many queries; will take longer"); - (FStar_Getopt.noshort, "detail_hint_replay", (Const (Bool true)), - "Emit a detailed report for proof whose unsat core fails to replay"); - (FStar_Getopt.noshort, "dump_module", - (Accumulated (SimpleStr "module_name")), ""); - (FStar_Getopt.noshort, "eager_subtyping", (Const (Bool true)), - "Try to solve subtyping constraints at each binder (loses precision but may be slightly more efficient)"); - (FStar_Getopt.noshort, "error_contexts", BoolStr, - "Print context information for each error or warning raised (default false)"); - (FStar_Getopt.noshort, "extract", - (Accumulated - (SimpleStr - "One or more semicolon separated occurrences of '[TargetName:]ModuleSelector'")), - "\n\t\tExtract only those modules whose names or namespaces match the provided options.\n\t\t\t'TargetName' ranges over {OCaml, krml, FSharp, Plugin}.\n\t\t\tA 'ModuleSelector' is a space or comma-separated list of '[+|-]( * | namespace | module)'.\n\t\t\tFor example --extract 'OCaml:A -A.B' --extract 'krml:A -A.C' --extract '*' means\n\t\t\t\tfor OCaml, extract everything in the A namespace only except A.B;\n\t\t\t\tfor krml, extract everything in the A namespace only except A.C;\n\t\t\t\tfor everything else, extract everything.\n\t\t\tNote, the '+' is optional: --extract '+A' and --extract 'A' mean the same thing.\n\t\t\tNote also that '--extract A' applies both to a module named 'A' and to any module in the 'A' namespace\n\t\tMultiple uses of this option accumulate, e.g., --extract A --extract B is interpreted as --extract 'A B'."); - (FStar_Getopt.noshort, "extract_module", - (Accumulated (PostProcessed (pp_lowercase, (SimpleStr "module_name")))), - "Deprecated: use --extract instead; Only extract the specified modules (instead of the possibly-partial dependency graph)"); - (FStar_Getopt.noshort, "extract_namespace", - (Accumulated - (PostProcessed (pp_lowercase, (SimpleStr "namespace name")))), - "Deprecated: use --extract instead; Only extract modules in the specified namespace"); - (FStar_Getopt.noshort, "expose_interfaces", (Const (Bool true)), - "Explicitly break the abstraction imposed by the interface of any implementation file that appears on the command line (use with care!)"); - (FStar_Getopt.noshort, "hide_uvar_nums", (Const (Bool true)), - "Don't print unification variable numbers"); - (FStar_Getopt.noshort, "hint_dir", - (PostProcessed (pp_validate_dir, (PathStr "dir"))), - "Read/write hints to dir/module_name.hints (instead of placing hint-file alongside source file)"); - (FStar_Getopt.noshort, "hint_file", (PathStr "path"), - "Read/write hints to path (instead of module-specific hints files; overrides hint_dir)"); - (FStar_Getopt.noshort, "hint_info", (Const (Bool true)), - "Print information regarding hints (deprecated; use --query_stats instead)"); - (FStar_Getopt.noshort, "in", (Const (Bool true)), - "Legacy interactive mode; reads input from stdin"); - (FStar_Getopt.noshort, "ide", (Const (Bool true)), - "JSON-based interactive mode for IDEs"); - (FStar_Getopt.noshort, "ide_id_info_off", (Const (Bool true)), - "Disable identifier tables in IDE mode (temporary workaround useful in Steel)"); - (FStar_Getopt.noshort, "lsp", (Const (Bool true)), - "Language Server Protocol-based interactive mode for IDEs"); - (FStar_Getopt.noshort, "include", (ReverseAccumulated (PathStr "path")), - "A directory in which to search for files included on the command line"); - (FStar_Getopt.noshort, "print", (Const (Bool true)), - "Parses and prettyprints the files included on the command line"); - (FStar_Getopt.noshort, "print_in_place", (Const (Bool true)), - "Parses and prettyprints in place the files included on the command line"); - (102, "force", (Const (Bool true)), - "Force checking the files given as arguments even if they have valid checked files"); - (FStar_Getopt.noshort, "fuel", - (PostProcessed - (((fun uu___ -> - match uu___ with - | String s -> - let p f = - let uu___1 = FStar_Compiler_Util.int_of_string f in - Int uu___1 in - let uu___1 = - match FStar_Compiler_Util.split s "," with - | f::[] -> (f, f) - | f1::f2::[] -> (f1, f2) - | uu___2 -> failwith "unexpected value for --fuel" in - (match uu___1 with - | (min, max) -> - ((let uu___3 = p min in - set_option "initial_fuel" uu___3); - (let uu___4 = p max in set_option "max_fuel" uu___4); - String s)) - | uu___1 -> failwith "impos")), - (SimpleStr "non-negative integer or pair of non-negative integers"))), - "Set initial_fuel and max_fuel at once"); - (FStar_Getopt.noshort, "ifuel", - (PostProcessed - (((fun uu___ -> - match uu___ with - | String s -> - let p f = - let uu___1 = FStar_Compiler_Util.int_of_string f in - Int uu___1 in - let uu___1 = - match FStar_Compiler_Util.split s "," with - | f::[] -> (f, f) - | f1::f2::[] -> (f1, f2) - | uu___2 -> failwith "unexpected value for --ifuel" in - (match uu___1 with - | (min, max) -> - ((let uu___3 = p min in - set_option "initial_ifuel" uu___3); - (let uu___4 = p max in set_option "max_ifuel" uu___4); - String s)) - | uu___1 -> failwith "impos")), - (SimpleStr "non-negative integer or pair of non-negative integers"))), - "Set initial_ifuel and max_ifuel at once"); - (FStar_Getopt.noshort, "initial_fuel", (IntStr "non-negative integer"), - "Number of unrolling of recursive functions to try initially (default 2)"); - (FStar_Getopt.noshort, "initial_ifuel", (IntStr "non-negative integer"), - "Number of unrolling of inductive datatypes to try at first (default 1)"); - (FStar_Getopt.noshort, "keep_query_captions", BoolStr, - "Retain comments in the logged SMT queries (requires --log_queries; default true)"); - (FStar_Getopt.noshort, "lax", - (WithSideEffect - (((fun uu___ -> - if warn_unsafe then option_warning_callback "lax" else ())), - (Const (Bool true)))), - "Run the lax-type checker only (admit all verification conditions)"); - (FStar_Getopt.noshort, "load", (ReverseAccumulated (PathStr "module")), - "Load OCaml module, compiling it if necessary"); - (FStar_Getopt.noshort, "load_cmxs", - (ReverseAccumulated (PathStr "module")), - "Load compiled module, fails hard if the module is not already compiled"); - (FStar_Getopt.noshort, "log_types", (Const (Bool true)), - "Print types computed for data/val/let-bindings"); - (FStar_Getopt.noshort, "log_queries", (Const (Bool true)), - "Log the Z3 queries in several queries-*.smt2 files, as we go"); - (FStar_Getopt.noshort, "max_fuel", (IntStr "non-negative integer"), - "Number of unrolling of recursive functions to try at most (default 8)"); - (FStar_Getopt.noshort, "max_ifuel", (IntStr "non-negative integer"), - "Number of unrolling of inductive datatypes to try at most (default 2)"); - (FStar_Getopt.noshort, "MLish", (Const (Bool true)), - "Trigger various specializations for compiling the F* compiler itself (not meant for user code)"); - (FStar_Getopt.noshort, "no_default_includes", (Const (Bool true)), - "Ignore the default module search paths"); - (FStar_Getopt.noshort, "no_extract", - (Accumulated (PathStr "module name")), - "Deprecated: use --extract instead; Do not extract code from this module"); - (FStar_Getopt.noshort, "no_location_info", (Const (Bool true)), - "Suppress location information in the generated OCaml output (only relevant with --codegen OCaml)"); - (FStar_Getopt.noshort, "no_smt", (Const (Bool true)), - "Do not send any queries to the SMT solver, and fail on them instead"); - (FStar_Getopt.noshort, "normalize_pure_terms_for_extraction", - (Const (Bool true)), - "Extract top-level pure terms after normalizing them. This can lead to very large code, but can result in more partial evaluation and compile-time specialization."); - (FStar_Getopt.noshort, "odir", - (PostProcessed (pp_validate_dir, (PathStr "dir"))), - "Place output in directory dir"); - (FStar_Getopt.noshort, "prims", (PathStr "file"), ""); - (FStar_Getopt.noshort, "print_bound_var_types", (Const (Bool true)), - "Print the types of bound variables"); - (FStar_Getopt.noshort, "print_effect_args", (Const (Bool true)), - "Print inferred predicate transformers for all computation types"); - (FStar_Getopt.noshort, "print_expected_failures", (Const (Bool true)), - "Print the errors generated by declarations marked with expect_failure, useful for debugging error locations"); - (FStar_Getopt.noshort, "print_full_names", (Const (Bool true)), - "Print full names of variables"); - (FStar_Getopt.noshort, "print_implicits", (Const (Bool true)), - "Print implicit arguments"); - (FStar_Getopt.noshort, "print_universes", (Const (Bool true)), - "Print universes"); - (FStar_Getopt.noshort, "print_z3_statistics", (Const (Bool true)), - "Print Z3 statistics for each SMT query (details such as relevant modules, facts, etc. for each proof)"); - (FStar_Getopt.noshort, "prn", (Const (Bool true)), - "Print full names (deprecated; use --print_full_names instead)"); - (FStar_Getopt.noshort, "quake", - (PostProcessed - (((fun uu___ -> - match uu___ with - | String s -> - let uu___1 = interp_quake_arg s in - (match uu___1 with - | (min, max, k) -> - (set_option "quake_lo" (Int min); - set_option "quake_hi" (Int max); - set_option "quake_keep" (Bool k); - set_option "retry" (Bool false); - String s)) - | uu___1 -> failwith "impos")), - (SimpleStr "positive integer or pair of positive integers"))), - "Repeats SMT queries to check for robustness\n\t\t--quake N/M repeats each query checks that it succeeds at least N out of M times, aborting early if possible\n\t\t--quake N/M/k works as above, except it will unconditionally run M times\n\t\t--quake N is an alias for --quake N/N\n\t\t--quake N/k is an alias for --quake N/N/k\n\tUsing --quake disables --retry."); - (FStar_Getopt.noshort, "query_stats", (Const (Bool true)), - "Print SMT query statistics"); - (FStar_Getopt.noshort, "record_hints", (Const (Bool true)), - "Record a database of hints for efficient proof replay"); - (FStar_Getopt.noshort, "record_options", (Const (Bool true)), - "Record the state of options used to check each sigelt, useful for the `check_with` attribute and metaprogramming"); - (FStar_Getopt.noshort, "retry", - (PostProcessed - (((fun uu___ -> - match uu___ with - | Int i -> - (set_option "quake_lo" (Int Prims.int_one); - set_option "quake_hi" (Int i); - set_option "quake_keep" (Bool false); - set_option "retry" (Bool true); - Bool true) - | uu___1 -> failwith "impos")), (IntStr "positive integer"))), - "Retry each SMT query N times and succeed on the first try. Using --retry disables --quake."); - (FStar_Getopt.noshort, "reuse_hint_for", (SimpleStr "toplevel_name"), - "Optimistically, attempt using the recorded hint for toplevel_name (a top-level name in the current module) when trying to verify some other term 'g'"); - (FStar_Getopt.noshort, "report_assumes", (EnumStr ["warn"; "error"]), - "Report every use of an escape hatch, include assume, admit, etc."); - (FStar_Getopt.noshort, "silent", (Const (Bool true)), - "Disable all non-critical output"); - (FStar_Getopt.noshort, "smt", (PathStr "path"), - "Path to the Z3 SMT solver (we could eventually support other solvers)"); - (FStar_Getopt.noshort, "smtencoding.elim_box", BoolStr, - "Toggle a peephole optimization that eliminates redundant uses of boxing/unboxing in the SMT encoding (default 'false')"); - (FStar_Getopt.noshort, "smtencoding.nl_arith_repr", - (EnumStr ["native"; "wrapped"; "boxwrap"]), - "Control the representation of non-linear arithmetic functions in the SMT encoding:\n\t\ti.e., if 'boxwrap' use 'Prims.op_Multiply, Prims.op_Division, Prims.op_Modulus'; \n\t\tif 'native' use '*, div, mod';\n\t\tif 'wrapped' use '_mul, _div, _mod : Int*Int -> Int'; \n\t\t(default 'boxwrap')"); - (FStar_Getopt.noshort, "smtencoding.l_arith_repr", - (EnumStr ["native"; "boxwrap"]), - "Toggle the representation of linear arithmetic functions in the SMT encoding:\n\t\ti.e., if 'boxwrap', use 'Prims.op_Addition, Prims.op_Subtraction, Prims.op_Minus'; \n\t\tif 'native', use '+, -, -'; \n\t\t(default 'boxwrap')"); - (FStar_Getopt.noshort, "smtencoding.valid_intro", BoolStr, - "Include an axiom in the SMT encoding to introduce proof-irrelevance from a constructive proof"); - (FStar_Getopt.noshort, "smtencoding.valid_elim", BoolStr, - "Include an axiom in the SMT encoding to eliminate proof-irrelevance into the existence of a proof witness"); - (FStar_Getopt.noshort, "split_queries", (Const (Bool true)), - "Split SMT verification conditions into several separate queries, one per goal"); - (FStar_Getopt.noshort, "tactic_raw_binders", (Const (Bool true)), - "Do not use the lexical scope of tactics to improve binder names"); - (FStar_Getopt.noshort, "tactics_failhard", (Const (Bool true)), - "Do not recover from metaprogramming errors, and abort if one occurs"); - (FStar_Getopt.noshort, "tactics_info", (Const (Bool true)), - "Print some rough information on tactics, such as the time they take to run"); - (FStar_Getopt.noshort, "tactic_trace", (Const (Bool true)), - "Print a depth-indexed trace of tactic execution (Warning: very verbose)"); - (FStar_Getopt.noshort, "tactic_trace_d", (IntStr "positive_integer"), - "Trace tactics up to a certain binding depth"); - (FStar_Getopt.noshort, "__tactics_nbe", (Const (Bool true)), - "Use NBE to evaluate metaprograms (experimental)"); - (FStar_Getopt.noshort, "tcnorm", BoolStr, - "Attempt to normalize definitions marked as tcnorm (default 'true')"); - (FStar_Getopt.noshort, "timing", (Const (Bool true)), - "Print the time it takes to verify each top-level definition.\n\t\tThis is just an alias for an invocation of the profiler, so it may not work well if combined with --profile.\n\t\tIn particular, it implies --profile_group_by_decls."); - (FStar_Getopt.noshort, "trace_error", (Const (Bool true)), - "Don't print an error message; show an exception trace instead"); - (FStar_Getopt.noshort, "ugly", (Const (Bool true)), - "Emit output formatted for debugging"); - (FStar_Getopt.noshort, "unthrottle_inductives", (Const (Bool true)), - "Let the SMT solver unfold inductive types to arbitrary depths (may affect verifier performance)"); - (FStar_Getopt.noshort, "unsafe_tactic_exec", (Const (Bool true)), - "Allow tactics to run external processes. WARNING: checking an untrusted F* file while using this option can have disastrous effects."); - (FStar_Getopt.noshort, "use_eq_at_higher_order", (Const (Bool true)), - "Use equality constraints when comparing higher-order types (Temporary)"); - (FStar_Getopt.noshort, "use_hints", (Const (Bool true)), - "Use a previously recorded hints database for proof replay"); - (FStar_Getopt.noshort, "use_hint_hashes", (Const (Bool true)), - "Admit queries if their hash matches the hash recorded in the hints database"); - (FStar_Getopt.noshort, "use_native_tactics", (PathStr "path"), - "Use compiled tactics from path"); - (FStar_Getopt.noshort, "no_plugins", (Const (Bool true)), - "Do not run plugins natively and interpret them as usual instead"); - (FStar_Getopt.noshort, "no_tactics", (Const (Bool true)), - "Do not run the tactic engine before discharging a VC"); - (FStar_Getopt.noshort, "using_facts_from", - (ReverseAccumulated - (SimpleStr - "One or more space-separated occurrences of '[+|-]( * | namespace | fact id)'")), - "\n\t\tPrunes the context to include only the facts from the given namespace or fact id. \n\t\t\tFacts can be include or excluded using the [+|-] qualifier. \n\t\t\tFor example --using_facts_from '* -FStar.Reflection +FStar.Compiler.List -FStar.Compiler.List.Tot' will \n\t\t\t\tremove all facts from FStar.Compiler.List.Tot.*, \n\t\t\t\tretain all remaining facts from FStar.Compiler.List.*, \n\t\t\t\tremove all facts from FStar.Reflection.*, \n\t\t\t\tand retain all the rest.\n\t\tNote, the '+' is optional: --using_facts_from 'FStar.Compiler.List' is equivalent to --using_facts_from '+FStar.Compiler.List'. \n\t\tMultiple uses of this option accumulate, e.g., --using_facts_from A --using_facts_from B is interpreted as --using_facts_from A^B."); - (FStar_Getopt.noshort, "__temp_fast_implicits", (Const (Bool true)), - "Don't use this option yet"); - (118, "version", - (WithSideEffect - (((fun uu___ -> - display_version (); FStar_Compiler_Effect.exit Prims.int_zero)), - (Const (Bool true)))), "Display version number"); - (FStar_Getopt.noshort, "warn_default_effects", (Const (Bool true)), - "Warn when (a -> b) is desugared to (a -> Tot b)"); - (FStar_Getopt.noshort, "z3cliopt", - (ReverseAccumulated (SimpleStr "option")), "Z3 command line options"); - (FStar_Getopt.noshort, "z3smtopt", - (ReverseAccumulated (SimpleStr "option")), "Z3 options in smt2 format"); - (FStar_Getopt.noshort, "z3refresh", (Const (Bool true)), - "Restart Z3 after each query; useful for ensuring proof robustness"); - (FStar_Getopt.noshort, "z3rlimit", (IntStr "positive_integer"), - "Set the Z3 per-query resource limit (default 5 units, taking roughtly 5s)"); - (FStar_Getopt.noshort, "z3rlimit_factor", (IntStr "positive_integer"), - "Set the Z3 per-query resource limit multiplier. This is useful when, say, regenerating hints and you want to be more lax. (default 1)"); - (FStar_Getopt.noshort, "z3seed", (IntStr "positive_integer"), - "Set the Z3 random seed (default 0)"); - (FStar_Getopt.noshort, "__no_positivity", - (WithSideEffect - (((fun uu___ -> - if warn_unsafe - then option_warning_callback "__no_positivity" - else ())), (Const (Bool true)))), - "Don't check positivity of inductive types"); - (FStar_Getopt.noshort, "warn_error", (Accumulated (SimpleStr "")), - "The [-warn_error] option follows the OCaml syntax, namely:\n\t\t- [r] is a range of warnings (either a number [n], or a range [n..n])\n\t\t- [-r] silences range [r]\n\t\t- [+r] enables range [r]\n\t\t- [@r] makes range [r] fatal."); - (FStar_Getopt.noshort, "use_nbe", BoolStr, - "Use normalization by evaluation as the default normalization strategy (default 'false')"); - (FStar_Getopt.noshort, "use_nbe_for_extraction", BoolStr, - "Use normalization by evaluation for normalizing terms before extraction (default 'false')"); - (FStar_Getopt.noshort, "trivial_pre_for_unannotated_effectful_fns", - BoolStr, - "Enforce trivial preconditions for unannotated effectful functions (default 'true')"); - (FStar_Getopt.noshort, "__debug_embedding", - (WithSideEffect - (((fun uu___ -> - FStar_Compiler_Effect.op_Colon_Equals debug_embedding true)), - (Const (Bool true)))), - "Debug messages for embeddings/unembeddings of natively compiled terms"); - (FStar_Getopt.noshort, "eager_embedding", - (WithSideEffect - (((fun uu___ -> - FStar_Compiler_Effect.op_Colon_Equals eager_embedding true)), - (Const (Bool true)))), - "Eagerly embed and unembed terms to primitive operations and plugins: not recommended except for benchmarking"); - (FStar_Getopt.noshort, "profile_group_by_decl", (Const (Bool true)), - "Emit profiles grouped by declaration rather than by module"); - (FStar_Getopt.noshort, "profile_component", - (Accumulated - (SimpleStr - "One or more space-separated occurrences of '[+|-]( * | namespace | module | identifier)'")), - "\n\tSpecific source locations in the compiler are instrumented with profiling counters.\n\tPass `--profile_component FStar.TypeChecker` to enable all counters in the FStar.TypeChecker namespace.\n\tThis option is a module or namespace selector, like many other options (e.g., `--extract`)"); - (FStar_Getopt.noshort, "profile", - (Accumulated - (SimpleStr - "One or more space-separated occurrences of '[+|-]( * | namespace | module)'")), - "\n\tProfiling can be enabled when the compiler is processing a given set of source modules.\n\tPass `--profile FStar.Pervasives` to enable profiling when the compiler is processing any module in FStar.Pervasives.\n\tThis option is a module or namespace selector, like many other options (e.g., `--extract`)"); - (104, "help", - (WithSideEffect - (((fun uu___ -> - (let uu___2 = specs warn_unsafe in display_usage_aux uu___2); - FStar_Compiler_Effect.exit Prims.int_zero)), - (Const (Bool true)))), "Display this information")] -and (specs : Prims.bool -> FStar_Getopt.opt Prims.list) = - fun warn_unsafe -> - let uu___ = specs_with_types warn_unsafe in - FStar_Compiler_List.map - (fun uu___1 -> - match uu___1 with - | (short, long, typ, doc) -> - let uu___2 = - let uu___3 = arg_spec_of_opt_type long typ in - (short, long, uu___3, doc) in - mk_spec uu___2) uu___ -let (settable : Prims.string -> Prims.bool) = - fun uu___ -> - match uu___ with - | "abort_on" -> true - | "admit_except" -> true - | "admit_smt_queries" -> true - | "compat_pre_core" -> true - | "compat_pre_typed_indexed_effects" -> true - | "disallow_unification_guards" -> true - | "debug" -> true - | "debug_level" -> true - | "defensive" -> true - | "detail_errors" -> true - | "detail_hint_replay" -> true - | "eager_subtyping" -> true - | "error_contexts" -> true - | "hide_uvar_nums" -> true - | "hint_dir" -> true - | "hint_file" -> true - | "hint_info" -> true - | "fuel" -> true - | "ifuel" -> true - | "initial_fuel" -> true - | "initial_ifuel" -> true - | "ide_id_info_off" -> true - | "keep_query_captions" -> true - | "lax" -> true - | "load" -> true - | "load_cmxs" -> true - | "log_queries" -> true - | "log_types" -> true - | "max_fuel" -> true - | "max_ifuel" -> true - | "no_plugins" -> true - | "__no_positivity" -> true - | "normalize_pure_terms_for_extraction" -> true - | "no_smt" -> true - | "no_tactics" -> true - | "print_bound_var_types" -> true - | "print_effect_args" -> true - | "print_expected_failures" -> true - | "print_full_names" -> true - | "print_implicits" -> true - | "print_universes" -> true - | "print_z3_statistics" -> true - | "prn" -> true - | "quake_lo" -> true - | "quake_hi" -> true - | "quake_keep" -> true - | "quake" -> true - | "query_stats" -> true - | "record_options" -> true - | "retry" -> true - | "reuse_hint_for" -> true - | "report_assumes" -> true - | "silent" -> true - | "smtencoding.elim_box" -> true - | "smtencoding.l_arith_repr" -> true - | "smtencoding.nl_arith_repr" -> true - | "smtencoding.valid_intro" -> true - | "smtencoding.valid_elim" -> true - | "split_queries" -> true - | "tactic_raw_binders" -> true - | "tactics_failhard" -> true - | "tactics_info" -> true - | "__tactics_nbe" -> true - | "tactic_trace" -> true - | "tactic_trace_d" -> true - | "tcnorm" -> true - | "__temp_fast_implicits" -> true - | "timing" -> true - | "trace_error" -> true - | "ugly" -> true - | "unthrottle_inductives" -> true - | "use_eq_at_higher_order" -> true - | "using_facts_from" -> true - | "warn_error" -> true - | "z3cliopt" -> true - | "z3smtopt" -> true - | "z3refresh" -> true - | "z3rlimit" -> true - | "z3rlimit_factor" -> true - | "z3seed" -> true - | "trivial_pre_for_unannotated_effectful_fns" -> true - | "profile_group_by_decl" -> true - | "profile_component" -> true - | "profile" -> true - | uu___1 -> false -let (all_specs : FStar_Getopt.opt Prims.list) = specs true -let (all_specs_with_types : - (FStar_BaseTypes.char * Prims.string * opt_type * Prims.string) Prims.list) - = specs_with_types true -let (settable_specs : - (FStar_BaseTypes.char * Prims.string * unit FStar_Getopt.opt_variant * - Prims.string) Prims.list) - = - FStar_Compiler_Effect.op_Bar_Greater all_specs - (FStar_Compiler_List.filter - (fun uu___ -> - match uu___ with | (uu___1, x, uu___2, uu___3) -> settable x)) -let (uu___638 : - (((unit -> FStar_Getopt.parse_cmdline_res) -> unit) * - (unit -> FStar_Getopt.parse_cmdline_res))) - = - let callback = FStar_Compiler_Util.mk_ref FStar_Pervasives_Native.None in - let set1 f = - FStar_Compiler_Effect.op_Colon_Equals callback - (FStar_Pervasives_Native.Some f) in - let call uu___ = - let uu___1 = FStar_Compiler_Effect.op_Bang callback in - match uu___1 with - | FStar_Pervasives_Native.None -> - failwith "Error flags callback not yet set" - | FStar_Pervasives_Native.Some f -> f () in - (set1, call) -let (set_error_flags_callback_aux : - (unit -> FStar_Getopt.parse_cmdline_res) -> unit) = - match uu___638 with - | (set_error_flags_callback_aux1, set_error_flags) -> - set_error_flags_callback_aux1 -let (set_error_flags : unit -> FStar_Getopt.parse_cmdline_res) = - match uu___638 with - | (set_error_flags_callback_aux1, set_error_flags1) -> set_error_flags1 -let (set_error_flags_callback : - (unit -> FStar_Getopt.parse_cmdline_res) -> unit) = - set_error_flags_callback_aux -let (display_usage : unit -> unit) = fun uu___ -> display_usage_aux all_specs -let (fstar_bin_directory : Prims.string) = - FStar_Compiler_Util.get_exec_dir () -let (file_list_ : Prims.string Prims.list FStar_Compiler_Effect.ref) = - FStar_Compiler_Util.mk_ref [] -let rec (parse_filename_arg : - FStar_Getopt.opt Prims.list -> - Prims.bool -> Prims.string -> FStar_Getopt.parse_cmdline_res) - = - fun specs1 -> - fun enable_filenames -> - fun arg -> - if FStar_Compiler_Util.starts_with arg "@" - then - let filename = FStar_Compiler_Util.substring_from arg Prims.int_one in - let lines = FStar_Compiler_Util.file_get_lines filename in - FStar_Getopt.parse_list specs1 - (parse_filename_arg specs1 enable_filenames) lines - else - (if enable_filenames - then - (let uu___2 = - let uu___3 = FStar_Compiler_Effect.op_Bang file_list_ in - FStar_Compiler_List.op_At uu___3 [arg] in - FStar_Compiler_Effect.op_Colon_Equals file_list_ uu___2) - else (); - FStar_Getopt.Success) -let (parse_cmd_line : - unit -> (FStar_Getopt.parse_cmdline_res * Prims.string Prims.list)) = - fun uu___ -> - let res = - FStar_Getopt.parse_cmdline all_specs - (parse_filename_arg all_specs true) in - let res1 = if res = FStar_Getopt.Success then set_error_flags () else res in - let uu___1 = - let uu___2 = FStar_Compiler_Effect.op_Bang file_list_ in - FStar_Compiler_List.map FStar_Common.try_convert_file_name_to_mixed - uu___2 in - (res1, uu___1) -let (file_list : unit -> Prims.string Prims.list) = - fun uu___ -> FStar_Compiler_Effect.op_Bang file_list_ -let (restore_cmd_line_options : Prims.bool -> FStar_Getopt.parse_cmdline_res) - = - fun should_clear -> - let old_verify_module = get_verify_module () in - if should_clear then clear () else init (); - (let specs1 = specs false in - let r = - FStar_Getopt.parse_cmdline specs1 (parse_filename_arg specs1 false) in - (let uu___2 = - let uu___3 = - let uu___4 = - FStar_Compiler_List.map (fun uu___5 -> String uu___5) - old_verify_module in - List uu___4 in - ("verify_module", uu___3) in - set_option' uu___2); - r) -let (module_name_of_file_name : Prims.string -> Prims.string) = - fun f -> - let f1 = FStar_Compiler_Util.basename f in - let f2 = - let uu___ = - let uu___1 = - let uu___2 = - let uu___3 = FStar_Compiler_Util.get_file_extension f1 in - FStar_String.length uu___3 in - (FStar_String.length f1) - uu___2 in - uu___1 - Prims.int_one in - FStar_String.substring f1 Prims.int_zero uu___ in - FStar_String.lowercase f2 -let (should_check : Prims.string -> Prims.bool) = - fun m -> - let l = get_verify_module () in - FStar_Compiler_List.contains (FStar_String.lowercase m) l -let (should_verify : Prims.string -> Prims.bool) = - fun m -> - (let uu___ = get_lax () in Prims.op_Negation uu___) && (should_check m) -let (should_check_file : Prims.string -> Prims.bool) = - fun fn -> let uu___ = module_name_of_file_name fn in should_check uu___ -let (should_verify_file : Prims.string -> Prims.bool) = - fun fn -> let uu___ = module_name_of_file_name fn in should_verify uu___ -let (module_name_eq : Prims.string -> Prims.string -> Prims.bool) = - fun m1 -> - fun m2 -> (FStar_String.lowercase m1) = (FStar_String.lowercase m2) -let (should_print_message : Prims.string -> Prims.bool) = - fun m -> - let uu___ = should_verify m in if uu___ then m <> "Prims" else false -let (include_path : unit -> Prims.string Prims.list) = - fun uu___ -> - let cache_dir = - let uu___1 = get_cache_dir () in - match uu___1 with - | FStar_Pervasives_Native.None -> [] - | FStar_Pervasives_Native.Some c -> [c] in - let uu___1 = get_no_default_includes () in - if uu___1 - then - let uu___2 = get_include () in - FStar_Compiler_List.op_At cache_dir uu___2 - else - (let lib_paths = - let uu___3 = - FStar_Compiler_Util.expand_environment_variable "FSTAR_LIB" in - match uu___3 with - | FStar_Pervasives_Native.None -> - let fstar_home = FStar_String.op_Hat fstar_bin_directory "/.." in - let defs = universe_include_path_base_dirs in - let uu___4 = - FStar_Compiler_Effect.op_Bar_Greater defs - (FStar_Compiler_List.map - (fun x -> FStar_String.op_Hat fstar_home x)) in - FStar_Compiler_Effect.op_Bar_Greater uu___4 - (FStar_Compiler_List.filter FStar_Compiler_Util.file_exists) - | FStar_Pervasives_Native.Some s -> [s] in - let uu___3 = - let uu___4 = - let uu___5 = get_include () in - FStar_Compiler_List.op_At uu___5 ["."] in - FStar_Compiler_List.op_At lib_paths uu___4 in - FStar_Compiler_List.op_At cache_dir uu___3) -let (find_file : Prims.string -> Prims.string FStar_Pervasives_Native.option) - = - let file_map = FStar_Compiler_Util.smap_create (Prims.of_int (100)) in - fun filename -> - let uu___ = FStar_Compiler_Util.smap_try_find file_map filename in - match uu___ with - | FStar_Pervasives_Native.Some f -> f - | FStar_Pervasives_Native.None -> - let result = - try - (fun uu___1 -> - match () with - | () -> - let uu___2 = FStar_Compiler_Util.is_path_absolute filename in - if uu___2 - then - (if FStar_Compiler_Util.file_exists filename - then FStar_Pervasives_Native.Some filename - else FStar_Pervasives_Native.None) - else - (let uu___4 = - let uu___5 = include_path () in - FStar_Compiler_List.rev uu___5 in - FStar_Compiler_Util.find_map uu___4 - (fun p -> - let path = - if p = "." - then filename - else FStar_Compiler_Util.join_paths p filename in - if FStar_Compiler_Util.file_exists path - then FStar_Pervasives_Native.Some path - else FStar_Pervasives_Native.None))) () - with | uu___1 -> FStar_Pervasives_Native.None in - (if FStar_Compiler_Option.isSome result - then FStar_Compiler_Util.smap_add file_map filename result - else (); - result) -let (prims : unit -> Prims.string) = - fun uu___ -> - let uu___1 = get_prims () in - match uu___1 with - | FStar_Pervasives_Native.None -> - let filename = "prims.fst" in - let uu___2 = find_file filename in - (match uu___2 with - | FStar_Pervasives_Native.Some result -> result - | FStar_Pervasives_Native.None -> - let uu___3 = - FStar_Compiler_Util.format1 - "unable to find required file \"%s\" in the module search path.\n" - filename in - failwith uu___3) - | FStar_Pervasives_Native.Some x -> x -let (prims_basename : unit -> Prims.string) = - fun uu___ -> let uu___1 = prims () in FStar_Compiler_Util.basename uu___1 -let (pervasives : unit -> Prims.string) = - fun uu___ -> - let filename = "FStar.Pervasives.fsti" in - let uu___1 = find_file filename in - match uu___1 with - | FStar_Pervasives_Native.Some result -> result - | FStar_Pervasives_Native.None -> - let uu___2 = - FStar_Compiler_Util.format1 - "unable to find required file \"%s\" in the module search path.\n" - filename in - failwith uu___2 -let (pervasives_basename : unit -> Prims.string) = - fun uu___ -> - let uu___1 = pervasives () in FStar_Compiler_Util.basename uu___1 -let (pervasives_native_basename : unit -> Prims.string) = - fun uu___ -> - let filename = "FStar.Pervasives.Native.fst" in - let uu___1 = find_file filename in - match uu___1 with - | FStar_Pervasives_Native.Some result -> - FStar_Compiler_Util.basename result - | FStar_Pervasives_Native.None -> - let uu___2 = - FStar_Compiler_Util.format1 - "unable to find required file \"%s\" in the module search path.\n" - filename in - failwith uu___2 -let (prepend_output_dir : Prims.string -> Prims.string) = - fun fname -> - let uu___ = get_odir () in - match uu___ with - | FStar_Pervasives_Native.None -> fname - | FStar_Pervasives_Native.Some x -> - FStar_Compiler_Util.join_paths x fname -let (prepend_cache_dir : Prims.string -> Prims.string) = - fun fpath -> - let uu___ = get_cache_dir () in - match uu___ with - | FStar_Pervasives_Native.None -> fpath - | FStar_Pervasives_Native.Some x -> - let uu___1 = FStar_Compiler_Util.basename fpath in - FStar_Compiler_Util.join_paths x uu___1 -let (path_of_text : Prims.string -> Prims.string Prims.list) = - fun text -> FStar_String.split [46] text -let (parse_settings : - Prims.string Prims.list -> - (Prims.string Prims.list * Prims.bool) Prims.list) - = - fun ns -> - let cache = FStar_Compiler_Util.smap_create (Prims.of_int (31)) in - let with_cache f s = - let uu___ = FStar_Compiler_Util.smap_try_find cache s in - match uu___ with - | FStar_Pervasives_Native.Some s1 -> s1 - | FStar_Pervasives_Native.None -> - let res = f s in (FStar_Compiler_Util.smap_add cache s res; res) in - let parse_one_setting s = - if s = "*" - then ([], true) - else - if s = "-*" - then ([], false) - else - if FStar_Compiler_Util.starts_with s "-" - then - (let path = - let uu___2 = - FStar_Compiler_Util.substring_from s Prims.int_one in - path_of_text uu___2 in - (path, false)) - else - (let s1 = - if FStar_Compiler_Util.starts_with s "+" - then FStar_Compiler_Util.substring_from s Prims.int_one - else s in - ((path_of_text s1), true)) in - let uu___ = - FStar_Compiler_Effect.op_Bar_Greater ns - (FStar_Compiler_List.collect - (fun s -> - let s1 = FStar_Compiler_Util.trim_string s in - if s1 = "" - then [] - else - with_cache - (fun s2 -> - let s3 = FStar_Compiler_Util.replace_char s2 32 44 in - let uu___2 = - let uu___3 = - FStar_Compiler_Effect.op_Bar_Greater - (FStar_Compiler_Util.splitlines s3) - (FStar_Compiler_List.concatMap - (fun s4 -> FStar_Compiler_Util.split s4 ",")) in - FStar_Compiler_Effect.op_Bar_Greater uu___3 - (FStar_Compiler_List.filter (fun s4 -> s4 <> "")) in - FStar_Compiler_Effect.op_Bar_Greater uu___2 - (FStar_Compiler_List.map parse_one_setting)) s1)) in - FStar_Compiler_Effect.op_Bar_Greater uu___ FStar_Compiler_List.rev -let (__temp_fast_implicits : unit -> Prims.bool) = - fun uu___ -> lookup_opt "__temp_fast_implicits" as_bool -let (admit_smt_queries : unit -> Prims.bool) = - fun uu___ -> get_admit_smt_queries () -let (admit_except : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> get_admit_except () -let (compat_pre_core_should_register : unit -> Prims.bool) = - fun uu___ -> - let uu___1 = get_compat_pre_core () in - match uu___1 with - | FStar_Pervasives_Native.Some uu___2 when uu___2 = Prims.int_zero -> - false - | uu___2 -> true -let (compat_pre_core_should_check : unit -> Prims.bool) = - fun uu___ -> - let uu___1 = get_compat_pre_core () in - match uu___1 with - | FStar_Pervasives_Native.Some uu___2 when uu___2 = Prims.int_zero -> - false - | FStar_Pervasives_Native.Some uu___2 when uu___2 = Prims.int_one -> - false - | uu___2 -> true -let (compat_pre_core_set : unit -> Prims.bool) = - fun uu___ -> - let uu___1 = get_compat_pre_core () in - match uu___1 with - | FStar_Pervasives_Native.None -> false - | uu___2 -> true -let (compat_pre_typed_indexed_effects : unit -> Prims.bool) = - fun uu___ -> get_compat_pre_typed_indexed_effects () -let (disallow_unification_guards : unit -> Prims.bool) = - fun uu___ -> get_disallow_unification_guards () -let (cache_checked_modules : unit -> Prims.bool) = - fun uu___ -> get_cache_checked_modules () -let (cache_off : unit -> Prims.bool) = fun uu___ -> get_cache_off () -let (print_cache_version : unit -> Prims.bool) = - fun uu___ -> get_print_cache_version () -let (cmi : unit -> Prims.bool) = fun uu___ -> get_cmi () -type codegen_t = - | OCaml - | FSharp - | Krml - | Plugin -let (uu___is_OCaml : codegen_t -> Prims.bool) = - fun projectee -> match projectee with | OCaml -> true | uu___ -> false -let (uu___is_FSharp : codegen_t -> Prims.bool) = - fun projectee -> match projectee with | FSharp -> true | uu___ -> false -let (uu___is_Krml : codegen_t -> Prims.bool) = - fun projectee -> match projectee with | Krml -> true | uu___ -> false -let (uu___is_Plugin : codegen_t -> Prims.bool) = - fun projectee -> match projectee with | Plugin -> true | uu___ -> false -let (parse_codegen : - Prims.string -> codegen_t FStar_Pervasives_Native.option) = - fun uu___ -> - match uu___ with - | "OCaml" -> FStar_Pervasives_Native.Some OCaml - | "FSharp" -> FStar_Pervasives_Native.Some FSharp - | "krml" -> FStar_Pervasives_Native.Some Krml - | "Plugin" -> FStar_Pervasives_Native.Some Plugin - | uu___1 -> FStar_Pervasives_Native.None -let (print_codegen : codegen_t -> Prims.string) = - fun uu___ -> - match uu___ with - | OCaml -> "OCaml" - | FSharp -> "FSharp" - | Krml -> "krml" - | Plugin -> "Plugin" -let (codegen : unit -> codegen_t FStar_Pervasives_Native.option) = - fun uu___ -> - let uu___1 = get_codegen () in - FStar_Compiler_Util.map_opt uu___1 - (fun s -> - let uu___2 = parse_codegen s in - FStar_Compiler_Effect.op_Bar_Greater uu___2 FStar_Compiler_Util.must) -let (codegen_libs : unit -> Prims.string Prims.list Prims.list) = - fun uu___ -> - let uu___1 = get_codegen_lib () in - FStar_Compiler_Effect.op_Bar_Greater uu___1 - (FStar_Compiler_List.map (fun x -> FStar_Compiler_Util.split x ".")) -let (debug_any : unit -> Prims.bool) = - fun uu___ -> let uu___1 = get_debug () in uu___1 <> [] -let (debug_module : Prims.string -> Prims.bool) = - fun modul -> - let uu___ = get_debug () in - FStar_Compiler_Effect.op_Bar_Greater uu___ - (FStar_Compiler_List.existsb (module_name_eq modul)) -let (debug_at_level_no_module : debug_level_t -> Prims.bool) = - fun level -> debug_level_geq level -let (debug_at_level : Prims.string -> debug_level_t -> Prims.bool) = - fun modul -> - fun level -> (debug_module modul) && (debug_at_level_no_module level) -let (profile_group_by_decls : unit -> Prims.bool) = - fun uu___ -> get_profile_group_by_decl () -let (defensive : unit -> Prims.bool) = - fun uu___ -> let uu___1 = get_defensive () in uu___1 <> "no" -let (defensive_error : unit -> Prims.bool) = - fun uu___ -> let uu___1 = get_defensive () in uu___1 = "error" -let (defensive_abort : unit -> Prims.bool) = - fun uu___ -> let uu___1 = get_defensive () in uu___1 = "abort" -let (dep : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> get_dep () -let (detail_errors : unit -> Prims.bool) = fun uu___ -> get_detail_errors () -let (detail_hint_replay : unit -> Prims.bool) = - fun uu___ -> get_detail_hint_replay () -let (dump_module : Prims.string -> Prims.bool) = - fun s -> - let uu___ = get_dump_module () in - FStar_Compiler_Effect.op_Bar_Greater uu___ - (FStar_Compiler_List.existsb (module_name_eq s)) -let (eager_subtyping : unit -> Prims.bool) = - fun uu___ -> get_eager_subtyping () -let (error_contexts : unit -> Prims.bool) = - fun uu___ -> get_error_contexts () -let (expose_interfaces : unit -> Prims.bool) = - fun uu___ -> get_expose_interfaces () -let (force : unit -> Prims.bool) = fun uu___ -> get_force () -let (full_context_dependency : unit -> Prims.bool) = fun uu___ -> true -let (hide_uvar_nums : unit -> Prims.bool) = - fun uu___ -> get_hide_uvar_nums () -let (hint_info : unit -> Prims.bool) = - fun uu___ -> (get_hint_info ()) || (get_query_stats ()) -let (hint_dir : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> get_hint_dir () -let (hint_file : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> get_hint_file () -let (hint_file_for_src : Prims.string -> Prims.string) = - fun src_filename -> - let uu___ = hint_file () in - match uu___ with - | FStar_Pervasives_Native.Some fn -> fn - | FStar_Pervasives_Native.None -> - let file_name = - let uu___1 = hint_dir () in - match uu___1 with - | FStar_Pervasives_Native.Some dir -> - let uu___2 = FStar_Compiler_Util.basename src_filename in - FStar_Compiler_Util.concat_dir_filename dir uu___2 - | uu___2 -> src_filename in - FStar_Compiler_Util.format1 "%s.hints" file_name -let (ide : unit -> Prims.bool) = fun uu___ -> get_ide () -let (ide_id_info_off : unit -> Prims.bool) = - fun uu___ -> get_ide_id_info_off () -let (print : unit -> Prims.bool) = fun uu___ -> get_print () -let (print_in_place : unit -> Prims.bool) = - fun uu___ -> get_print_in_place () -let (initial_fuel : unit -> Prims.int) = - fun uu___ -> - let uu___1 = get_initial_fuel () in - let uu___2 = get_max_fuel () in Prims.min uu___1 uu___2 -let (initial_ifuel : unit -> Prims.int) = - fun uu___ -> - let uu___1 = get_initial_ifuel () in - let uu___2 = get_max_ifuel () in Prims.min uu___1 uu___2 -let (interactive : unit -> Prims.bool) = - fun uu___ -> ((get_in ()) || (get_ide ())) || (get_lsp ()) -let (lax : unit -> Prims.bool) = fun uu___ -> get_lax () -let (load : unit -> Prims.string Prims.list) = fun uu___ -> get_load () -let (load_cmxs : unit -> Prims.string Prims.list) = - fun uu___ -> get_load_cmxs () -let (legacy_interactive : unit -> Prims.bool) = fun uu___ -> get_in () -let (lsp_server : unit -> Prims.bool) = fun uu___ -> get_lsp () -let (log_queries : unit -> Prims.bool) = fun uu___ -> get_log_queries () -let (keep_query_captions : unit -> Prims.bool) = - fun uu___ -> (log_queries ()) && (get_keep_query_captions ()) -let (log_types : unit -> Prims.bool) = fun uu___ -> get_log_types () -let (max_fuel : unit -> Prims.int) = fun uu___ -> get_max_fuel () -let (max_ifuel : unit -> Prims.int) = fun uu___ -> get_max_ifuel () -let (ml_ish : unit -> Prims.bool) = fun uu___ -> get_MLish () -let (set_ml_ish : unit -> unit) = fun uu___ -> set_option "MLish" (Bool true) -let (no_default_includes : unit -> Prims.bool) = - fun uu___ -> get_no_default_includes () -let (no_extract : Prims.string -> Prims.bool) = - fun s -> - let uu___ = get_no_extract () in - FStar_Compiler_Effect.op_Bar_Greater uu___ - (FStar_Compiler_List.existsb (module_name_eq s)) -let (normalize_pure_terms_for_extraction : unit -> Prims.bool) = - fun uu___ -> get_normalize_pure_terms_for_extraction () -let (no_location_info : unit -> Prims.bool) = - fun uu___ -> get_no_location_info () -let (no_plugins : unit -> Prims.bool) = fun uu___ -> get_no_plugins () -let (no_smt : unit -> Prims.bool) = fun uu___ -> get_no_smt () -let (output_dir : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> get_odir () -let (ugly : unit -> Prims.bool) = fun uu___ -> get_ugly () -let (print_bound_var_types : unit -> Prims.bool) = - fun uu___ -> get_print_bound_var_types () -let (print_effect_args : unit -> Prims.bool) = - fun uu___ -> get_print_effect_args () -let (print_expected_failures : unit -> Prims.bool) = - fun uu___ -> get_print_expected_failures () -let (print_implicits : unit -> Prims.bool) = - fun uu___ -> get_print_implicits () -let (print_real_names : unit -> Prims.bool) = - fun uu___ -> (get_prn ()) || (get_print_full_names ()) -let (print_universes : unit -> Prims.bool) = - fun uu___ -> get_print_universes () -let (print_z3_statistics : unit -> Prims.bool) = - fun uu___ -> get_print_z3_statistics () -let (quake_lo : unit -> Prims.int) = fun uu___ -> get_quake_lo () -let (quake_hi : unit -> Prims.int) = fun uu___ -> get_quake_hi () -let (quake_keep : unit -> Prims.bool) = fun uu___ -> get_quake_keep () -let (query_stats : unit -> Prims.bool) = fun uu___ -> get_query_stats () -let (record_hints : unit -> Prims.bool) = fun uu___ -> get_record_hints () -let (record_options : unit -> Prims.bool) = - fun uu___ -> get_record_options () -let (retry : unit -> Prims.bool) = fun uu___ -> get_retry () -let (reuse_hint_for : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> get_reuse_hint_for () -let (report_assumes : unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> get_report_assumes () -let (silent : unit -> Prims.bool) = fun uu___ -> get_silent () -let (smtencoding_elim_box : unit -> Prims.bool) = - fun uu___ -> get_smtencoding_elim_box () -let (smtencoding_nl_arith_native : unit -> Prims.bool) = - fun uu___ -> - let uu___1 = get_smtencoding_nl_arith_repr () in uu___1 = "native" -let (smtencoding_nl_arith_wrapped : unit -> Prims.bool) = - fun uu___ -> - let uu___1 = get_smtencoding_nl_arith_repr () in uu___1 = "wrapped" -let (smtencoding_nl_arith_default : unit -> Prims.bool) = - fun uu___ -> - let uu___1 = get_smtencoding_nl_arith_repr () in uu___1 = "boxwrap" -let (smtencoding_l_arith_native : unit -> Prims.bool) = - fun uu___ -> - let uu___1 = get_smtencoding_l_arith_repr () in uu___1 = "native" -let (smtencoding_l_arith_default : unit -> Prims.bool) = - fun uu___ -> - let uu___1 = get_smtencoding_l_arith_repr () in uu___1 = "boxwrap" -let (smtencoding_valid_intro : unit -> Prims.bool) = - fun uu___ -> get_smtencoding_valid_intro () -let (smtencoding_valid_elim : unit -> Prims.bool) = - fun uu___ -> get_smtencoding_valid_elim () -let (split_queries : unit -> Prims.bool) = fun uu___ -> get_split_queries () -let (tactic_raw_binders : unit -> Prims.bool) = - fun uu___ -> get_tactic_raw_binders () -let (tactics_failhard : unit -> Prims.bool) = - fun uu___ -> get_tactics_failhard () -let (tactics_info : unit -> Prims.bool) = fun uu___ -> get_tactics_info () -let (tactic_trace : unit -> Prims.bool) = fun uu___ -> get_tactic_trace () -let (tactic_trace_d : unit -> Prims.int) = fun uu___ -> get_tactic_trace_d () -let (tactics_nbe : unit -> Prims.bool) = fun uu___ -> get_tactics_nbe () -let (tcnorm : unit -> Prims.bool) = fun uu___ -> get_tcnorm () -let (timing : unit -> Prims.bool) = fun uu___ -> get_timing () -let (trace_error : unit -> Prims.bool) = fun uu___ -> get_trace_error () -let (unthrottle_inductives : unit -> Prims.bool) = - fun uu___ -> get_unthrottle_inductives () -let (unsafe_tactic_exec : unit -> Prims.bool) = - fun uu___ -> get_unsafe_tactic_exec () -let (use_eq_at_higher_order : unit -> Prims.bool) = - fun uu___ -> get_use_eq_at_higher_order () -let (use_hints : unit -> Prims.bool) = fun uu___ -> get_use_hints () -let (use_hint_hashes : unit -> Prims.bool) = - fun uu___ -> get_use_hint_hashes () -let (use_native_tactics : - unit -> Prims.string FStar_Pervasives_Native.option) = - fun uu___ -> get_use_native_tactics () -let (use_tactics : unit -> Prims.bool) = - fun uu___ -> let uu___1 = get_no_tactics () in Prims.op_Negation uu___1 -let (using_facts_from : - unit -> (Prims.string Prims.list * Prims.bool) Prims.list) = - fun uu___ -> - let uu___1 = get_using_facts_from () in - match uu___1 with - | FStar_Pervasives_Native.None -> [([], true)] - | FStar_Pervasives_Native.Some ns -> parse_settings ns -let (warn_default_effects : unit -> Prims.bool) = - fun uu___ -> get_warn_default_effects () -let (warn_error : unit -> Prims.string) = - fun uu___ -> - let uu___1 = get_warn_error () in FStar_String.concat " " uu___1 -let (z3_exe : unit -> Prims.string) = - fun uu___ -> - let uu___1 = get_smt () in - match uu___1 with - | FStar_Pervasives_Native.None -> FStar_Platform.exe "z3" - | FStar_Pervasives_Native.Some s -> s -let (z3_cliopt : unit -> Prims.string Prims.list) = - fun uu___ -> get_z3cliopt () -let (z3_smtopt : unit -> Prims.string Prims.list) = - fun uu___ -> get_z3smtopt () -let (z3_refresh : unit -> Prims.bool) = fun uu___ -> get_z3refresh () -let (z3_rlimit : unit -> Prims.int) = fun uu___ -> get_z3rlimit () -let (z3_rlimit_factor : unit -> Prims.int) = - fun uu___ -> get_z3rlimit_factor () -let (z3_seed : unit -> Prims.int) = fun uu___ -> get_z3seed () -let (no_positivity : unit -> Prims.bool) = fun uu___ -> get_no_positivity () -let (use_nbe : unit -> Prims.bool) = fun uu___ -> get_use_nbe () -let (use_nbe_for_extraction : unit -> Prims.bool) = - fun uu___ -> get_use_nbe_for_extraction () -let (trivial_pre_for_unannotated_effectful_fns : unit -> Prims.bool) = - fun uu___ -> get_trivial_pre_for_unannotated_effectful_fns () -let with_saved_options : 'a . (unit -> 'a) -> 'a = - fun f -> - let uu___ = let uu___1 = trace_error () in Prims.op_Negation uu___1 in - if uu___ - then - (push (); - (let r = - try - (fun uu___2 -> - match () with - | () -> let uu___3 = f () in FStar_Pervasives.Inr uu___3) () - with | uu___2 -> FStar_Pervasives.Inl uu___2 in - pop (); - (match r with - | FStar_Pervasives.Inr v -> v - | FStar_Pervasives.Inl ex -> FStar_Compiler_Effect.raise ex))) - else (push (); (let retv = f () in pop (); retv)) -let (module_matches_namespace_filter : - Prims.string -> Prims.string Prims.list -> Prims.bool) = - fun m -> - fun filter -> - let m1 = FStar_String.lowercase m in - let setting = parse_settings filter in - let m_components = path_of_text m1 in - let rec matches_path m_components1 path = - match (m_components1, path) with - | (uu___, []) -> true - | (m2::ms, p::ps) -> - (m2 = (FStar_String.lowercase p)) && (matches_path ms ps) - | uu___ -> false in - let uu___ = - FStar_Compiler_Effect.op_Bar_Greater setting - (FStar_Compiler_Util.try_find - (fun uu___1 -> - match uu___1 with - | (path, uu___2) -> matches_path m_components path)) in - match uu___ with - | FStar_Pervasives_Native.None -> false - | FStar_Pervasives_Native.Some (uu___1, flag) -> flag -let (matches_namespace_filter_opt : - Prims.string -> - Prims.string Prims.list FStar_Pervasives_Native.option -> Prims.bool) - = - fun m -> - fun uu___ -> - match uu___ with - | FStar_Pervasives_Native.None -> false - | FStar_Pervasives_Native.Some filter -> - module_matches_namespace_filter m filter -type parsed_extract_setting = - { - target_specific_settings: (codegen_t * Prims.string) Prims.list ; - default_settings: Prims.string FStar_Pervasives_Native.option } -let (__proj__Mkparsed_extract_setting__item__target_specific_settings : - parsed_extract_setting -> (codegen_t * Prims.string) Prims.list) = - fun projectee -> - match projectee with - | { target_specific_settings; default_settings;_} -> - target_specific_settings -let (__proj__Mkparsed_extract_setting__item__default_settings : - parsed_extract_setting -> Prims.string FStar_Pervasives_Native.option) = - fun projectee -> - match projectee with - | { target_specific_settings; default_settings;_} -> default_settings -let (print_pes : parsed_extract_setting -> Prims.string) = - fun pes -> - let uu___ = - let uu___1 = - FStar_Compiler_List.map - (fun uu___2 -> - match uu___2 with - | (tgt, s) -> - FStar_Compiler_Util.format2 "(%s, %s)" (print_codegen tgt) s) - pes.target_specific_settings in - FStar_Compiler_Effect.op_Bar_Greater uu___1 (FStar_String.concat "; ") in - FStar_Compiler_Util.format2 - "{ target_specific_settings = %s;\n\t\n default_settings = %s }" - uu___ - (match pes.default_settings with - | FStar_Pervasives_Native.None -> "None" - | FStar_Pervasives_Native.Some s -> s) -let (find_setting_for_target : - codegen_t -> - (codegen_t * Prims.string) Prims.list -> - Prims.string FStar_Pervasives_Native.option) - = - fun tgt -> - fun s -> - let uu___ = - FStar_Compiler_Util.try_find - (fun uu___1 -> match uu___1 with | (x, uu___2) -> x = tgt) s in - match uu___ with - | FStar_Pervasives_Native.Some (uu___1, s1) -> - FStar_Pervasives_Native.Some s1 - | uu___1 -> FStar_Pervasives_Native.None -let (extract_settings : - unit -> parsed_extract_setting FStar_Pervasives_Native.option) = - let memo = FStar_Compiler_Util.mk_ref (FStar_Pervasives_Native.None, false) in - let merge_parsed_extract_settings p0 p1 = - let merge_setting s0 s1 = - match (s0, s1) with - | (FStar_Pervasives_Native.None, FStar_Pervasives_Native.None) -> - FStar_Pervasives_Native.None - | (FStar_Pervasives_Native.Some p, FStar_Pervasives_Native.None) -> - FStar_Pervasives_Native.Some p - | (FStar_Pervasives_Native.None, FStar_Pervasives_Native.Some p) -> - FStar_Pervasives_Native.Some p - | (FStar_Pervasives_Native.Some p01, FStar_Pervasives_Native.Some p11) - -> - let uu___ = - let uu___1 = FStar_String.op_Hat "," p11 in - FStar_String.op_Hat p01 uu___1 in - FStar_Pervasives_Native.Some uu___ in - let merge_target tgt = - let uu___ = - let uu___1 = find_setting_for_target tgt p0.target_specific_settings in - let uu___2 = find_setting_for_target tgt p1.target_specific_settings in - merge_setting uu___1 uu___2 in - match uu___ with - | FStar_Pervasives_Native.None -> [] - | FStar_Pervasives_Native.Some x -> [(tgt, x)] in - let uu___ = - FStar_Compiler_List.collect merge_target [OCaml; FSharp; Krml; Plugin] in - let uu___1 = merge_setting p0.default_settings p1.default_settings in - { target_specific_settings = uu___; default_settings = uu___1 } in - fun uu___ -> - let uu___1 = FStar_Compiler_Effect.op_Bang memo in - match uu___1 with - | (result, set1) -> - let fail msg = - display_usage (); - (let uu___3 = - FStar_Compiler_Util.format1 - "Could not parse '%s' passed to the --extract option" msg in - failwith uu___3) in - if set1 - then result - else - (let uu___3 = get_extract () in - match uu___3 with - | FStar_Pervasives_Native.None -> - (FStar_Compiler_Effect.op_Colon_Equals memo - (FStar_Pervasives_Native.None, true); - FStar_Pervasives_Native.None) - | FStar_Pervasives_Native.Some extract_settings1 -> - let parse_one_setting extract_setting = - let tgt_specific_settings = - FStar_Compiler_Util.split extract_setting ";" in - let split_one t_setting = - match FStar_Compiler_Util.split t_setting ":" with - | default_setting::[] -> - FStar_Pervasives.Inr - (FStar_Compiler_Util.trim_string default_setting) - | target::setting::[] -> - let target1 = FStar_Compiler_Util.trim_string target in - let uu___4 = parse_codegen target1 in - (match uu___4 with - | FStar_Pervasives_Native.None -> fail target1 - | FStar_Pervasives_Native.Some tgt -> - FStar_Pervasives.Inl - (tgt, - (FStar_Compiler_Util.trim_string setting)) - | uu___5 -> fail t_setting) in - let settings = - FStar_Compiler_List.map split_one tgt_specific_settings in - let fail_duplicate msg tgt = - display_usage (); - (let uu___5 = - FStar_Compiler_Util.format2 - "Could not parse '%s'; multiple setting for %s target" - msg tgt in - failwith uu___5) in - let pes = - FStar_Compiler_List.fold_right - (fun setting -> - fun out -> - match setting with - | FStar_Pervasives.Inr def -> - (match out.default_settings with - | FStar_Pervasives_Native.None -> - { - target_specific_settings = - (out.target_specific_settings); - default_settings = - (FStar_Pervasives_Native.Some def) - } - | FStar_Pervasives_Native.Some uu___4 -> - fail_duplicate def "default") - | FStar_Pervasives.Inl (target, setting1) -> - let uu___4 = - FStar_Compiler_Util.try_find - (fun uu___5 -> - match uu___5 with - | (x, uu___6) -> x = target) - out.target_specific_settings in - (match uu___4 with - | FStar_Pervasives_Native.None -> - { - target_specific_settings = - ((target, setting1) :: - (out.target_specific_settings)); - default_settings = - (out.default_settings) - } - | FStar_Pervasives_Native.Some uu___5 -> - fail_duplicate setting1 - (print_codegen target))) settings - { - target_specific_settings = []; - default_settings = FStar_Pervasives_Native.None - } in - pes in - let empty_pes = - { - target_specific_settings = []; - default_settings = FStar_Pervasives_Native.None - } in - let pes = - FStar_Compiler_List.fold_right - (fun setting -> - fun pes1 -> - let uu___4 = parse_one_setting setting in - merge_parsed_extract_settings pes1 uu___4) - extract_settings1 empty_pes in - (FStar_Compiler_Effect.op_Colon_Equals memo - ((FStar_Pervasives_Native.Some pes), true); - FStar_Pervasives_Native.Some pes)) -let (should_extract : Prims.string -> codegen_t -> Prims.bool) = - fun m -> - fun tgt -> - let m1 = FStar_String.lowercase m in - let uu___ = extract_settings () in - match uu___ with - | FStar_Pervasives_Native.Some pes -> - ((let uu___2 = - let uu___3 = get_no_extract () in - let uu___4 = get_extract_namespace () in - let uu___5 = get_extract_module () in (uu___3, uu___4, uu___5) in - match uu___2 with - | ([], [], []) -> () - | uu___3 -> - failwith - "Incompatible options: --extract cannot be used with --no_extract, --extract_namespace or --extract_module"); - (let tsetting = - let uu___2 = - find_setting_for_target tgt pes.target_specific_settings in - match uu___2 with - | FStar_Pervasives_Native.Some s -> s - | FStar_Pervasives_Native.None -> - (match pes.default_settings with - | FStar_Pervasives_Native.Some s -> s - | FStar_Pervasives_Native.None -> "*") in - module_matches_namespace_filter m1 [tsetting])) - | FStar_Pervasives_Native.None -> - let should_extract_namespace m2 = - let uu___1 = get_extract_namespace () in - match uu___1 with - | [] -> false - | ns -> - FStar_Compiler_Effect.op_Bar_Greater ns - (FStar_Compiler_Util.for_some - (fun n -> - FStar_Compiler_Util.starts_with m2 - (FStar_String.lowercase n))) in - let should_extract_module m2 = - let uu___1 = get_extract_module () in - match uu___1 with - | [] -> false - | l -> - FStar_Compiler_Effect.op_Bar_Greater l - (FStar_Compiler_Util.for_some - (fun n -> (FStar_String.lowercase n) = m2)) in - (let uu___1 = no_extract m1 in Prims.op_Negation uu___1) && - (let uu___1 = - let uu___2 = get_extract_namespace () in - let uu___3 = get_extract_module () in (uu___2, uu___3) in - (match uu___1 with - | ([], []) -> true - | uu___2 -> - (should_extract_namespace m1) || (should_extract_module m1))) -let (should_be_already_cached : Prims.string -> Prims.bool) = - fun m -> - let uu___ = get_already_cached () in - match uu___ with - | FStar_Pervasives_Native.None -> false - | FStar_Pervasives_Native.Some already_cached_setting -> - module_matches_namespace_filter m already_cached_setting -let (profile_enabled : - Prims.string FStar_Pervasives_Native.option -> Prims.string -> Prims.bool) - = - fun modul_opt -> - fun phase -> - match modul_opt with - | FStar_Pervasives_Native.None -> - let uu___ = get_profile_component () in - matches_namespace_filter_opt phase uu___ - | FStar_Pervasives_Native.Some modul -> - ((let uu___ = get_profile () in - matches_namespace_filter_opt modul uu___) && - (let uu___ = get_profile_component () in - matches_namespace_filter_opt phase uu___)) - || - (((timing ()) && - (phase = "FStar.TypeChecker.Tc.process_one_decl")) - && (should_check modul)) -exception File_argument of Prims.string -let (uu___is_File_argument : Prims.exn -> Prims.bool) = - fun projectee -> - match projectee with | File_argument uu___ -> true | uu___ -> false -let (__proj__File_argument__item__uu___ : Prims.exn -> Prims.string) = - fun projectee -> match projectee with | File_argument uu___ -> uu___ -let (set_options : Prims.string -> FStar_Getopt.parse_cmdline_res) = - fun s -> - try - (fun uu___ -> - match () with - | () -> - if s = "" - then FStar_Getopt.Success - else - (let res = - FStar_Getopt.parse_string settable_specs - (fun s1 -> - FStar_Compiler_Effect.raise (File_argument s1); - FStar_Getopt.Error "set_options with file argument") s in - if res = FStar_Getopt.Success - then set_error_flags () - else res)) () - with - | File_argument s1 -> - let uu___1 = - FStar_Compiler_Util.format1 "File %s is not a valid option" s1 in - FStar_Getopt.Error uu___1 -let (get_vconfig : unit -> FStar_VConfig.vconfig) = - fun uu___ -> - let vcfg = - let uu___1 = get_initial_fuel () in - let uu___2 = get_max_fuel () in - let uu___3 = get_initial_ifuel () in - let uu___4 = get_max_ifuel () in - let uu___5 = get_detail_errors () in - let uu___6 = get_detail_hint_replay () in - let uu___7 = get_no_smt () in - let uu___8 = get_quake_lo () in - let uu___9 = get_quake_hi () in - let uu___10 = get_quake_keep () in - let uu___11 = get_retry () in - let uu___12 = get_smtencoding_elim_box () in - let uu___13 = get_smtencoding_nl_arith_repr () in - let uu___14 = get_smtencoding_l_arith_repr () in - let uu___15 = get_smtencoding_valid_intro () in - let uu___16 = get_smtencoding_valid_elim () in - let uu___17 = get_tcnorm () in - let uu___18 = get_no_plugins () in - let uu___19 = get_no_tactics () in - let uu___20 = get_z3cliopt () in - let uu___21 = get_z3smtopt () in - let uu___22 = get_z3refresh () in - let uu___23 = get_z3rlimit () in - let uu___24 = get_z3rlimit_factor () in - let uu___25 = get_z3seed () in - let uu___26 = get_trivial_pre_for_unannotated_effectful_fns () in - let uu___27 = get_reuse_hint_for () in - { - FStar_VConfig.initial_fuel = uu___1; - FStar_VConfig.max_fuel = uu___2; - FStar_VConfig.initial_ifuel = uu___3; - FStar_VConfig.max_ifuel = uu___4; - FStar_VConfig.detail_errors = uu___5; - FStar_VConfig.detail_hint_replay = uu___6; - FStar_VConfig.no_smt = uu___7; - FStar_VConfig.quake_lo = uu___8; - FStar_VConfig.quake_hi = uu___9; - FStar_VConfig.quake_keep = uu___10; - FStar_VConfig.retry = uu___11; - FStar_VConfig.smtencoding_elim_box = uu___12; - FStar_VConfig.smtencoding_nl_arith_repr = uu___13; - FStar_VConfig.smtencoding_l_arith_repr = uu___14; - FStar_VConfig.smtencoding_valid_intro = uu___15; - FStar_VConfig.smtencoding_valid_elim = uu___16; - FStar_VConfig.tcnorm = uu___17; - FStar_VConfig.no_plugins = uu___18; - FStar_VConfig.no_tactics = uu___19; - FStar_VConfig.z3cliopt = uu___20; - FStar_VConfig.z3smtopt = uu___21; - FStar_VConfig.z3refresh = uu___22; - FStar_VConfig.z3rlimit = uu___23; - FStar_VConfig.z3rlimit_factor = uu___24; - FStar_VConfig.z3seed = uu___25; - FStar_VConfig.trivial_pre_for_unannotated_effectful_fns = uu___26; - FStar_VConfig.reuse_hint_for = uu___27 - } in - vcfg -let (set_vconfig : FStar_VConfig.vconfig -> unit) = - fun vcfg -> - let option_as tag o = - match o with - | FStar_Pervasives_Native.None -> Unset - | FStar_Pervasives_Native.Some s -> tag s in - set_option "initial_fuel" (Int (vcfg.FStar_VConfig.initial_fuel)); - set_option "max_fuel" (Int (vcfg.FStar_VConfig.max_fuel)); - set_option "initial_ifuel" (Int (vcfg.FStar_VConfig.initial_ifuel)); - set_option "max_ifuel" (Int (vcfg.FStar_VConfig.max_ifuel)); - set_option "detail_errors" (Bool (vcfg.FStar_VConfig.detail_errors)); - set_option "detail_hint_replay" - (Bool (vcfg.FStar_VConfig.detail_hint_replay)); - set_option "no_smt" (Bool (vcfg.FStar_VConfig.no_smt)); - set_option "quake_lo" (Int (vcfg.FStar_VConfig.quake_lo)); - set_option "quake_hi" (Int (vcfg.FStar_VConfig.quake_hi)); - set_option "quake_keep" (Bool (vcfg.FStar_VConfig.quake_keep)); - set_option "retry" (Bool (vcfg.FStar_VConfig.retry)); - set_option "smtencoding.elim_box" - (Bool (vcfg.FStar_VConfig.smtencoding_elim_box)); - set_option "smtencoding.nl_arith_repr" - (String (vcfg.FStar_VConfig.smtencoding_nl_arith_repr)); - set_option "smtencoding.l_arith_repr" - (String (vcfg.FStar_VConfig.smtencoding_l_arith_repr)); - set_option "smtencoding.valid_intro" - (Bool (vcfg.FStar_VConfig.smtencoding_valid_intro)); - set_option "smtencoding.valid_elim" - (Bool (vcfg.FStar_VConfig.smtencoding_valid_elim)); - set_option "tcnorm" (Bool (vcfg.FStar_VConfig.tcnorm)); - set_option "no_plugins" (Bool (vcfg.FStar_VConfig.no_plugins)); - set_option "no_tactics" (Bool (vcfg.FStar_VConfig.no_tactics)); - (let uu___20 = - let uu___21 = - FStar_Compiler_List.map (fun uu___22 -> String uu___22) - vcfg.FStar_VConfig.z3cliopt in - List uu___21 in - set_option "z3cliopt" uu___20); - (let uu___21 = - let uu___22 = - FStar_Compiler_List.map (fun uu___23 -> String uu___23) - vcfg.FStar_VConfig.z3smtopt in - List uu___22 in - set_option "z3smtopt" uu___21); - set_option "z3refresh" (Bool (vcfg.FStar_VConfig.z3refresh)); - set_option "z3rlimit" (Int (vcfg.FStar_VConfig.z3rlimit)); - set_option "z3rlimit_factor" (Int (vcfg.FStar_VConfig.z3rlimit_factor)); - set_option "z3seed" (Int (vcfg.FStar_VConfig.z3seed)); - set_option "trivial_pre_for_unannotated_effectful_fns" - (Bool (vcfg.FStar_VConfig.trivial_pre_for_unannotated_effectful_fns)); - (let uu___27 = - option_as (fun uu___28 -> String uu___28) - vcfg.FStar_VConfig.reuse_hint_for in - set_option "reuse_hint_for" uu___27) \ No newline at end of file diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_Const.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Parser_Const.ml index e4fda7562..dcfbcc9f9 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_Const.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Parser_Const.ml @@ -222,19 +222,19 @@ let (all_try_with_lid : FStar_Ident.lident) = p2l ["FStar"; "All"; "try_with"] let (effect_ALL_lid : unit -> FStar_Ident.lident) = fun uu___ -> - let uu___1 = FStar_Options.ml_ish () in + let uu___1 = false in if uu___1 then compiler_effect_ALL_lid else all_lid let (effect_ML_lid : unit -> FStar_Ident.lident) = fun uu___ -> - let uu___1 = FStar_Options.ml_ish () in + let uu___1 = false in if uu___1 then compiler_effect_ML_lid else all_ML_lid let (failwith_lid : unit -> FStar_Ident.lident) = fun uu___ -> - let uu___1 = FStar_Options.ml_ish () in + let uu___1 = false in if uu___1 then compiler_effect_failwith_lid else all_failwith_lid let (try_with_lid : unit -> FStar_Ident.lident) = fun uu___ -> - let uu___1 = FStar_Options.ml_ish () in + let uu___1 = false in if uu___1 then compiler_effect_try_with_lid else all_try_with_lid let (as_requires : FStar_Ident.lident) = pconst "as_requires" let (as_ensures : FStar_Ident.lident) = pconst "as_ensures" @@ -349,15 +349,10 @@ let (attr_substitute_lid : FStar_Ident.lident) = p2l ["FStar"; "Pervasives"; "Substitute"] let (well_founded_relation_lid : FStar_Ident.lident) = p2l ["FStar"; "WellFounded"; "well_founded_relation"] -let (gen_reset : ((unit -> Prims.int) * (unit -> unit))) = - let x = ref Prims.int_zero in - let gen uu___ = FStar_Compiler_Util.incr x; FStar_Compiler_Util.read x in - let reset uu___ = FStar_Compiler_Util.write x Prims.int_zero in - (gen, reset) -let (next_id : unit -> Prims.int) = FStar_Pervasives_Native.fst gen_reset + let (sli : FStar_Ident.lident -> Prims.string) = fun l -> - let uu___ = FStar_Options.print_real_names () in + let uu___ = false in if uu___ then FStar_Ident.string_of_lid l else diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_Parse.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Parser_Parse.ml index 5f80cf775..62bd70c8a 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_Parse.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Parser_Parse.ml @@ -3,7 +3,7 @@ open FStar_Errors open FStar_Compiler_List open FStar_Compiler_Util open FStar_Compiler_Range -open FStar_Options +(* open FStar_Options *) open FStar_Parser_Const open FStar_Parser_AST open FStar_Parser_Util @@ -196,7 +196,7 @@ open FStar_Errors open FStar_Compiler_List open FStar_Compiler_Util open FStar_Compiler_Range -open FStar_Options +(* open FStar_Options *) (* TODO : these files should be deprecated and removed *) (* open FStar_Syntax_Syntax *) open FStar_Parser_Const diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ParseIt.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ParseIt.ml index d8e8ce58b..b6ba1bd8d 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ParseIt.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ParseIt.ml @@ -32,24 +32,20 @@ let setLexbufPos filename lexbuf line col = module Path = BatPathGen.OfString let find_file filename = - match FStar_Options.find_file filename with - | Some s -> - s - | None -> raise_err (Fatal_ModuleOrFileNotFound, U.format1 "Unable to find file: %s\n" filename) -let vfs_entries : (U.time * string) U.smap = U.smap_create (Z.of_int 1) +(* let vfs_entries : (U.time * string) U.smap = U.smap_create (Z.of_int 1) *) -let read_vfs_entry fname = - U.smap_try_find vfs_entries (U.normalize_file_path fname) +(* let read_vfs_entry fname = *) +(* U.smap_try_find vfs_entries (U.normalize_file_path fname) *) -let add_vfs_entry fname contents = - U.smap_add vfs_entries (U.normalize_file_path fname) (U.now (), contents) +(* let add_vfs_entry fname contents = *) +(* U.smap_add vfs_entries (U.normalize_file_path fname) (U.now (), contents) *) -let get_file_last_modification_time filename = - match read_vfs_entry filename with - | Some (mtime, _contents) -> mtime - | None -> U.get_file_last_modification_time filename +(* let get_file_last_modification_time filename = *) +(* match read_vfs_entry filename with *) +(* | Some (mtime, _contents) -> mtime *) +(* | None -> U.get_file_last_modification_time filename *) let read_physical_file (filename: string) = (* BatFile.with_file_in uses Unix.openfile (which isn't available in @@ -64,22 +60,17 @@ let read_physical_file (filename: string) = raise_err (Fatal_UnableToReadFile, U.format1 "Unable to read file %s\n" filename) let read_file (filename:string) = - let debug = FStar_Options.debug_any () in - match read_vfs_entry filename with - | Some (_mtime, contents) -> - if debug then U.print1 "Reading in-memory file %s\n" filename; - filename, contents - | None -> - let filename = find_file filename in - if debug then U.print1 "Opening file %s\n" filename; - filename, read_physical_file filename + let debug = false in + let filename = find_file filename in + if debug then U.print1 "Opening file %s\n" filename; + filename, read_physical_file filename let fs_extensions = [".fs"; ".fsi"] let fst_extensions = [".fst"; ".fsti"] let interface_extensions = [".fsti"; ".fsi"] let valid_extensions () = - fst_extensions @ if FStar_Options.ml_ish () then fs_extensions else [] + fst_extensions @ if false then fs_extensions else [] let has_extension file extensions = FStar_List.existsb (U.ends_with file) extensions diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ParseIt.mli b/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ParseIt.mli deleted file mode 100755 index 86420e813..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ParseIt.mli +++ /dev/null @@ -1,43 +0,0 @@ -module U = FStar_Compiler_Util -open FStar_Errors -open Lexing -open FStar_Sedlexing -module Codes = FStar_Errors_Codes - -type filename = string - -type input_frag = { - frag_fname:filename; - frag_text:string; - frag_line:Prims.int; - frag_col:Prims.int -} - -val read_vfs_entry : string -> (U.time * string) option -val add_vfs_entry: string -> string -> unit -val get_file_last_modification_time: string -> U.time - -type parse_frag = - | Filename of filename - | Toplevel of input_frag - | Incremental of input_frag - | Fragment of input_frag - -type parse_error = (Codes.raw_error * string * FStar_Compiler_Range.range) - -type code_fragment = { - range : FStar_Compiler_Range.range; - code: string; -} - -type parse_result = - | ASTFragment of (FStar_Parser_AST.inputFragment * (string * FStar_Compiler_Range.range) list) - | IncrementalFragment of ((FStar_Parser_AST.decl * code_fragment) list * (string * FStar_Compiler_Range.range) list * parse_error option) - | Term of FStar_Parser_AST.term - | ParseError of parse_error - -val parse: parse_frag -> parse_result - -val find_file: string -> string - -val parse_warn_error: string -> Codes.error_setting list diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ToDocument.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ToDocument.ml index a05277458..23676511e 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ToDocument.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Parser_ToDocument.ml @@ -2261,7 +2261,7 @@ and (string_of_id_or_underscore : FStar_Ident.ident -> FStar_Pprint.document) let uu___ = (let uu___1 = FStar_Ident.string_of_id lid in FStar_Compiler_Util.starts_with uu___1 FStar_Ident.reserved_prefix) && - (let uu___1 = FStar_Options.print_real_names () in + (let uu___1 = false in Prims.op_Negation uu___1) in if uu___ then FStar_Pprint.underscore @@ -2274,7 +2274,7 @@ and (text_of_lid_or_underscore : FStar_Ident.lident -> FStar_Pprint.document) let uu___2 = FStar_Ident.ident_of_lid lid in FStar_Ident.string_of_id uu___2 in FStar_Compiler_Util.starts_with uu___1 FStar_Ident.reserved_prefix) && - (let uu___1 = FStar_Options.print_real_names () in + (let uu___1 = false in Prims.op_Negation uu___1) in if uu___ then FStar_Pprint.underscore diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Pervasives.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Pervasives.ml index 3ef554ce2..d3a3ce23e 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Pervasives.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Pervasives.ml @@ -1,276 +1,4 @@ -open Prims -type pattern = unit - - -type eqtype_u = unit -type 'p spinoff = 'p let id : 'a . 'a -> 'a = fun x -> x -type ('a, 'uuuuu) trivial_pure_post = unit -type ('uuuuu, 'uuuuu1) ambient = unit -let normalize_term : 'uuuuu . 'uuuuu -> 'uuuuu = fun x -> x -type 'a normalize = 'a -type norm_step = - | Simpl - | Weak - | HNF - | Primops - | Delta - | Zeta - | ZetaFull - | Iota - | NBE - | Reify - | UnfoldOnly of Prims.string Prims.list - | UnfoldFully of Prims.string Prims.list - | UnfoldAttr of Prims.string Prims.list - | UnfoldQual of Prims.string Prims.list - | UnfoldNamespace of Prims.string Prims.list - | Unmeta - | Unascribe -let (uu___is_Simpl : norm_step -> Prims.bool) = - fun projectee -> match projectee with | Simpl -> true | uu___ -> false -let (uu___is_Weak : norm_step -> Prims.bool) = - fun projectee -> match projectee with | Weak -> true | uu___ -> false -let (uu___is_HNF : norm_step -> Prims.bool) = - fun projectee -> match projectee with | HNF -> true | uu___ -> false -let (uu___is_Primops : norm_step -> Prims.bool) = - fun projectee -> match projectee with | Primops -> true | uu___ -> false -let (uu___is_Delta : norm_step -> Prims.bool) = - fun projectee -> match projectee with | Delta -> true | uu___ -> false -let (uu___is_Zeta : norm_step -> Prims.bool) = - fun projectee -> match projectee with | Zeta -> true | uu___ -> false -let (uu___is_ZetaFull : norm_step -> Prims.bool) = - fun projectee -> match projectee with | ZetaFull -> true | uu___ -> false -let (uu___is_Iota : norm_step -> Prims.bool) = - fun projectee -> match projectee with | Iota -> true | uu___ -> false -let (uu___is_NBE : norm_step -> Prims.bool) = - fun projectee -> match projectee with | NBE -> true | uu___ -> false -let (uu___is_Reify : norm_step -> Prims.bool) = - fun projectee -> match projectee with | Reify -> true | uu___ -> false -let (uu___is_UnfoldOnly : norm_step -> Prims.bool) = - fun projectee -> - match projectee with | UnfoldOnly _0 -> true | uu___ -> false -let (__proj__UnfoldOnly__item___0 : norm_step -> Prims.string Prims.list) = - fun projectee -> match projectee with | UnfoldOnly _0 -> _0 -let (uu___is_UnfoldFully : norm_step -> Prims.bool) = - fun projectee -> - match projectee with | UnfoldFully _0 -> true | uu___ -> false -let (__proj__UnfoldFully__item___0 : norm_step -> Prims.string Prims.list) = - fun projectee -> match projectee with | UnfoldFully _0 -> _0 -let (uu___is_UnfoldAttr : norm_step -> Prims.bool) = - fun projectee -> - match projectee with | UnfoldAttr _0 -> true | uu___ -> false -let (__proj__UnfoldAttr__item___0 : norm_step -> Prims.string Prims.list) = - fun projectee -> match projectee with | UnfoldAttr _0 -> _0 -let (uu___is_UnfoldQual : norm_step -> Prims.bool) = - fun projectee -> - match projectee with | UnfoldQual _0 -> true | uu___ -> false -let (__proj__UnfoldQual__item___0 : norm_step -> Prims.string Prims.list) = - fun projectee -> match projectee with | UnfoldQual _0 -> _0 -let (uu___is_UnfoldNamespace : norm_step -> Prims.bool) = - fun projectee -> - match projectee with | UnfoldNamespace _0 -> true | uu___ -> false -let (__proj__UnfoldNamespace__item___0 : - norm_step -> Prims.string Prims.list) = - fun projectee -> match projectee with | UnfoldNamespace _0 -> _0 -let (uu___is_Unmeta : norm_step -> Prims.bool) = - fun projectee -> match projectee with | Unmeta -> true | uu___ -> false -let (uu___is_Unascribe : norm_step -> Prims.bool) = - fun projectee -> match projectee with | Unascribe -> true | uu___ -> false -let (simplify : norm_step) = Simpl -let (weak : norm_step) = Weak -let (hnf : norm_step) = HNF -let (primops : norm_step) = Primops -let (delta : norm_step) = Delta -let (zeta : norm_step) = Zeta -let (zeta_full : norm_step) = ZetaFull -let (iota : norm_step) = Iota -let (nbe : norm_step) = NBE -let (reify_ : norm_step) = Reify -let (delta_only : Prims.string Prims.list -> norm_step) = - fun s -> UnfoldOnly s -let (delta_fully : Prims.string Prims.list -> norm_step) = - fun s -> UnfoldFully s -let (delta_attr : Prims.string Prims.list -> norm_step) = - fun s -> UnfoldAttr s -let (delta_qualifier : Prims.string Prims.list -> norm_step) = - fun s -> UnfoldAttr s -let (delta_namespace : Prims.string Prims.list -> norm_step) = - fun s -> UnfoldNamespace s -let (unmeta : norm_step) = Unmeta -let (unascribe : norm_step) = Unascribe -let (norm : norm_step Prims.list -> unit -> Obj.t -> Obj.t) = - fun uu___ -> fun uu___1 -> fun x -> x -type ('a, 'x, 'uuuuu) pure_return = unit -type ('a, 'b, 'wp1, 'wp2, 'uuuuu) pure_bind_wp = 'wp1 -type ('a, 'p, 'wputhen, 'wpuelse, 'uuuuu) pure_if_then_else = unit -type ('a, 'wp, 'uuuuu) pure_ite_wp = unit -type ('a, 'b, 'wp, 'uuuuu) pure_close_wp = unit -type ('a, 'uuuuu) pure_null_wp = unit -type ('p, 'uuuuu) pure_assert_wp = unit -type ('p, 'uuuuu) pure_assume_wp = unit -type ('a, 'pre, 'post, 'uuuuu) div_hoare_to_wp = unit -type 'heap st_pre_h = unit -type ('heap, 'a, 'pre) st_post_h' = unit -type ('heap, 'a) st_post_h = unit -type ('heap, 'a) st_wp_h = unit -type ('heap, 'a, 'x, 'p, 'uuuuu) st_return = 'p -type ('heap, 'a, 'b, 'wp1, 'wp2, 'p, 'h0) st_bind_wp = 'wp1 -type ('heap, 'a, 'p, 'wputhen, 'wpuelse, 'post, 'h0) st_if_then_else = unit -type ('heap, 'a, 'wp, 'post, 'h0) st_ite_wp = unit -type ('heap, 'a, 'wp1, 'wp2) st_stronger = unit -type ('heap, 'a, 'b, 'wp, 'p, 'h) st_close_wp = unit -type ('heap, 'a, 'wp) st_trivial = unit -type 'a result = - | V of 'a - | E of Prims.exn - | Err of Prims.string -let uu___is_V : 'a . 'a result -> Prims.bool = - fun projectee -> match projectee with | V v -> true | uu___ -> false -let __proj__V__item__v : 'a . 'a result -> 'a = - fun projectee -> match projectee with | V v -> v -let uu___is_E : 'a . 'a result -> Prims.bool = - fun projectee -> match projectee with | E e -> true | uu___ -> false -let __proj__E__item__e : 'a . 'a result -> Prims.exn = - fun projectee -> match projectee with | E e -> e -let uu___is_Err : 'a . 'a result -> Prims.bool = - fun projectee -> match projectee with | Err msg -> true | uu___ -> false -let __proj__Err__item__msg : 'a . 'a result -> Prims.string = - fun projectee -> match projectee with | Err msg -> msg -type ex_pre = unit -type ('a, 'pre) ex_post' = unit -type 'a ex_post = unit -type 'a ex_wp = unit -type ('a, 'x, 'p) ex_return = 'p -type ('a, 'b, 'wp1, 'wp2, 'p) ex_bind_wp = unit -type ('a, 'p, 'wputhen, 'wpuelse, 'post) ex_if_then_else = unit -type ('a, 'wp, 'post) ex_ite_wp = unit -type ('a, 'wp1, 'wp2) ex_stronger = unit -type ('a, 'b, 'wp, 'p) ex_close_wp = unit -type ('a, 'wp) ex_trivial = 'wp -type ('a, 'wp, 'p) lift_div_exn = 'wp -type 'h all_pre_h = unit -type ('h, 'a, 'pre) all_post_h' = unit -type ('h, 'a) all_post_h = unit -type ('h, 'a) all_wp_h = unit -type ('heap, 'a, 'x, 'p, 'uuuuu) all_return = 'p -type ('heap, 'a, 'b, 'wp1, 'wp2, 'p, 'h0) all_bind_wp = 'wp1 -type ('heap, 'a, 'p, 'wputhen, 'wpuelse, 'post, 'h0) all_if_then_else = unit -type ('heap, 'a, 'wp, 'post, 'h0) all_ite_wp = unit -type ('heap, 'a, 'wp1, 'wp2) all_stronger = unit -type ('heap, 'a, 'b, 'wp, 'p, 'h) all_close_wp = unit -type ('heap, 'a, 'wp) all_trivial = unit -type 'uuuuu inversion = unit type ('a, 'b) either = - | Inl of 'a - | Inr of 'b -let uu___is_Inl : 'a 'b . ('a, 'b) either -> Prims.bool = - fun projectee -> match projectee with | Inl v -> true | uu___ -> false -let __proj__Inl__item__v : 'a 'b . ('a, 'b) either -> 'a = - fun projectee -> match projectee with | Inl v -> v -let uu___is_Inr : 'a 'b . ('a, 'b) either -> Prims.bool = - fun projectee -> match projectee with | Inr v -> true | uu___ -> false -let __proj__Inr__item__v : 'a 'b . ('a, 'b) either -> 'b = - fun projectee -> match projectee with | Inr v -> v -let dfst : 'a 'b . ('a, 'b) Prims.dtuple2 -> 'a = - fun t -> Prims.__proj__Mkdtuple2__item___1 t -let dsnd : 'a 'b . ('a, 'b) Prims.dtuple2 -> 'b = - fun t -> Prims.__proj__Mkdtuple2__item___2 t -type ('a, 'b, 'c) dtuple3 = - | Mkdtuple3 of 'a * 'b * 'c -let uu___is_Mkdtuple3 : 'a 'b 'c . ('a, 'b, 'c) dtuple3 -> Prims.bool = - fun projectee -> true -let __proj__Mkdtuple3__item___1 : 'a 'b 'c . ('a, 'b, 'c) dtuple3 -> 'a = - fun projectee -> match projectee with | Mkdtuple3 (_1, _2, _3) -> _1 -let __proj__Mkdtuple3__item___2 : 'a 'b 'c . ('a, 'b, 'c) dtuple3 -> 'b = - fun projectee -> match projectee with | Mkdtuple3 (_1, _2, _3) -> _2 -let __proj__Mkdtuple3__item___3 : 'a 'b 'c . ('a, 'b, 'c) dtuple3 -> 'c = - fun projectee -> match projectee with | Mkdtuple3 (_1, _2, _3) -> _3 -type ('a, 'b, 'c, 'd) dtuple4 = - | Mkdtuple4 of 'a * 'b * 'c * 'd -let uu___is_Mkdtuple4 : 'a 'b 'c 'd . ('a, 'b, 'c, 'd) dtuple4 -> Prims.bool - = fun projectee -> true -let __proj__Mkdtuple4__item___1 : - 'a 'b 'c 'd . ('a, 'b, 'c, 'd) dtuple4 -> 'a = - fun projectee -> match projectee with | Mkdtuple4 (_1, _2, _3, _4) -> _1 -let __proj__Mkdtuple4__item___2 : - 'a 'b 'c 'd . ('a, 'b, 'c, 'd) dtuple4 -> 'b = - fun projectee -> match projectee with | Mkdtuple4 (_1, _2, _3, _4) -> _2 -let __proj__Mkdtuple4__item___3 : - 'a 'b 'c 'd . ('a, 'b, 'c, 'd) dtuple4 -> 'c = - fun projectee -> match projectee with | Mkdtuple4 (_1, _2, _3, _4) -> _3 -let __proj__Mkdtuple4__item___4 : - 'a 'b 'c 'd . ('a, 'b, 'c, 'd) dtuple4 -> 'd = - fun projectee -> match projectee with | Mkdtuple4 (_1, _2, _3, _4) -> _4 -let rec false_elim : 'uuuuu . unit -> 'uuuuu = fun uu___ -> false_elim () -type __internal_ocaml_attributes = - | PpxDerivingShow - | PpxDerivingShowConstant of Prims.string - | PpxDerivingYoJson - | CInline - | Substitute - | Gc - | Comment of Prims.string - | CPrologue of Prims.string - | CEpilogue of Prims.string - | CConst of Prims.string - | CCConv of Prims.string - | CAbstractStruct - | CIfDef - | CMacro -let (uu___is_PpxDerivingShow : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> - match projectee with | PpxDerivingShow -> true | uu___ -> false -let (uu___is_PpxDerivingShowConstant : - __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> - match projectee with - | PpxDerivingShowConstant _0 -> true - | uu___ -> false -let (__proj__PpxDerivingShowConstant__item___0 : - __internal_ocaml_attributes -> Prims.string) = - fun projectee -> match projectee with | PpxDerivingShowConstant _0 -> _0 -let (uu___is_PpxDerivingYoJson : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> - match projectee with | PpxDerivingYoJson -> true | uu___ -> false -let (uu___is_CInline : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> match projectee with | CInline -> true | uu___ -> false -let (uu___is_Substitute : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> match projectee with | Substitute -> true | uu___ -> false -let (uu___is_Gc : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> match projectee with | Gc -> true | uu___ -> false -let (uu___is_Comment : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> match projectee with | Comment _0 -> true | uu___ -> false -let (__proj__Comment__item___0 : __internal_ocaml_attributes -> Prims.string) - = fun projectee -> match projectee with | Comment _0 -> _0 -let (uu___is_CPrologue : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> - match projectee with | CPrologue _0 -> true | uu___ -> false -let (__proj__CPrologue__item___0 : - __internal_ocaml_attributes -> Prims.string) = - fun projectee -> match projectee with | CPrologue _0 -> _0 -let (uu___is_CEpilogue : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> - match projectee with | CEpilogue _0 -> true | uu___ -> false -let (__proj__CEpilogue__item___0 : - __internal_ocaml_attributes -> Prims.string) = - fun projectee -> match projectee with | CEpilogue _0 -> _0 -let (uu___is_CConst : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> match projectee with | CConst _0 -> true | uu___ -> false -let (__proj__CConst__item___0 : __internal_ocaml_attributes -> Prims.string) - = fun projectee -> match projectee with | CConst _0 -> _0 -let (uu___is_CCConv : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> match projectee with | CCConv _0 -> true | uu___ -> false -let (__proj__CCConv__item___0 : __internal_ocaml_attributes -> Prims.string) - = fun projectee -> match projectee with | CCConv _0 -> _0 -let (uu___is_CAbstractStruct : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> - match projectee with | CAbstractStruct -> true | uu___ -> false -let (uu___is_CIfDef : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> match projectee with | CIfDef -> true | uu___ -> false -let (uu___is_CMacro : __internal_ocaml_attributes -> Prims.bool) = - fun projectee -> match projectee with | CMacro -> true | uu___ -> false -let singleton : 'uuuuu . 'uuuuu -> 'uuuuu = fun x -> x -type 'a eqtype_as_type = 'a -let coerce_eq : 'a 'b . unit -> 'a -> 'b = - fun uu___1 -> fun uu___ -> (fun uu___ -> fun x -> Obj.magic x) uu___1 uu___ \ No newline at end of file + | Inl of 'a + | Inr of 'b diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Pervasives_Native.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Pervasives_Native.ml index f32c26377..72406f94f 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Pervasives_Native.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_Pervasives_Native.ml @@ -1,4 +1,3 @@ - type 'a option' = 'a option = | None | Some of 'a[@@deriving yojson,show] @@ -7,279 +6,5 @@ type 'a option = 'a option' = | None | Some of 'a[@@deriving yojson,show] -let uu___is_None = function None -> true | _ -> false -let uu___is_Some = function Some _ -> true | _ -> false -let __proj__Some__item__v = function Some x -> x | _ -> assert false - -(* 'a * 'b *) -type ('a,'b) tuple2 = 'a * 'b[@@deriving yojson,show] - let fst = Stdlib.fst let snd = Stdlib.snd - -let __proj__Mktuple2__1 = fst -let __proj__Mktuple2__2 = snd - -type ('a,'b,'c) tuple3 = - 'a* 'b* 'c -[@@deriving yojson,show] -let uu___is_Mktuple3 projectee = true -let __proj__Mktuple3__item___1 projectee = - match projectee with | (_1,_2,_3) -> _1 -let __proj__Mktuple3__item___2 projectee = - match projectee with | (_1,_2,_3) -> _2 -let __proj__Mktuple3__item___3 projectee = - match projectee with | (_1,_2,_3) -> _3 - -type ('a,'b,'c,'d) tuple4 = - 'a* 'b* 'c* 'd -[@@deriving yojson,show] -let uu___is_Mktuple4 projectee = true -let __proj__Mktuple4__item___1 projectee = - match projectee with | (_1,_2,_3,_4) -> _1 -let __proj__Mktuple4__item___2 projectee = - match projectee with | (_1,_2,_3,_4) -> _2 -let __proj__Mktuple4__item___3 projectee = - match projectee with | (_1,_2,_3,_4) -> _3 -let __proj__Mktuple4__item___4 projectee = - match projectee with | (_1,_2,_3,_4) -> _4 - -type ('a,'b,'c,'d,'e) tuple5 = - 'a* 'b* 'c* 'd* 'e -[@@deriving yojson,show] -let uu___is_Mktuple5 projectee = true -let __proj__Mktuple5__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5) -> _1 -let __proj__Mktuple5__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5) -> _2 -let __proj__Mktuple5__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5) -> _3 -let __proj__Mktuple5__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5) -> _4 -let __proj__Mktuple5__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5) -> _5 - -type ('a,'b,'c,'d,'e,'f) tuple6 = - 'a* 'b* 'c* 'd* 'e* 'f -[@@deriving yojson,show] -let uu___is_Mktuple6 projectee = true -let __proj__Mktuple6__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6) -> _1 -let __proj__Mktuple6__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6) -> _2 -let __proj__Mktuple6__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6) -> _3 -let __proj__Mktuple6__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6) -> _4 -let __proj__Mktuple6__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6) -> _5 -let __proj__Mktuple6__item___6 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6) -> _6 - -type ('a,'b,'c,'d,'e,'f,'g) tuple7 = - 'a* 'b* 'c* 'd* 'e* 'f* 'g -[@@deriving yojson,show] -let uu___is_Mktuple7 projectee = true -let __proj__Mktuple7__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7) -> _1 -let __proj__Mktuple7__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7) -> _2 -let __proj__Mktuple7__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7) -> _3 -let __proj__Mktuple7__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7) -> _4 -let __proj__Mktuple7__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7) -> _5 -let __proj__Mktuple7__item___6 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7) -> _6 -let __proj__Mktuple7__item___7 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7) -> _7 - -type ('a,'b,'c,'d,'e,'f,'g,'h) tuple8 = - 'a* 'b* 'c* 'd* 'e* 'f* 'g* 'h -[@@deriving yojson,show] -let uu___is_Mktuple8 projectee = true -let __proj__Mktuple8__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8) -> _1 -let __proj__Mktuple8__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8) -> _2 -let __proj__Mktuple8__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8) -> _3 -let __proj__Mktuple8__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8) -> _4 -let __proj__Mktuple8__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8) -> _5 -let __proj__Mktuple8__item___6 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8) -> _6 -let __proj__Mktuple8__item___7 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8) -> _7 -let __proj__Mktuple8__item___8 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8) -> _8 - -type ('a,'b,'c,'d,'e,'f,'g,'h,'i) tuple9 = - 'a *'b *'c *'d *'e *'f *'g *'h *'i -[@@deriving yojson,show] -let uu___is_Mktuple9 projectee = true -let __proj__Mktuple9__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9) -> _1 -let __proj__Mktuple9__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9) -> _2 -let __proj__Mktuple9__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9) -> _3 -let __proj__Mktuple9__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9) -> _4 -let __proj__Mktuple9__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9) -> _5 -let __proj__Mktuple9__item___6 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9) -> _6 -let __proj__Mktuple9__item___7 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9) -> _7 -let __proj__Mktuple9__item___8 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9) -> _8 -let __proj__Mktuple9__item___9 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9) -> _9 - -type ('a,'b,'c,'d,'e,'f,'g,'h,'i,'j) tuple10 = - 'a *'b *'c *'d *'e *'f *'g *'h *'i *'j -[@@deriving yojson,show] -let uu___is_Mktuple10 projectee = true -let __proj__Mktuple10__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _1 -let __proj__Mktuple10__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _2 -let __proj__Mktuple10__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _3 -let __proj__Mktuple10__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _4 -let __proj__Mktuple10__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _5 -let __proj__Mktuple10__item___6 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _6 -let __proj__Mktuple10__item___7 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _7 -let __proj__Mktuple10__item___8 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _8 -let __proj__Mktuple10__item___9 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _9 -let __proj__Mktuple10__item___10 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10) -> _10 - -type ('a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k) tuple11 = - 'a *'b *'c *'d *'e *'f *'g *'h *'i *'j *'k -[@@deriving yojson,show] -let uu___is_Mktuple11 projectee = true -let __proj__Mktuple11__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _1 -let __proj__Mktuple11__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _2 -let __proj__Mktuple11__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _3 -let __proj__Mktuple11__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _4 -let __proj__Mktuple11__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _5 -let __proj__Mktuple11__item___6 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _6 -let __proj__Mktuple11__item___7 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _7 -let __proj__Mktuple11__item___8 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _8 -let __proj__Mktuple11__item___9 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _9 -let __proj__Mktuple11__item___10 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _10 -let __proj__Mktuple11__item___11 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11) -> _11 - -type ('a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l) tuple12 = - 'a *'b *'c *'d *'e *'f *'g *'h *'i *'j *'k *'l -[@@deriving yojson,show] -let uu___is_Mktuple12 projectee = true -let __proj__Mktuple12__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _1 -let __proj__Mktuple12__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _2 -let __proj__Mktuple12__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _3 -let __proj__Mktuple12__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _4 -let __proj__Mktuple12__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _5 -let __proj__Mktuple12__item___6 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _6 -let __proj__Mktuple12__item___7 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _7 -let __proj__Mktuple12__item___8 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _8 -let __proj__Mktuple12__item___9 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _9 -let __proj__Mktuple12__item___10 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _10 -let __proj__Mktuple12__item___11 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _11 -let __proj__Mktuple12__item___12 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12) -> _12 - -type ('a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m) tuple13 = - 'a *'b *'c *'d *'e *'f *'g *'h *'i *'j *'k *'l *'m -[@@deriving yojson,show] -let uu___is_Mktuple13 projectee = true -let __proj__Mktuple13__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _1 -let __proj__Mktuple13__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _2 -let __proj__Mktuple13__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _3 -let __proj__Mktuple13__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _4 -let __proj__Mktuple13__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _5 -let __proj__Mktuple13__item___6 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _6 -let __proj__Mktuple13__item___7 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _7 -let __proj__Mktuple13__item___8 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _8 -let __proj__Mktuple13__item___9 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _9 -let __proj__Mktuple13__item___10 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _10 -let __proj__Mktuple13__item___11 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _11 -let __proj__Mktuple13__item___12 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _12 -let __proj__Mktuple13__item___13 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13) -> _13 - -type ('a,'b,'c,'d,'e,'f,'g,'h,'i,'j,'k,'l,'m,'n) tuple14 = - 'a *'b *'c *'d *'e *'f *'g *'h *'i *'j *'k *'l *'m *'n -[@@deriving yojson,show] -let uu___is_Mktuple14 projectee = true -let __proj__Mktuple14__item___1 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _1 -let __proj__Mktuple14__item___2 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _2 -let __proj__Mktuple14__item___3 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _3 -let __proj__Mktuple14__item___4 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _4 -let __proj__Mktuple14__item___5 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _5 -let __proj__Mktuple14__item___6 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _6 -let __proj__Mktuple14__item___7 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _7 -let __proj__Mktuple14__item___8 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _8 -let __proj__Mktuple14__item___9 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _9 -let __proj__Mktuple14__item___10 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _10 -let __proj__Mktuple14__item___11 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _11 -let __proj__Mktuple14__item___12 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _12 -let __proj__Mktuple14__item___13 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _13 -let __proj__Mktuple14__item___14 projectee = - match projectee with | (_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14) -> _14 diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_Platform.ml b/engine/backends/fstar/fstar-surface-ast/FStar_Platform.ml deleted file mode 100644 index 038ed9060..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_Platform.ml +++ /dev/null @@ -1,17 +0,0 @@ -type sys = -| Windows -| Posix - -let system = - if Sys.win32 || Sys.cygwin then - Windows - else - Posix - -let exe name = - if Sys.unix then - name - else - name^".exe" - -let is_fstar_compiler_using_ocaml = true diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_ST.ml b/engine/backends/fstar/fstar-surface-ast/FStar_ST.ml deleted file mode 100644 index a27ecf12b..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_ST.ml +++ /dev/null @@ -1,28 +0,0 @@ -(* https://www.lexifi.com/blog/references-physical-equality *) - -open FStar_CommonST - -type ('a, 'b) mref = ('a, 'b) FStar_Monotonic_Heap.mref - -type 'a ref = 'a FStar_Monotonic_Heap.ref - -let ref_to_yojson _ _ = `Null -let ref_of_yojson _ _ = failwith "cannot readback" - -let read = read - -let op_Bang = op_Bang - -let write = write - -let op_Colon_Equals = op_Colon_Equals - -let alloc = alloc - -let recall = recall -let get = get - -type 'a witnessed = 'a FStar_CommonST.witnessed - -let gst_witness = gst_witness -let gst_recall = gst_recall diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_String.ml b/engine/backends/fstar/fstar-surface-ast/FStar_String.ml index 9dcff4a94..1cfe3f803 100644 --- a/engine/backends/fstar/fstar-surface-ast/FStar_String.ml +++ b/engine/backends/fstar/fstar-surface-ast/FStar_String.ml @@ -16,28 +16,15 @@ let split seps s = repeat_split l seps in repeat_split [s] seps let compare x y = Z.of_int (BatString.compare x y) -type char = FStar_Char.char let concat = BatString.concat let length s = Z.of_int (BatUTF8.length s) -let strlen s = length s let substring s i j = BatUTF8.init (Z.to_int j) (fun k -> BatUTF8.get s (k + Z.to_int i)) -let sub = substring let get s i = BatUChar.code (BatUTF8.get s (Z.to_int i)) -let collect f s = - let r = ref "" in - BatUTF8.iter (fun c -> r := !r ^ f (BatUChar.code c)) s; !r let lowercase = BatString.lowercase_ascii let uppercase = BatString.uppercase_ascii let escaped = BatString.escaped -let index = get -exception Found of int -let index_of s c = - let c = BatUChar.chr c in - try let _ = BatUTF8.iteri (fun c' i -> if c = c' then raise (Found i) else ()) s in Z.of_int (-1) - with Found i -> Z.of_int i let list_of_string s = BatList.init (BatUTF8.length s) (fun i -> BatUChar.code (BatUTF8.get s i)) let string_of_list l = BatUTF8.init (BatList.length l) (fun i -> BatUChar.chr (BatList.at l i)) -let string_of_char (c:char) = BatString.of_char (Char.chr c) diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_UInt16.ml b/engine/backends/fstar/fstar-surface-ast/FStar_UInt16.ml deleted file mode 100644 index 69409412a..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_UInt16.ml +++ /dev/null @@ -1,105 +0,0 @@ -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) -(* THIS IS AN AUTOGENERATED FILE! See ulib/ml/Makefile *) -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) - -(* This file is meant to be concatenated to FStar_Ints.ml.body *) -module M = Stdint.Uint16 -type uint16 = M.t -type t = M.t -let n = Prims.of_int 16 - -let uint_to_t x = M.of_string (Z.to_string x) -let __uint_to_t = uint_to_t -(* This .ml.body file is concatenated to every .ml.prefix file in this - * directory (ulib/ml/) to generate the OCaml realizations for machine - * integers, as they all pretty much share their definitions and are - * based on Stdint. *) - -let v (x:t) : Prims.int = Prims.parse_int (M.to_string x) - -let zero = M.zero -let one = M.one -let ones = M.pred M.zero - -(* Reexport add, plus aliases *) -let add = M.add -let add_underspec = M.add -let add_mod = M.add - -(* Reexport sub, plus aliases *) -let sub = M.sub -let sub_underspec = M.sub -let sub_mod = M.sub - -(* Reexport mul, plus aliases *) -let mul = M.mul -let mul_underspec = M.mul -let mul_mod = M.mul - -(* Conversions to Zarith's int *) -let to_int (x:t) : Z.t = Z.of_string (M.to_string x) -let of_int (x:Z.t) : t = M.of_string (Z.to_string x) - -(* Conversion to native ints; these are potentially unsafe and not part - * of the interface: they are meant to be called only from OCaml code - * that is doing the right thing *) -let of_native_int (x:int) : t = M.of_int x -let to_native_int (x:t) : int = M.to_int x - -(* Just reexport these *) -let div = M.div -let rem = M.rem -let logand = M.logand -let logxor = M.logxor -let logor = M.logor -let lognot = M.lognot -let to_string = M.to_string -let of_string = M.of_string - -let to_string_hex = M.to_string_hex - -let to_string_hex_pad i = - let s0 = M.to_string_hex i in - let len = (String.length s0 - 2) in - let s1 = String.sub s0 2 len in (* Remove leading "0x" *) - let zeroes = String.make ((Z.to_int n / 4) - len) '0' in - zeroes ^ s1 - -(* The shifts take a uint32 argument, so we need to convert *) -let shift_right n i = M.shift_right n (Stdint.Uint32.to_int i) -let shift_left n i = M.shift_left n (Stdint.Uint32.to_int i) -let shift_arithmetic_right = shift_right - -(* Comparison operators *) -let eq (a:t) (b:t) : bool = a = b -let gt (a:t) (b:t) : bool = a > b -let gte (a:t) (b:t) : bool = a >= b -let lt (a:t) (b:t) : bool = a < b -let lte (a:t) (b:t) : bool = a <= b - -(* NOT Constant time operators *) -let eq_mask (a:t) (b:t) : t = if a = b then ones else zero -let gte_mask (a:t) (b:t) : t = if a >= b then ones else zero - -(* Infix notations *) -let op_Plus_Hat = add -let op_Plus_Question_Hat = add_underspec -let op_Plus_Percent_Hat = add_mod -let op_Subtraction_Hat = sub -let op_Subtraction_Question_Hat = sub_underspec -let op_Subtraction_Percent_Hat = sub_mod -let op_Star_Hat = mul -let op_Star_Question_Hat = mul_underspec -let op_Star_Percent_Hat = mul_mod -let op_Slash_Hat = div -let op_Percent_Hat = rem -let op_Hat_Hat = logxor -let op_Amp_Hat = logand -let op_Bar_Hat = logor -let op_Less_Less_Hat = shift_left -let op_Greater_Greater_Hat = shift_right -let op_Equals_Hat = eq -let op_Greater_Hat = gt -let op_Greater_Equals_Hat = gte -let op_Less_Hat = lt -let op_Less_Equals_Hat = lte diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_UInt32.ml b/engine/backends/fstar/fstar-surface-ast/FStar_UInt32.ml deleted file mode 100644 index d02cd1862..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_UInt32.ml +++ /dev/null @@ -1,105 +0,0 @@ -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) -(* THIS IS AN AUTOGENERATED FILE! See ulib/ml/Makefile *) -(* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *) - -(* This file is meant to be concatenated to FStar_Ints.ml.body *) -module M = Stdint.Uint32 -type uint32 = M.t -type t = M.t -let n = Prims.of_int 32 - -let uint_to_t x = M.of_string (Z.to_string x) -let __uint_to_t = uint_to_t -(* This .ml.body file is concatenated to every .ml.prefix file in this - * directory (ulib/ml/) to generate the OCaml realizations for machine - * integers, as they all pretty much share their definitions and are - * based on Stdint. *) - -let v (x:t) : Prims.int = Prims.parse_int (M.to_string x) - -let zero = M.zero -let one = M.one -let ones = M.pred M.zero - -(* Reexport add, plus aliases *) -let add = M.add -let add_underspec = M.add -let add_mod = M.add - -(* Reexport sub, plus aliases *) -let sub = M.sub -let sub_underspec = M.sub -let sub_mod = M.sub - -(* Reexport mul, plus aliases *) -let mul = M.mul -let mul_underspec = M.mul -let mul_mod = M.mul - -(* Conversions to Zarith's int *) -let to_int (x:t) : Z.t = Z.of_string (M.to_string x) -let of_int (x:Z.t) : t = M.of_string (Z.to_string x) - -(* Conversion to native ints; these are potentially unsafe and not part - * of the interface: they are meant to be called only from OCaml code - * that is doing the right thing *) -let of_native_int (x:int) : t = M.of_int x -let to_native_int (x:t) : int = M.to_int x - -(* Just reexport these *) -let div = M.div -let rem = M.rem -let logand = M.logand -let logxor = M.logxor -let logor = M.logor -let lognot = M.lognot -let to_string = M.to_string -let of_string = M.of_string - -let to_string_hex = M.to_string_hex - -let to_string_hex_pad i = - let s0 = M.to_string_hex i in - let len = (String.length s0 - 2) in - let s1 = String.sub s0 2 len in (* Remove leading "0x" *) - let zeroes = String.make ((Z.to_int n / 4) - len) '0' in - zeroes ^ s1 - -(* The shifts take a uint32 argument, so we need to convert *) -let shift_right n i = M.shift_right n (Stdint.Uint32.to_int i) -let shift_left n i = M.shift_left n (Stdint.Uint32.to_int i) -let shift_arithmetic_right = shift_right - -(* Comparison operators *) -let eq (a:t) (b:t) : bool = a = b -let gt (a:t) (b:t) : bool = a > b -let gte (a:t) (b:t) : bool = a >= b -let lt (a:t) (b:t) : bool = a < b -let lte (a:t) (b:t) : bool = a <= b - -(* NOT Constant time operators *) -let eq_mask (a:t) (b:t) : t = if a = b then ones else zero -let gte_mask (a:t) (b:t) : t = if a >= b then ones else zero - -(* Infix notations *) -let op_Plus_Hat = add -let op_Plus_Question_Hat = add_underspec -let op_Plus_Percent_Hat = add_mod -let op_Subtraction_Hat = sub -let op_Subtraction_Question_Hat = sub_underspec -let op_Subtraction_Percent_Hat = sub_mod -let op_Star_Hat = mul -let op_Star_Question_Hat = mul_underspec -let op_Star_Percent_Hat = mul_mod -let op_Slash_Hat = div -let op_Percent_Hat = rem -let op_Hat_Hat = logxor -let op_Amp_Hat = logand -let op_Bar_Hat = logor -let op_Less_Less_Hat = shift_left -let op_Greater_Greater_Hat = shift_right -let op_Equals_Hat = eq -let op_Greater_Hat = gt -let op_Greater_Equals_Hat = gte -let op_Less_Hat = lt -let op_Less_Equals_Hat = lte diff --git a/engine/backends/fstar/fstar-surface-ast/FStar_UInt8.ml b/engine/backends/fstar/fstar-surface-ast/FStar_UInt8.ml deleted file mode 100644 index c0f303c59..000000000 --- a/engine/backends/fstar/fstar-surface-ast/FStar_UInt8.ml +++ /dev/null @@ -1,81 +0,0 @@ -type uint8 = int[@@deriving yojson,show] -type byte = uint8[@@deriving yojson,show] -type t = uint8[@@deriving yojson,show] -type t' = t[@@deriving yojson,show] - -let (%) x y = if x < 0 then (x mod y) + y else x mod y - -let n = Prims.parse_int "8" -let v (x:uint8) : Prims.int = Prims.parse_int (string_of_int x) - -let zero = 0 -let one = 1 -let ones = 255 - -let add (a:uint8) (b:uint8) : uint8 = a + b -let add_underspec a b = (add a b) land 255 -let add_mod = add_underspec - -let sub (a:uint8) (b:uint8) : uint8 = a - b -let sub_underspec a b = (sub a b) land 255 -let sub_mod = sub_underspec - -let mul (a:uint8) (b:uint8) : uint8 = a * b -let mul_underspec a b = (mul a b) land 255 -let mul_mod = mul_underspec - -let div (a:uint8) (b:uint8) : uint8 = a / b - -let rem (a:uint8) (b:uint8) : uint8 = a mod b - -let logand (a:uint8) (b:uint8) : uint8 = a land b -let logxor (a:uint8) (b:uint8) : uint8 = a lxor b -let logor (a:uint8) (b:uint8) : uint8 = a lor b -let lognot (a:uint8) : uint8 = lnot a - -let int_to_uint8 (x:Prims.int) : uint8 = Z.to_int x % 256 - -let shift_right (a:uint8) (b:Stdint.Uint32.t) : uint8 = a lsr (Stdint.Uint32.to_int b) -let shift_left (a:uint8) (b:Stdint.Uint32.t) : uint8 = (a lsl (Stdint.Uint32.to_int b)) land 255 - -(* Comparison operators *) -let eq (a:uint8) (b:uint8) : bool = a = b -let gt (a:uint8) (b:uint8) : bool = a > b -let gte (a:uint8) (b:uint8) : bool = a >= b -let lt (a:uint8) (b:uint8) : bool = a < b -let lte (a:uint8) (b:uint8) : bool = a <= b - -(* NOT Constant time comparison operators *) -let gte_mask (a:uint8) (b:uint8) : uint8 = if a >= b then 255 else 0 -let eq_mask (a:uint8) (b:uint8) : uint8 = if a = b then 255 else 0 - -(* Infix notations *) -let op_Plus_Hat = add -let op_Plus_Question_Hat = add_underspec -let op_Plus_Percent_Hat = add_mod -let op_Subtraction_Hat = sub -let op_Subtraction_Question_Hat = sub_underspec -let op_Subtraction_Percent_Hat = sub_mod -let op_Star_Hat = mul -let op_Star_Question_Hat = mul_underspec -let op_Star_Percent_Hat = mul_mod -let op_Slash_Hat = div -let op_Percent_Hat = rem -let op_Hat_Hat = logxor -let op_Amp_Hat = logand -let op_Bar_Hat = logor -let op_Less_Less_Hat = shift_left -let op_Greater_Greater_Hat = shift_right -let op_Equals_Hat = eq -let op_Greater_Hat = gt -let op_Greater_Equals_Hat = gte -let op_Less_Hat = lt -let op_Less_Equals_Hat = lte - -let of_string s = int_of_string s -let to_string s = string_of_int s -let to_string_hex s = Printf.sprintf "0x%x" s -let to_string_hex_pad s = Printf.sprintf "%02x" s -let uint_to_t s = int_to_uint8 s -let to_int s = s -let __uint_to_t = uint_to_t diff --git a/engine/backends/fstar/fstar-surface-ast/dune b/engine/backends/fstar/fstar-surface-ast/dune index e6b53bab5..5c7c7487a 100644 --- a/engine/backends/fstar/fstar-surface-ast/dune +++ b/engine/backends/fstar/fstar-surface-ast/dune @@ -1,7 +1,7 @@ (library (name fstar_surface_ast) (package hax-engine) - (libraries batteries zarith stdint ppxlib menhirLib pprint) + (libraries batteries stdint ppxlib menhirLib pprint base) (wrapped false) (preprocess (pps ppx_deriving.show ppx_deriving_yojson sedlex.ppx))) diff --git a/engine/backends/fstar/fstar-surface-ast/prims.ml b/engine/backends/fstar/fstar-surface-ast/prims.ml index d8348a1ea..6062e6cd3 100644 --- a/engine/backends/fstar/fstar-surface-ast/prims.ml +++ b/engine/backends/fstar/fstar-surface-ast/prims.ml @@ -12,103 +12,14 @@ let int_of_yojson x = | Ok x -> Ok (parse_int x) | Error x -> Error x -type attribute = unit -let (cps : attribute) = () -type 'Auu____5 hasEq = unit -type eqtype = unit type bool' = bool [@@deriving yojson,show] type bool = bool' [@@deriving yojson,show] -type empty = unit -(*This is how Coq extracts Inductive void := . Our extraction needs to be fixed to recognize when there - are no constructors and generate this type abbreviation*) -type trivial = - | T -let (uu___is_T : trivial -> bool) = fun projectee -> true -type nonrec unit = unit -type 'Ap squash = unit -type 'Ap auto_squash = unit -type l_True = unit -type l_False = unit -type ('Aa,'Ax,'dummyV0) equals = - | Refl -let uu___is_Refl : 'Aa . 'Aa -> 'Aa -> ('Aa,unit,unit) equals -> bool = - fun x -> fun uu____65 -> fun projectee -> true -type ('Aa,'Ax,'Ay) eq2 = unit -type ('Aa,'Ab,'Ax,'Ay) op_Equals_Equals_Equals = unit -type 'Ab b2t = unit -type ('Ap,'Aq) pair = - | Pair of 'Ap * 'Aq -let uu___is_Pair : 'Ap 'Aq . ('Ap,'Aq) pair -> bool = - fun projectee -> true -let __proj__Pair__item___1 : 'Ap 'Aq . ('Ap,'Aq) pair -> 'Ap = - fun projectee -> match projectee with | Pair (_0,_1) -> _0 -let __proj__Pair__item___2 : 'Ap 'Aq . ('Ap,'Aq) pair -> 'Aq = - fun projectee -> match projectee with | Pair (_0,_1) -> _1 -type ('Ap,'Aq) l_and = unit -type ('Ap,'Aq) sum = - | Left of 'Ap - | Right of 'Aq -let uu___is_Left : 'Ap 'Aq . ('Ap,'Aq) sum -> bool = - fun projectee -> - match projectee with | Left _0 -> true | uu____344 -> false -let __proj__Left__item___0 : 'Ap 'Aq . ('Ap,'Aq) sum -> 'Ap = - fun projectee -> match projectee with | Left _0 -> _0 -let uu___is_Right : 'Ap 'Aq . ('Ap,'Aq) sum -> bool = - fun projectee -> - match projectee with | Right _0 -> true | uu____404 -> false - -let __proj__Right__item___0 : 'Ap 'Aq . ('Ap,'Aq) sum -> 'Aq = - fun projectee -> match projectee with | Right _0 -> _0 -type ('Ap,'Aq) l_or = unit -type ('Ap,'Aq) l_imp = unit -type ('Ap,'Aq) l_iff = unit -type 'Ap l_not = unit -type ('Ap,'Aq,'Ar) l_ITE = unit -type ('Aa,'Ab,'Auu____484,'Auu____485) precedes = unit -type ('Aa,'Auu____490,'Auu____491) has_type = unit -type ('Aa,'Ap) l_Forall = unit -type prop = unit -let id x = x -type ('Aa,'Ab) dtuple2 = - | Mkdtuple2 of 'Aa * 'Ab -let uu___is_Mkdtuple2 : 'Aa 'Ab . ('Aa,'Ab) dtuple2 -> bool = - fun projectee -> true -let __proj__Mkdtuple2__item___1 : 'Aa 'Ab . ('Aa,'Ab) dtuple2 -> 'Aa = - fun projectee -> match projectee with | Mkdtuple2 (_1,_2) -> _1 -let __proj__Mkdtuple2__item___2 : 'Aa 'Ab . ('Aa,'Ab) dtuple2 -> 'Ab = - fun projectee -> match projectee with | Mkdtuple2 (_1,_2) -> _2 -type ('Aa,'Ap) l_Exists = unit -type _pos = int * int -type _rng = string * _pos * _pos -type range = _rng * _rng type string' = string[@@deriving yojson,show] type string = string'[@@deriving yojson,show] -type pure_pre = unit -type ('Aa,'Apre) pure_post' = unit -type 'Aa pure_post = unit -type 'Aa pure_wp = unit -type 'Auu____655 guard_free = unit -type ('Aa,'Ax,'Ap) pure_return = unit -type ('Ar1,'Aa,'Ab,'Awp1,'Awp2,'Ap) pure_bind_wp = 'Awp1 -type ('Aa,'Ap,'Awp_then,'Awp_else,'Apost) pure_if_then_else = unit[@@deriving yojson,show] -type ('Aa,'Awp,'Apost) pure_ite_wp = unit -type ('Aa,'Awp1,'Awp2) pure_stronger = unit -type ('Aa,'Ab,'Awp,'Ap) pure_close_wp = unit -type ('Aa,'Aq,'Awp,'Ap) pure_assert_p = unit -type ('Aa,'Aq,'Awp,'Ap) pure_assume_p = unit -type ('Aa,'Ap) pure_null_wp = unit -type ('Aa,'Awp) pure_trivial = 'Awp -type ('Ap, 'Apost) pure_assert_wp = unit -type ('Aa,'Awp,'Auu____878) purewp_id = 'Awp -let mk_range f a b c d : range = let r = (f, (a, b), (c, d)) in (r, r) -let range_0 : range = let z = parse_int "0" in mk_range "" z z z z - -let op_AmpAmp x y = x && y -let op_BarBar x y = x || y let op_Negation x = not x let ( + ) = Z.add @@ -123,80 +34,13 @@ let ( mod ) = Z.erem let ( ~- ) = Z.neg let abs = Z.abs -let op_Multiply x y = x * y -let op_Subtraction x y = x - y -let op_Addition x y = x + y -let op_Minus x = -x -let op_LessThan x y = x < y -let op_LessThanOrEqual x y = x <= y -let op_GreaterThan x y = x > y -let op_GreaterThanOrEqual x y = x >= y -let op_Equality x y = x = y -let op_disEquality x y = x<>y - type nonrec exn = exn -type 'a array' = 'a array[@@deriving yojson,show] -type 'a array = 'a array'[@@deriving yojson,show] -let strcat x y = x ^ y let op_Hat x y = x ^ y type 'a list' = 'a list[@@deriving yojson,show] type 'a list = 'a list'[@@deriving yojson,show] -let uu___is_Nil : 'Aa . 'Aa list -> bool = - fun projectee -> match projectee with | [] -> true | uu____1190 -> false -let uu___is_Cons : 'Aa . 'Aa list -> bool = - fun projectee -> - match projectee with | hd::tl -> true | uu____1216 -> false - -let __proj__Cons__item__hd : 'Aa . 'Aa list -> 'Aa = - fun projectee -> match projectee with | hd::tl -> hd -let __proj__Cons__item__tl : 'Aa . 'Aa list -> 'Aa list = - fun projectee -> match projectee with | hd::tl -> tl -type pattern = unit - - -type ('Aa,'Auu____1278) decreases = unit -let returnM : 'Aa . 'Aa -> 'Aa = fun x -> x -type lex_t = - | LexTop - | LexCons of unit * Obj.t * lex_t -let (uu___is_LexTop : lex_t -> bool) = - fun projectee -> - match projectee with | LexTop -> true | uu____1313 -> false - -let (uu___is_LexCons : lex_t -> bool) = - fun projectee -> - match projectee with | LexCons (a,_1,_2) -> true | uu____1327 -> false - -type 'Aprojectee __proj__LexCons__item__a = Obj.t -let (__proj__LexCons__item___1 : lex_t -> Obj.t) = - fun projectee -> match projectee with | LexCons (a,_1,_2) -> _1 -let (__proj__LexCons__item___2 : lex_t -> lex_t) = - fun projectee -> match projectee with | LexCons (a,_1,_2) -> _2 -type ('Aa,'Awp) as_requires = 'Awp -type ('Aa,'Awp,'Ax) as_ensures = unit -let admit () = failwith "Prims.admit: cannot be executed" -let magic () = failwith "Prims.magic: cannot be executed" -let unsafe_coerce : 'Aa 'Ab . 'Aa -> 'Ab = - fun x -> Obj.magic x - -type 'Ap spinoff = 'Ap - type nat = int type pos = int -type nonzero = int -let op_Modulus x y = x mod y -let op_Division x y = x / y -let rec (pow2 : nat -> pos) = - fun x -> - Z.shift_left Z.one (Z.to_int x) - -let (min : int -> int -> int) = - fun x -> fun y -> if x <= y then x else y -let (abs : int -> int) = - fun x -> if x >= (parse_int "0") then x else op_Minus x let string_of_bool = string_of_bool let string_of_int = to_string - -type ('Ar,'Amsg,'Ab) labeled = 'Ab diff --git a/engine/backends/fstar/fstar-surface-ast/z.ml b/engine/backends/fstar/fstar-surface-ast/z.ml new file mode 100644 index 000000000..b9c06ce7c --- /dev/null +++ b/engine/backends/fstar/fstar-surface-ast/z.ml @@ -0,0 +1,38 @@ +type t = String.t [@@deriving show] + +let to_t = Base.Int.of_string +let of_t = Base.Int.to_string + +let compare = String.compare +let pp_print = pp +let hash = String.hash + + +let to_int: String.t -> Base.Int.t = Base.Int.of_string +let of_int: Base.Int.t -> String.t = Base.Int.to_string + + +let zero: String.t = "0" +let one: String.t = "1" +let of_string x = x +let to_string x = x + +open struct + let map (f: int -> int): string -> string = fun s -> Base.Int.of_string s |> f |> Base.Int.to_string + let map2 (f: int -> int -> int): string -> string -> string = fun x y -> f (Base.Int.of_string x) (Base.Int.of_string y) |> Base.Int.to_string + let map2' (f: int -> int -> 'a): string -> string -> 'a = fun x y -> f (Base.Int.of_string x) (Base.Int.of_string y) + end + +let add = map2 ( + ) +let sub = map2 ( - ) +let mul = map2 ( * ) +let ediv = map2 ( / ) +let leq = map2' ( <= ) +let geq = map2' ( >= ) +let lt = map2' ( < ) +let gt = map2' ( > ) +let erem = map2 Base.Int.( % ) +let neg = map Base.Int.neg +let abs = map abs +let shift_left: string -> Base.Int.t -> string = fun x i -> Base.Int.shift_left (Base.Int.of_string x) i |> Base.Int.to_string +let shift_right: string -> Base.Int.t -> string = fun x i -> Base.Int.shift_right (Base.Int.of_string x) i |> Base.Int.to_string diff --git a/engine/default.nix b/engine/default.nix index 9b8aa609c..df8c9cc7e 100644 --- a/engine/default.nix +++ b/engine/default.nix @@ -46,7 +46,6 @@ src = lib.sourceFilesBySuffices ./. [".ml" ".mli" ".js" "dune" "dune-js" "dune-project" "sh" "rs" "mld"]; buildInputs = with ocamlPackages; [ - zarith_stubs_js base ppx_yojson_conv yojson @@ -54,7 +53,6 @@ ppx_hash pprint non_empty_list - bignum ppx_deriving_yojson ppx_matches ppx_let @@ -77,7 +75,6 @@ ppxlib sedlex stdint - zarith ]; nativeBuildInputs = [ rustc diff --git a/engine/dune-project b/engine/dune-project index 6df3f59e8..6cf643031 100644 --- a/engine/dune-project +++ b/engine/dune-project @@ -44,11 +44,9 @@ js_of_ocaml-compiler js_of_ocaml js_of_ocaml-ppx - zarith_stubs_js ; F*-specific dependencies batteries - zarith stdint ppxlib menhirLib diff --git a/engine/hax-engine.opam b/engine/hax-engine.opam index dfa6b8be5..f9ae457ad 100644 --- a/engine/hax-engine.opam +++ b/engine/hax-engine.opam @@ -34,9 +34,7 @@ depends: [ "js_of_ocaml-compiler" "js_of_ocaml" "js_of_ocaml-ppx" - "zarith_stubs_js" "batteries" - "zarith" "stdint" "ppxlib" "menhirLib"