file_name
stringlengths 5
52
| name
stringlengths 4
95
| original_source_type
stringlengths 0
23k
| source_type
stringlengths 9
23k
| source_definition
stringlengths 9
57.9k
| source
dict | source_range
dict | file_context
stringlengths 0
721k
| dependencies
dict | opens_and_abbrevs
listlengths 2
94
| vconfig
dict | interleaved
bool 1
class | verbose_type
stringlengths 1
7.42k
| effect
stringclasses 118
values | effect_flags
sequencelengths 0
2
| mutual_with
sequencelengths 0
11
| ideal_premises
sequencelengths 0
236
| proof_features
sequencelengths 0
1
| is_simple_lemma
bool 2
classes | is_div
bool 2
classes | is_proof
bool 2
classes | is_simply_typed
bool 2
classes | is_type
bool 2
classes | partial_definition
stringlengths 5
3.99k
| completed_definiton
stringlengths 1
1.63M
| isa_cross_project_example
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_wp_LargeComment | val va_wp_LargeComment (c: string) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_LargeComment (c: string) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 1236,
"start_col": 0,
"start_line": 1235
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Prims.string ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.string",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_imp",
"Vale.X64.State.vale_state"
] | [] | false | false | false | true | true | let va_wp_LargeComment (c: string) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(let va_sM = va_s0 in
va_get_ok va_sM ==> va_k va_sM (()))) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_wp_Comment | val va_wp_Comment (c: string) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Comment (c: string) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 1212,
"start_col": 0,
"start_line": 1211
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Prims.string ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.string",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_imp",
"Vale.X64.State.vale_state"
] | [] | false | false | false | true | true | let va_wp_Comment (c: string) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(let va_sM = va_s0 in
va_get_ok va_sM ==> va_k va_sM (()))) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_wp_Xgetbv_Avx512 | val va_wp_Xgetbv_Avx512 (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Xgetbv_Avx512 (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 47,
"end_line": 1148,
"start_col": 0,
"start_line": 1142
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0))))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Vale.X64.CPU_Features_s.osxsave_enabled",
"Prims.op_Equality",
"Prims.int",
"Vale.X64.Decls.va_get_reg64",
"Vale.X64.Machine_s.rRcx",
"Prims.l_Forall",
"Vale.X64.Machine_s.nat64",
"Prims.l_imp",
"Prims.eq2",
"Prims.bool",
"Prims.op_GreaterThan",
"Vale.Arch.Types.iand64",
"Vale.X64.Machine_s.rRax",
"Vale.X64.CPU_Features_s.opmask_xcr0_enabled",
"Vale.X64.CPU_Features_s.zmm_hi256_xcr0_enabled",
"Vale.X64.CPU_Features_s.hi16_zmm_xcr0_enabled",
"Vale.X64.State.vale_state",
"Vale.X64.Decls.va_upd_reg64",
"Vale.X64.Machine_s.rRdx"
] | [] | false | false | false | true | true | let va_wp_Xgetbv_Avx512 (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\
(forall (va_x_rax: nat64) (va_x_rdx: nat64).
let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled ==>
va_k va_sM (()))) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Shr64 | val va_quick_Shr64 (dst: va_operand_dst_opr64) (amt: va_operand_shift_amt64)
: (va_quickCode unit (va_code_Shr64 dst amt)) | val va_quick_Shr64 (dst: va_operand_dst_opr64) (amt: va_operand_shift_amt64)
: (va_quickCode unit (va_code_Shr64 dst amt)) | let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt)) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 757,
"start_col": 0,
"start_line": 754
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_dst_opr64 -> amt: Vale.X64.Decls.va_operand_shift_amt64
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Shr64 dst amt) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_dst_opr64",
"Vale.X64.Decls.va_operand_shift_amt64",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.X64.InsBasic.va_code_Shr64",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_mod_dst_opr64",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Shr64",
"Vale.X64.InsBasic.va_wpProof_Shr64",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Shr64 (dst: va_operand_dst_opr64) (amt: va_operand_shift_amt64)
: (va_quickCode unit (va_code_Shr64 dst amt)) =
| (va_QProc (va_code_Shr64 dst amt)
([va_Mod_flags; va_mod_dst_opr64 dst])
(va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt)) | false |
Hacl.Impl.BignumQ.Mul.fsti | Hacl.Impl.BignumQ.Mul.wide_as_nat | val wide_as_nat (h: mem) (e: qelem_wide) : GTot nat | val wide_as_nat (h: mem) (e: qelem_wide) : GTot nat | let wide_as_nat (h:mem) (e:qelem_wide) : GTot nat =
let s = as_seq h e in
wide_as_nat5 (s.[0], s.[1], s.[2], s.[3], s.[4], s.[5], s.[6], s.[7], s.[8], s.[9]) | {
"file_name": "code/ed25519/Hacl.Impl.BignumQ.Mul.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 85,
"end_line": 34,
"start_col": 0,
"start_line": 32
} | module Hacl.Impl.BignumQ.Mul
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.Sequence
open Hacl.Spec.BignumQ.Definitions
module ST = FStar.HyperStack.ST
module S = Spec.Ed25519
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let qelemB = lbuffer uint64 5ul
inline_for_extraction noextract
let qelem_wide = lbuffer uint64 10ul
noextract
let as_nat (h:mem) (e:qelemB) : GTot nat =
let s = as_seq h e in
as_nat5 (s.[0], s.[1], s.[2], s.[3], s.[4]) | {
"checked_file": "/",
"dependencies": [
"Spec.Ed25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.BignumQ.Definitions.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.BignumQ.Mul.fsti"
} | [
{
"abbrev": true,
"full_module": "Spec.Ed25519",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.BignumQ.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.All",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.BignumQ",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.BignumQ",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: FStar.Monotonic.HyperStack.mem -> e: Hacl.Impl.BignumQ.Mul.qelem_wide -> Prims.GTot Prims.nat | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Monotonic.HyperStack.mem",
"Hacl.Impl.BignumQ.Mul.qelem_wide",
"Hacl.Spec.BignumQ.Definitions.wide_as_nat5",
"FStar.Pervasives.Native.Mktuple10",
"Lib.IntTypes.uint64",
"Lib.Sequence.op_String_Access",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"FStar.UInt32.__uint_to_t",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Prims.nat"
] | [] | false | false | false | false | false | let wide_as_nat (h: mem) (e: qelem_wide) : GTot nat =
| let s = as_seq h e in
wide_as_nat5 (s.[ 0 ],
s.[ 1 ],
s.[ 2 ],
s.[ 3 ],
s.[ 4 ],
s.[ 5 ],
s.[ 6 ],
s.[ 7 ],
s.[ 8 ],
s.[ 9 ]) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_wp_Newline | val va_wp_Newline (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Newline (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Newline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 1284,
"start_col": 0,
"start_line": 1283
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_LargeComment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_LargeComment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LargeComment c) ([]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_LargeComment (c:string) : (va_quickCode unit (va_code_LargeComment c)) =
(va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c))
//--
//-- NoNewline
val va_code_NoNewline : va_dummy:unit -> Tot va_code
val va_codegen_success_NoNewline : va_dummy:unit -> Tot va_pbool
val va_lemma_NoNewline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_NoNewline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_NoNewline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_NoNewline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_NoNewline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_NoNewline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_NoNewline () : (va_quickCode unit (va_code_NoNewline ())) =
(va_QProc (va_code_NoNewline ()) ([]) va_wp_NoNewline va_wpProof_NoNewline)
//--
//-- Newline
val va_code_Newline : va_dummy:unit -> Tot va_code
val va_codegen_success_Newline : va_dummy:unit -> Tot va_pbool
val va_lemma_Newline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Newline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_imp",
"Vale.X64.State.vale_state"
] | [] | false | false | false | true | true | let va_wp_Newline (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(let va_sM = va_s0 in
va_get_ok va_sM ==> va_k va_sM (()))) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_wp_Space | val va_wp_Space (n: nat) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_Space (n: nat) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_Space (n:nat) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 1308,
"start_col": 0,
"start_line": 1307
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_LargeComment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_LargeComment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LargeComment c) ([]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_LargeComment (c:string) : (va_quickCode unit (va_code_LargeComment c)) =
(va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c))
//--
//-- NoNewline
val va_code_NoNewline : va_dummy:unit -> Tot va_code
val va_codegen_success_NoNewline : va_dummy:unit -> Tot va_pbool
val va_lemma_NoNewline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_NoNewline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_NoNewline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_NoNewline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_NoNewline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_NoNewline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_NoNewline () : (va_quickCode unit (va_code_NoNewline ())) =
(va_QProc (va_code_NoNewline ()) ([]) va_wp_NoNewline va_wpProof_NoNewline)
//--
//-- Newline
val va_code_Newline : va_dummy:unit -> Tot va_code
val va_codegen_success_Newline : va_dummy:unit -> Tot va_pbool
val va_lemma_Newline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Newline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Newline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Newline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Newline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Newline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Newline () : (va_quickCode unit (va_code_Newline ())) =
(va_QProc (va_code_Newline ()) ([]) va_wp_Newline va_wpProof_Newline)
//--
//-- Space
val va_code_Space : n:nat -> Tot va_code
val va_codegen_success_Space : n:nat -> Tot va_pbool
val va_lemma_Space : va_b0:va_code -> va_s0:va_state -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Space n) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
n: Prims.nat ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_imp",
"Vale.X64.State.vale_state"
] | [] | false | false | false | true | true | let va_wp_Space (n: nat) (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(let va_sM = va_s0 in
va_get_ok va_sM ==> va_k va_sM (()))) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Cpuid_AES | val va_quick_Cpuid_AES: Prims.unit -> (va_quickCode unit (va_code_Cpuid_AES ())) | val va_quick_Cpuid_AES: Prims.unit -> (va_quickCode unit (va_code_Cpuid_AES ())) | let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 61,
"end_line": 791,
"start_col": 0,
"start_line": 789
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Cpuid_AES ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Cpuid_AES",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Cpuid_AES",
"Vale.X64.InsBasic.va_wpProof_Cpuid_AES",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
| (va_QProc (va_code_Cpuid_AES ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Cpuid_AES
va_wpProof_Cpuid_AES) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_wp_NoNewline | val va_wp_NoNewline (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | val va_wp_NoNewline (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 | let va_wp_NoNewline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (()))) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 81,
"end_line": 1260,
"start_col": 0,
"start_line": 1259
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_LargeComment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_LargeComment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LargeComment c) ([]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_LargeComment (c:string) : (va_quickCode unit (va_code_LargeComment c)) =
(va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c))
//--
//-- NoNewline
val va_code_NoNewline : va_dummy:unit -> Tot va_code
val va_codegen_success_NoNewline : va_dummy:unit -> Tot va_pbool
val va_lemma_NoNewline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_NoNewline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_s0: Vale.X64.Decls.va_state -> va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_imp",
"Vale.X64.State.vale_state"
] | [] | false | false | false | true | true | let va_wp_NoNewline (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0 =
| (va_get_ok va_s0 /\
(let va_sM = va_s0 in
va_get_ok va_sM ==> va_k va_sM (()))) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Cpuid_Avx512 | val va_quick_Cpuid_Avx512: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Avx512 ())) | val va_quick_Cpuid_Avx512: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Avx512 ())) | let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 67,
"end_line": 1059,
"start_col": 0,
"start_line": 1057
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Cpuid_Avx512 ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Cpuid_Avx512",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Cpuid_Avx512",
"Vale.X64.InsBasic.va_wpProof_Cpuid_Avx512",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
| (va_QProc (va_code_Cpuid_Avx512 ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Cpuid_Avx512
va_wpProof_Cpuid_Avx512) | false |
Spec.Blake2.Alternative.fst | Spec.Blake2.Alternative.repeati_update1 | val repeati_update1:
a:alg
-> b:block_s a
-> d:bytes{length d + (size_block a) <= max_limb a}
-> nb:nat{nb > 0 /\ nb <= length (b `Seq.append` d) / size_block a}
-> s:state a ->
Lemma (
repeati nb (blake2_update1 a 0 (b `Seq.append` d)) s ==
repeati (nb - 1) (blake2_update1 a (size_block a) d) (blake2_update_block a false (size_block a) b s)
) | val repeati_update1:
a:alg
-> b:block_s a
-> d:bytes{length d + (size_block a) <= max_limb a}
-> nb:nat{nb > 0 /\ nb <= length (b `Seq.append` d) / size_block a}
-> s:state a ->
Lemma (
repeati nb (blake2_update1 a 0 (b `Seq.append` d)) s ==
repeati (nb - 1) (blake2_update1 a (size_block a) d) (blake2_update_block a false (size_block a) b s)
) | let repeati_update1 a b d nb s =
let f = blake2_update1 a 0 (b `Seq.append` d) in
let f' = blake2_update1 a (size_block a) d in
let s' = blake2_update_block a false (size_block a) b s in
Classical.forall_intro_2 (lemma_update1_shift a b d);
assert (forall i s. f (i + 1) s == f' i s);
Lems.repeati_right_shift (nb - 1) f' f s;
assert (get_blocki a (b `Seq.append` d) 0 `Seq.equal` b);
assert (s' == f 0 s) | {
"file_name": "specs/lemmas/Spec.Blake2.Alternative.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 65,
"start_col": 0,
"start_line": 57
} | module Spec.Blake2.Alternative
open Spec.Blake2
open FStar.Mul
open Lib.IntTypes
open Lib.RawIntTypes
open Lib.Sequence
open Lib.ByteSequence
open Lib.LoopCombinators
module Lems = Lib.Sequence.Lemmas
module UpdateMulti = Lib.UpdateMulti
#set-options "--fuel 0 --ifuel 0 --z3rlimit 50"
val lemma_shift_update_last:
a:alg
-> rem: nat
-> b:block_s a
-> d:bytes{length d + (size_block a) <= max_limb a /\ rem <= length d /\ rem <= size_block a}
-> s:state a ->
Lemma (
blake2_update_last a 0 rem (b `Seq.append` d) s ==
blake2_update_last a (size_block a) rem d s
)
let lemma_shift_update_last a rem b d s =
let m = b `Seq.append` d in
assert (Seq.slice m (length m - rem) (length m) `Seq.equal` Seq.slice d (length d - rem) (length d));
assert (get_last_padded_block a (b `Seq.append` d) rem == get_last_padded_block a d rem)
val lemma_update1_shift:
a:alg
-> b:block_s a
-> d:bytes{length d + (size_block a) <= max_limb a}
-> i:nat{i < length d / size_block a /\ (size_block a) + length d <= max_limb a}
-> s:state a ->
Lemma (
blake2_update1 a 0 (b `Seq.append` d) (i + 1) s == blake2_update1 a (size_block a) d i s
)
let lemma_update1_shift a b d i s =
assert (get_blocki a (b `Seq.append` d) (i + 1) `Seq.equal` get_blocki a d i)
val repeati_update1:
a:alg
-> b:block_s a
-> d:bytes{length d + (size_block a) <= max_limb a}
-> nb:nat{nb > 0 /\ nb <= length (b `Seq.append` d) / size_block a}
-> s:state a ->
Lemma (
repeati nb (blake2_update1 a 0 (b `Seq.append` d)) s ==
repeati (nb - 1) (blake2_update1 a (size_block a) d) (blake2_update_block a false (size_block a) b s)
) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.Sequence.Lemmas.fsti.checked",
"Lib.Sequence.fsti.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Classical.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.Blake2.Alternative.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.UpdateMulti",
"short_module": "UpdateMulti"
},
{
"abbrev": true,
"full_module": "Lib.Sequence.Lemmas",
"short_module": "Lems"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.RawIntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteSequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Spec.Blake2.Definitions.alg ->
b: Spec.Blake2.Definitions.block_s a ->
d:
Lib.ByteSequence.bytes
{ Lib.Sequence.length d + Spec.Blake2.Definitions.size_block a <=
Spec.Blake2.Definitions.max_limb a } ->
nb:
Prims.nat
{ nb > 0 /\
nb <=
Lib.Sequence.length (FStar.Seq.Base.append b d) / Spec.Blake2.Definitions.size_block a } ->
s: Spec.Blake2.Definitions.state a
-> FStar.Pervasives.Lemma
(ensures
Lib.LoopCombinators.repeati nb (Spec.Blake2.blake2_update1 a 0 (FStar.Seq.Base.append b d)) s ==
Lib.LoopCombinators.repeati (nb - 1)
(Spec.Blake2.blake2_update1 a (Spec.Blake2.Definitions.size_block a) d)
(Spec.Blake2.blake2_update_block a false (Spec.Blake2.Definitions.size_block a) b s)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Spec.Blake2.Definitions.block_s",
"Lib.ByteSequence.bytes",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Spec.Blake2.Definitions.size_block",
"Spec.Blake2.Definitions.max_limb",
"Prims.nat",
"Prims.l_and",
"Prims.op_GreaterThan",
"Prims.op_Division",
"Lib.IntTypes.uint8",
"FStar.Seq.Base.append",
"Spec.Blake2.Definitions.state",
"Prims._assert",
"Prims.eq2",
"Prims.unit",
"FStar.Seq.Base.equal",
"Spec.Blake2.get_blocki",
"Lib.Sequence.Lemmas.repeati_right_shift",
"Prims.op_Subtraction",
"Prims.l_Forall",
"Prims.int",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThan",
"FStar.Classical.forall_intro_2",
"Spec.Blake2.blake2_update1",
"Spec.Blake2.Alternative.lemma_update1_shift",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Spec.Blake2.Definitions.wt",
"Spec.Blake2.blake2_update_block"
] | [] | false | false | true | false | false | let repeati_update1 a b d nb s =
| let f = blake2_update1 a 0 (b `Seq.append` d) in
let f' = blake2_update1 a (size_block a) d in
let s' = blake2_update_block a false (size_block a) b s in
Classical.forall_intro_2 (lemma_update1_shift a b d);
assert (forall i s. f (i + 1) s == f' i s);
Lems.repeati_right_shift (nb - 1) f' f s;
assert ((get_blocki a (b `Seq.append` d) 0) `Seq.equal` b);
assert (s' == f 0 s) | false |
FStar.Pervasives.fsti | FStar.Pervasives.id | val id (#a: Type) (x: a) : a | val id (#a: Type) (x: a) : a | let id (#a: Type) (x: a) : a = x | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 32,
"end_line": 130,
"start_col": 0,
"start_line": 130
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: a -> a | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | false | let id (#a: Type) (x: a) : a =
| x | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Cpuid_Avx | val va_quick_Cpuid_Avx: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Avx ())) | val va_quick_Cpuid_Avx: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Avx ())) | let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 61,
"end_line": 890,
"start_col": 0,
"start_line": 888
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Cpuid_Avx ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Cpuid_Avx",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Cpuid_Avx",
"Vale.X64.InsBasic.va_wpProof_Cpuid_Avx",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
| (va_QProc (va_code_Cpuid_Avx ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Cpuid_Avx
va_wpProof_Cpuid_Avx) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_wp_Prefetchnta | val va_wp_Prefetchnta (v: va_operand_opr64) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | val va_wp_Prefetchnta (v: va_operand_opr64) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 | let va_wp_Prefetchnta (v:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 v va_s0 /\ va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k
va_sM (()))) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 1335,
"start_col": 0,
"start_line": 1332
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_LargeComment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_LargeComment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LargeComment c) ([]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_LargeComment (c:string) : (va_quickCode unit (va_code_LargeComment c)) =
(va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c))
//--
//-- NoNewline
val va_code_NoNewline : va_dummy:unit -> Tot va_code
val va_codegen_success_NoNewline : va_dummy:unit -> Tot va_pbool
val va_lemma_NoNewline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_NoNewline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_NoNewline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_NoNewline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_NoNewline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_NoNewline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_NoNewline () : (va_quickCode unit (va_code_NoNewline ())) =
(va_QProc (va_code_NoNewline ()) ([]) va_wp_NoNewline va_wpProof_NoNewline)
//--
//-- Newline
val va_code_Newline : va_dummy:unit -> Tot va_code
val va_codegen_success_Newline : va_dummy:unit -> Tot va_pbool
val va_lemma_Newline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Newline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Newline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Newline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Newline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Newline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Newline () : (va_quickCode unit (va_code_Newline ())) =
(va_QProc (va_code_Newline ()) ([]) va_wp_Newline va_wpProof_Newline)
//--
//-- Space
val va_code_Space : n:nat -> Tot va_code
val va_codegen_success_Space : n:nat -> Tot va_pbool
val va_lemma_Space : va_b0:va_code -> va_s0:va_state -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Space n) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Space (n:nat) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Space : n:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Space n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Space n) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Space (n:nat) : (va_quickCode unit (va_code_Space n)) =
(va_QProc (va_code_Space n) ([]) (va_wp_Space n) (va_wpProof_Space n))
//--
//-- Prefetchnta
val va_code_Prefetchnta : v:va_operand_opr64 -> Tot va_code
val va_codegen_success_Prefetchnta : v:va_operand_opr64 -> Tot va_pbool
val va_lemma_Prefetchnta : va_b0:va_code -> va_s0:va_state -> v:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Prefetchnta v) va_s0 /\ va_is_src_opr64 v va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
v: Vale.X64.Decls.va_operand_opr64 ->
va_s0: Vale.X64.Decls.va_state ->
va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_opr64",
"Vale.X64.Decls.va_state",
"Prims.unit",
"Prims.l_and",
"Vale.X64.Decls.va_is_src_opr64",
"Prims.b2t",
"Vale.X64.Decls.va_get_ok",
"Prims.l_imp",
"Vale.X64.State.vale_state"
] | [] | false | false | false | true | true | let va_wp_Prefetchnta (v: va_operand_opr64) (va_s0: va_state) (va_k: (va_state -> unit -> Type0))
: Type0 =
| (va_is_src_opr64 v va_s0 /\ va_get_ok va_s0 /\
(let va_sM = va_s0 in
va_get_ok va_sM ==> va_k va_sM (()))) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Cpuid_Adx_Bmi2 | val va_quick_Cpuid_Adx_Bmi2: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) | val va_quick_Cpuid_Adx_Bmi2: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) | let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 71,
"end_line": 858,
"start_col": 0,
"start_line": 856
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Cpuid_Adx_Bmi2 ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Cpuid_Adx_Bmi2",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Cpuid_Adx_Bmi2",
"Vale.X64.InsBasic.va_wpProof_Cpuid_Adx_Bmi2",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
| (va_QProc (va_code_Cpuid_Adx_Bmi2 ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Cpuid_Adx_Bmi2
va_wpProof_Cpuid_Adx_Bmi2) | false |
FStar.Pervasives.fsti | FStar.Pervasives.reveal_opaque | val reveal_opaque : s: Prims.string -> x: _
-> FStar.Pervasives.Lemma (ensures FStar.Pervasives.norm [FStar.Pervasives.delta_only [s]] x == x) | let reveal_opaque (s: string) = norm_spec [delta_only [s]] | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 58,
"end_line": 332,
"start_col": 0,
"start_line": 332
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: Prims.string -> x: _
-> FStar.Pervasives.Lemma (ensures FStar.Pervasives.norm [FStar.Pervasives.delta_only [s]] x == x) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.string",
"FStar.Pervasives.norm_spec",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta_only",
"Prims.Nil",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Pervasives.norm",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let reveal_opaque (s: string) =
| norm_spec [delta_only [s]] | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.trivial_pure_post | val trivial_pure_post (a: Type) : pure_post a | val trivial_pure_post (a: Type) : pure_post a | let trivial_pure_post (a: Type) : pure_post a = fun _ -> True | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 61,
"end_line": 134,
"start_col": 0,
"start_line": 134
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> Prims.pure_post a | Prims.Tot | [
"total"
] | [] | [
"Prims.l_True",
"Prims.pure_post"
] | [] | false | false | false | true | false | let trivial_pure_post (a: Type) : pure_post a =
| fun _ -> True | false |
FStar.Pervasives.fsti | FStar.Pervasives.pure_return | val pure_return (a: Type) (x: a) : pure_wp a | val pure_return (a: Type) (x: a) : pure_wp a | let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 340,
"start_col": 0,
"start_line": 338
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> x: a -> Prims.pure_wp a | Prims.Tot | [
"total"
] | [] | [
"Prims.pure_return0",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Prims.pure_wp'",
"Prims.logical",
"Prims.pure_wp_monotonic",
"Prims.pure_wp"
] | [] | false | false | false | true | false | let pure_return (a: Type) (x: a) : pure_wp a =
| reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Cpuid_Avx2 | val va_quick_Cpuid_Avx2: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Avx2 ())) | val va_quick_Cpuid_Avx2: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Avx2 ())) | let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 922,
"start_col": 0,
"start_line": 920
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Cpuid_Avx2 ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Cpuid_Avx2",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Cpuid_Avx2",
"Vale.X64.InsBasic.va_wpProof_Cpuid_Avx2",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
| (va_QProc (va_code_Cpuid_Avx2 ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Cpuid_Avx2
va_wpProof_Cpuid_Avx2) | false |
FStar.Pervasives.fsti | FStar.Pervasives.pure_bind_wp | val pure_bind_wp (a b: Type) (wp1: pure_wp a) (wp2: (a -> Tot (pure_wp b))) : Tot (pure_wp b) | val pure_bind_wp (a b: Type) (wp1: pure_wp a) (wp2: (a -> Tot (pure_wp b))) : Tot (pure_wp b) | let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 27,
"end_line": 345,
"start_col": 0,
"start_line": 343
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> b: Type -> wp1: Prims.pure_wp a -> wp2: (_: a -> Prims.pure_wp b) -> Prims.pure_wp b | Prims.Tot | [
"total"
] | [] | [
"Prims.pure_wp",
"Prims.pure_bind_wp0",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Prims.pure_wp'",
"Prims.logical",
"Prims.pure_wp_monotonic"
] | [] | false | false | false | true | false | let pure_bind_wp (a b: Type) (wp1: pure_wp a) (wp2: (a -> Tot (pure_wp b))) : Tot (pure_wp b) =
| reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2 | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Cpuid_Movbe | val va_quick_Cpuid_Movbe: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Movbe ())) | val va_quick_Cpuid_Movbe: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Movbe ())) | let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 65,
"end_line": 989,
"start_col": 0,
"start_line": 987
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Cpuid_Movbe ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Cpuid_Movbe",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Cpuid_Movbe",
"Vale.X64.InsBasic.va_wpProof_Cpuid_Movbe",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
| (va_QProc (va_code_Cpuid_Movbe ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Cpuid_Movbe
va_wpProof_Cpuid_Movbe) | false |
FStar.Pervasives.fsti | FStar.Pervasives.pure_ite_wp | val pure_ite_wp (a: Type) (wp: pure_wp a) : Tot (pure_wp a) | val pure_ite_wp (a: Type) (wp: pure_wp a) : Tot (pure_wp a) | let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 19,
"end_line": 355,
"start_col": 0,
"start_line": 353
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> wp: Prims.pure_wp a -> Prims.pure_wp a | Prims.Tot | [
"total"
] | [] | [
"Prims.pure_wp",
"Prims.pure_ite_wp0",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Prims.pure_wp'",
"Prims.logical",
"Prims.pure_wp_monotonic"
] | [] | false | false | false | true | false | let pure_ite_wp (a: Type) (wp: pure_wp a) : Tot (pure_wp a) =
| reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp | false |
FStar.Pervasives.fsti | FStar.Pervasives.pure_null_wp | val pure_null_wp (a: Type) : Tot (pure_wp a) | val pure_null_wp (a: Type) : Tot (pure_wp a) | let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 365,
"start_col": 0,
"start_line": 363
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> Prims.pure_wp a | Prims.Tot | [
"total"
] | [] | [
"Prims.pure_null_wp0",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Prims.pure_wp'",
"Prims.logical",
"Prims.pure_wp_monotonic",
"Prims.pure_wp"
] | [] | false | false | false | true | false | let pure_null_wp (a: Type) : Tot (pure_wp a) =
| reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a | false |
FStar.Pervasives.fsti | FStar.Pervasives.st_post_h' | val st_post_h' : heap: Type -> a: Type -> pre: Type -> Type | let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 67,
"end_line": 441,
"start_col": 0,
"start_line": 441
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | heap: Type -> a: Type -> pre: Type -> Type | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | true | let st_post_h' (heap a pre: Type) =
| a -> _: heap{pre} -> GTot Type0 | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.pure_close_wp | val pure_close_wp (a b: Type) (wp: (b -> Tot (pure_wp a))) : Tot (pure_wp a) | val pure_close_wp (a b: Type) (wp: (b -> Tot (pure_wp a))) : Tot (pure_wp a) | let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 23,
"end_line": 360,
"start_col": 0,
"start_line": 358
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> b: Type -> wp: (_: b -> Prims.pure_wp a) -> Prims.pure_wp a | Prims.Tot | [
"total"
] | [] | [
"Prims.pure_wp",
"Prims.pure_close_wp0",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Prims.pure_wp'",
"Prims.logical",
"Prims.pure_wp_monotonic"
] | [] | false | false | false | true | false | let pure_close_wp (a b: Type) (wp: (b -> Tot (pure_wp a))) : Tot (pure_wp a) =
| reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp | false |
FStar.Pervasives.fsti | FStar.Pervasives.st_pre_h | val st_pre_h : heap: Type -> Type | let st_pre_h (heap: Type) = heap -> GTot Type0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 436,
"start_col": 0,
"start_line": 436
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | heap: Type -> Type | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | true | let st_pre_h (heap: Type) =
| heap -> GTot Type0 | false |
|
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Cpuid_Sse | val va_quick_Cpuid_Sse: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Sse ())) | val va_quick_Cpuid_Sse: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Sse ())) | let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 61,
"end_line": 957,
"start_col": 0,
"start_line": 955
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Cpuid_Sse ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Cpuid_Sse",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Cpuid_Sse",
"Vale.X64.InsBasic.va_wpProof_Cpuid_Sse",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
| (va_QProc (va_code_Cpuid_Sse ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Cpuid_Sse
va_wpProof_Cpuid_Sse) | false |
FStar.Pervasives.fsti | FStar.Pervasives.st_post_h | val st_post_h : heap: Type -> a: Type -> Type | let st_post_h (heap a: Type) = st_post_h' heap a True | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 53,
"end_line": 444,
"start_col": 0,
"start_line": 444
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | heap: Type -> a: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.st_post_h'",
"Prims.l_True"
] | [] | false | false | false | true | true | let st_post_h (heap a: Type) =
| st_post_h' heap a True | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.st_wp_h | val st_wp_h : heap: Type -> a: Type -> Type | let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 68,
"end_line": 447,
"start_col": 0,
"start_line": 447
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | heap: Type -> a: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.st_post_h",
"FStar.Pervasives.st_pre_h"
] | [] | false | false | false | true | true | let st_wp_h (heap a: Type) =
| st_post_h heap a -> Tot (st_pre_h heap) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.st_return | val st_return : heap: Type -> a: Type -> x: a -> p: FStar.Pervasives.st_post_h heap a -> _: heap{Prims.l_True}
-> Prims.GTot Type0 | let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 63,
"end_line": 451,
"start_col": 0,
"start_line": 451
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | heap: Type -> a: Type -> x: a -> p: FStar.Pervasives.st_post_h heap a -> _: heap{Prims.l_True}
-> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Pervasives.st_post_h",
"Prims.l_True"
] | [] | false | false | false | false | true | let st_return (heap a: Type) (x: a) (p: st_post_h heap a) =
| p x | false |
|
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Cpuid_Osxsave | val va_quick_Cpuid_Osxsave: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Osxsave ())) | val va_quick_Cpuid_Osxsave: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Osxsave ())) | let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 1091,
"start_col": 0,
"start_line": 1089
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Cpuid_Osxsave ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Cpuid_Osxsave",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Cpuid_Osxsave",
"Vale.X64.InsBasic.va_wpProof_Cpuid_Osxsave",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
| (va_QProc (va_code_Cpuid_Osxsave ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Cpuid_Osxsave
va_wpProof_Cpuid_Osxsave) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Cpuid_Rdrand | val va_quick_Cpuid_Rdrand: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Rdrand ())) | val va_quick_Cpuid_Rdrand: Prims.unit -> (va_quickCode unit (va_code_Cpuid_Rdrand ())) | let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 67,
"end_line": 1021,
"start_col": 0,
"start_line": 1019
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Cpuid_Rdrand ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Cpuid_Rdrand",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRcx",
"Vale.X64.Machine_s.rRbx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Cpuid_Rdrand",
"Vale.X64.InsBasic.va_wpProof_Cpuid_Rdrand",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
| (va_QProc (va_code_Cpuid_Rdrand ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])
va_wp_Cpuid_Rdrand
va_wpProof_Cpuid_Rdrand) | false |
FStar.Pervasives.fsti | FStar.Pervasives.st_if_then_else | val st_if_then_else : heap: Type ->
a: Type ->
p: Type0 ->
wp_then: FStar.Pervasives.st_wp_h heap a ->
wp_else: FStar.Pervasives.st_wp_h heap a ->
post: FStar.Pervasives.st_post_h heap a ->
h0: heap
-> Prims.logical | let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 50,
"end_line": 471,
"start_col": 0,
"start_line": 466
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
p: Type0 ->
wp_then: FStar.Pervasives.st_wp_h heap a ->
wp_else: FStar.Pervasives.st_wp_h heap a ->
post: FStar.Pervasives.st_post_h heap a ->
h0: heap
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.st_wp_h",
"FStar.Pervasives.st_post_h",
"Prims.l_and",
"Prims.l_imp",
"Prims.l_not",
"Prims.logical"
] | [] | false | false | false | true | true | let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
=
| wp_then post h0 /\ (~p ==> wp_else post h0) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.st_ite_wp | val st_ite_wp : heap: Type ->
a: Type ->
wp: FStar.Pervasives.st_wp_h heap a ->
post: FStar.Pervasives.st_post_h heap a ->
h0: heap
-> Prims.logical | let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 93,
"end_line": 478,
"start_col": 0,
"start_line": 476
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
wp: FStar.Pervasives.st_wp_h heap a ->
post: FStar.Pervasives.st_post_h heap a ->
h0: heap
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.st_wp_h",
"FStar.Pervasives.st_post_h",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.guard_free",
"Prims.logical"
] | [] | false | false | false | true | true | let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
| forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0 | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.st_close_wp | val st_close_wp : heap: Type ->
a: Type ->
b: Type ->
wp: (_: b -> Prims.GTot (FStar.Pervasives.st_wp_h heap a)) ->
p: FStar.Pervasives.st_post_h heap a ->
h: heap
-> Prims.logical | let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 27,
"end_line": 488,
"start_col": 0,
"start_line": 487
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
b: Type ->
wp: (_: b -> Prims.GTot (FStar.Pervasives.st_wp_h heap a)) ->
p: FStar.Pervasives.st_post_h heap a ->
h: heap
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.st_wp_h",
"FStar.Pervasives.st_post_h",
"Prims.l_Forall",
"Prims.logical"
] | [] | false | false | false | false | true | let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
| (forall (b: b). wp b p h) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.st_bind_wp | val st_bind_wp : heap: Type ->
a: Type ->
b: Type ->
wp1: FStar.Pervasives.st_wp_h heap a ->
wp2: (_: a -> Prims.GTot (FStar.Pervasives.st_wp_h heap b)) ->
p: FStar.Pervasives.st_post_h heap b ->
h0: heap
-> Type0 | let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 462,
"start_col": 0,
"start_line": 455
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
b: Type ->
wp1: FStar.Pervasives.st_wp_h heap a ->
wp2: (_: a -> Prims.GTot (FStar.Pervasives.st_wp_h heap b)) ->
p: FStar.Pervasives.st_post_h heap b ->
h0: heap
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.st_wp_h",
"FStar.Pervasives.st_post_h",
"Prims.l_True"
] | [] | false | false | false | false | true | let st_bind_wp
(heap a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
=
| wp1 (fun a h1 -> wp2 a p h1) h0 | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.st_stronger | val st_stronger : heap: Type ->
a: Type ->
wp1: FStar.Pervasives.st_wp_h heap a ->
wp2: FStar.Pervasives.st_wp_h heap a
-> Prims.logical | let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 63,
"end_line": 483,
"start_col": 0,
"start_line": 482
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
wp1: FStar.Pervasives.st_wp_h heap a ->
wp2: FStar.Pervasives.st_wp_h heap a
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.st_wp_h",
"Prims.l_Forall",
"FStar.Pervasives.st_post_h",
"Prims.l_imp",
"Prims.logical"
] | [] | false | false | false | true | true | let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
| (forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.ex_pre | val ex_pre : Type | let ex_pre = Type0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 524,
"start_col": 0,
"start_line": 524
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | true | let ex_pre =
| Type0 | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.ex_post' | val ex_post' : a: Type -> pre: Type -> Type | let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 60,
"end_line": 527,
"start_col": 0,
"start_line": 527
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> pre: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.result"
] | [] | false | false | false | true | true | let ex_post' (a pre: Type) =
| _: result a {pre} -> GTot Type0 | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.div_hoare_to_wp | val div_hoare_to_wp (#a: Type) (#pre: pure_pre) (post: pure_post' a pre) : Tot (pure_wp a) | val div_hoare_to_wp (#a: Type) (#pre: pure_pre) (post: pure_post' a pre) : Tot (pure_wp a) | let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 58,
"end_line": 408,
"start_col": 0,
"start_line": 406
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | post: Prims.pure_post' a pre -> Prims.pure_wp a | Prims.Tot | [
"total"
] | [] | [
"Prims.pure_pre",
"Prims.pure_post'",
"Prims.pure_post",
"Prims.l_and",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.logical",
"Prims.unit",
"FStar.Pervasives.reveal_opaque",
"Prims.pure_wp'",
"Prims.pure_wp_monotonic",
"Prims.pure_wp"
] | [] | false | false | false | false | false | let div_hoare_to_wp (#a: Type) (#pre: pure_pre) (post: pure_post' a pre) : Tot (pure_wp a) =
| reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p: pure_post a) -> pre /\ (forall a. post a ==> p a) | false |
FStar.Pervasives.fsti | FStar.Pervasives.ex_post | val ex_post : a: Type -> Type | let ex_post (a: Type) = ex_post' a True | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 530,
"start_col": 0,
"start_line": 530
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.ex_post'",
"Prims.l_True"
] | [] | false | false | false | true | true | let ex_post (a: Type) =
| ex_post' a True | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.st_trivial | val st_trivial : heap: Type -> a: Type -> wp: FStar.Pervasives.st_wp_h heap a -> Prims.logical | let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 90,
"end_line": 492,
"start_col": 0,
"start_line": 492
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | heap: Type -> a: Type -> wp: FStar.Pervasives.st_wp_h heap a -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.st_wp_h",
"Prims.l_Forall",
"Prims.l_True",
"Prims.logical"
] | [] | false | false | false | true | true | let st_trivial (heap a: Type) (wp: st_wp_h heap a) =
| (forall h0. wp (fun r h1 -> True) h0) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.ex_return | val ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 | val ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 | let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 68,
"end_line": 537,
"start_col": 0,
"start_line": 537
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> x: a -> p: FStar.Pervasives.ex_post a -> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Pervasives.ex_post",
"FStar.Pervasives.V"
] | [] | false | false | false | false | true | let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 =
| p (V x) | false |
FStar.Pervasives.fsti | FStar.Pervasives.ex_wp | val ex_wp : a: Type -> Type | let ex_wp (a: Type) = ex_post a -> GTot ex_pre | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 533,
"start_col": 0,
"start_line": 533
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.ex_post",
"FStar.Pervasives.ex_pre"
] | [] | false | false | false | true | true | let ex_wp (a: Type) =
| ex_post a -> GTot ex_pre | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.ex_close_wp | val ex_close_wp : a: Type ->
b: Type ->
wp: (_: b -> Prims.GTot (FStar.Pervasives.ex_wp a)) ->
p: FStar.Pervasives.ex_post a
-> Prims.logical | let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 96,
"end_line": 569,
"start_col": 0,
"start_line": 569
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
b: Type ->
wp: (_: b -> Prims.GTot (FStar.Pervasives.ex_wp a)) ->
p: FStar.Pervasives.ex_post a
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.ex_wp",
"FStar.Pervasives.ex_post",
"Prims.l_Forall",
"Prims.logical"
] | [] | false | false | false | false | true | let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) =
| (forall (b: b). wp b p) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.ex_trivial | val ex_trivial : a: Type -> wp: FStar.Pervasives.ex_wp a -> FStar.Pervasives.ex_pre | let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 59,
"end_line": 573,
"start_col": 0,
"start_line": 573
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> wp: FStar.Pervasives.ex_wp a -> FStar.Pervasives.ex_pre | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.ex_wp",
"FStar.Pervasives.result",
"Prims.l_True",
"FStar.Pervasives.ex_pre"
] | [] | false | false | false | true | false | let ex_trivial (a: Type) (wp: ex_wp a) =
| wp (fun r -> True) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.ex_stronger | val ex_stronger : a: Type -> wp1: FStar.Pervasives.ex_wp a -> wp2: FStar.Pervasives.ex_wp a -> Prims.logical | let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 87,
"end_line": 565,
"start_col": 0,
"start_line": 565
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> wp1: FStar.Pervasives.ex_wp a -> wp2: FStar.Pervasives.ex_wp a -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.ex_wp",
"Prims.l_Forall",
"FStar.Pervasives.ex_post",
"Prims.l_imp",
"Prims.logical"
] | [] | false | false | false | true | true | let ex_stronger (a: Type) (wp1 wp2: ex_wp a) =
| (forall (p: ex_post a). wp1 p ==> wp2 p) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.ex_if_then_else | val ex_if_then_else : a: Type ->
p: Type0 ->
wp_then: FStar.Pervasives.ex_wp a ->
wp_else: FStar.Pervasives.ex_wp a ->
post: FStar.Pervasives.ex_post a
-> Prims.logical | let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 39,
"end_line": 555,
"start_col": 0,
"start_line": 554
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
p: Type0 ->
wp_then: FStar.Pervasives.ex_wp a ->
wp_else: FStar.Pervasives.ex_wp a ->
post: FStar.Pervasives.ex_post a
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.ex_wp",
"FStar.Pervasives.ex_post",
"Prims.l_and",
"Prims.l_imp",
"Prims.l_not",
"Prims.logical"
] | [] | false | false | false | true | true | let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
| wp_then post /\ (~p ==> wp_else post) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.ex_ite_wp | val ex_ite_wp : a: Type -> wp: FStar.Pervasives.ex_wp a -> post: FStar.Pervasives.ex_post a -> Prims.logical | let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 85,
"end_line": 561,
"start_col": 0,
"start_line": 559
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> wp: FStar.Pervasives.ex_wp a -> post: FStar.Pervasives.ex_post a -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.ex_wp",
"FStar.Pervasives.ex_post",
"Prims.l_Forall",
"Prims.l_imp",
"FStar.Pervasives.result",
"Prims.guard_free",
"Prims.logical"
] | [] | false | false | false | true | true | let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
| forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k | false |
|
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Xgetbv_Avx512 | val va_quick_Xgetbv_Avx512: Prims.unit -> (va_quickCode unit (va_code_Xgetbv_Avx512 ())) | val va_quick_Xgetbv_Avx512: Prims.unit -> (va_quickCode unit (va_code_Xgetbv_Avx512 ())) | let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 1158,
"start_col": 0,
"start_line": 1156
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Xgetbv_Avx512 ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Xgetbv_Avx512",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Xgetbv_Avx512",
"Vale.X64.InsBasic.va_wpProof_Xgetbv_Avx512",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
| (va_QProc (va_code_Xgetbv_Avx512 ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRax])
va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512) | false |
FStar.Pervasives.fsti | FStar.Pervasives.all_post_h' | val all_post_h' : h: Type -> a: Type -> pre: Type -> Type | let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 69,
"end_line": 622,
"start_col": 0,
"start_line": 622
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: Type -> a: Type -> pre: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.result"
] | [] | false | false | false | true | true | let all_post_h' (h a pre: Type) =
| result a -> _: h{pre} -> GTot Type0 | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.all_pre_h | val all_pre_h : h: Type -> Type | let all_pre_h (h: Type) = h -> GTot Type0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 41,
"end_line": 619,
"start_col": 0,
"start_line": 619
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: Type -> Type | Prims.Tot | [
"total"
] | [] | [] | [] | false | false | false | true | true | let all_pre_h (h: Type) =
| h -> GTot Type0 | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.lift_div_exn | val lift_div_exn : a: Type -> wp: Prims.pure_wp a -> p: FStar.Pervasives.ex_post a -> Prims.pure_pre | let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a)) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 81,
"end_line": 597,
"start_col": 0,
"start_line": 597
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> wp: Prims.pure_wp a -> p: FStar.Pervasives.ex_post a -> Prims.pure_pre | Prims.Tot | [
"total"
] | [] | [
"Prims.pure_wp",
"FStar.Pervasives.ex_post",
"Prims.l_True",
"FStar.Pervasives.V",
"Prims.pure_pre"
] | [] | false | false | false | true | false | let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) =
| wp (fun a -> p (V a)) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.all_post_h | val all_post_h : h: Type -> a: Type -> Type | let all_post_h (h a: Type) = all_post_h' h a True | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 49,
"end_line": 625,
"start_col": 0,
"start_line": 625
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: Type -> a: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.all_post_h'",
"Prims.l_True"
] | [] | false | false | false | true | true | let all_post_h (h a: Type) =
| all_post_h' h a True | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.all_wp_h | val all_wp_h : h: Type -> a: Type -> Type | let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 62,
"end_line": 628,
"start_col": 0,
"start_line": 628
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: Type -> a: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.all_post_h",
"FStar.Pervasives.all_pre_h"
] | [] | false | false | false | true | true | let all_wp_h (h a: Type) =
| all_post_h h a -> Tot (all_pre_h h) | false |
|
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Prefetchnta | val va_quick_Prefetchnta (v: va_operand_opr64) : (va_quickCode unit (va_code_Prefetchnta v)) | val va_quick_Prefetchnta (v: va_operand_opr64) : (va_quickCode unit (va_code_Prefetchnta v)) | let va_quick_Prefetchnta (v:va_operand_opr64) : (va_quickCode unit (va_code_Prefetchnta v)) =
(va_QProc (va_code_Prefetchnta v) ([]) (va_wp_Prefetchnta v) (va_wpProof_Prefetchnta v)) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 90,
"end_line": 1345,
"start_col": 0,
"start_line": 1344
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_LargeComment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_LargeComment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LargeComment c) ([]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_LargeComment (c:string) : (va_quickCode unit (va_code_LargeComment c)) =
(va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c))
//--
//-- NoNewline
val va_code_NoNewline : va_dummy:unit -> Tot va_code
val va_codegen_success_NoNewline : va_dummy:unit -> Tot va_pbool
val va_lemma_NoNewline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_NoNewline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_NoNewline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_NoNewline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_NoNewline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_NoNewline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_NoNewline () : (va_quickCode unit (va_code_NoNewline ())) =
(va_QProc (va_code_NoNewline ()) ([]) va_wp_NoNewline va_wpProof_NoNewline)
//--
//-- Newline
val va_code_Newline : va_dummy:unit -> Tot va_code
val va_codegen_success_Newline : va_dummy:unit -> Tot va_pbool
val va_lemma_Newline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Newline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Newline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Newline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Newline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Newline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Newline () : (va_quickCode unit (va_code_Newline ())) =
(va_QProc (va_code_Newline ()) ([]) va_wp_Newline va_wpProof_Newline)
//--
//-- Space
val va_code_Space : n:nat -> Tot va_code
val va_codegen_success_Space : n:nat -> Tot va_pbool
val va_lemma_Space : va_b0:va_code -> va_s0:va_state -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Space n) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Space (n:nat) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Space : n:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Space n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Space n) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Space (n:nat) : (va_quickCode unit (va_code_Space n)) =
(va_QProc (va_code_Space n) ([]) (va_wp_Space n) (va_wpProof_Space n))
//--
//-- Prefetchnta
val va_code_Prefetchnta : v:va_operand_opr64 -> Tot va_code
val va_codegen_success_Prefetchnta : v:va_operand_opr64 -> Tot va_pbool
val va_lemma_Prefetchnta : va_b0:va_code -> va_s0:va_state -> v:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Prefetchnta v) va_s0 /\ va_is_src_opr64 v va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Prefetchnta (v:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 v va_s0 /\ va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k
va_sM (())))
val va_wpProof_Prefetchnta : v:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Prefetchnta v va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Prefetchnta v) ([]) va_s0 va_k
((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | v: Vale.X64.Decls.va_operand_opr64
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Prefetchnta v) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_opr64",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.X64.InsBasic.va_code_Prefetchnta",
"Prims.Nil",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.InsBasic.va_wp_Prefetchnta",
"Vale.X64.InsBasic.va_wpProof_Prefetchnta",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Prefetchnta (v: va_operand_opr64) : (va_quickCode unit (va_code_Prefetchnta v)) =
| (va_QProc (va_code_Prefetchnta v) ([]) (va_wp_Prefetchnta v) (va_wpProof_Prefetchnta v)) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Nat64Equal | val va_quick_Nat64Equal (dst src: va_operand_reg_opr64)
: (va_quickCode unit (va_code_Nat64Equal dst src)) | val va_quick_Nat64Equal (dst src: va_operand_reg_opr64)
: (va_quickCode unit (va_code_Nat64Equal dst src)) | let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src)) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 1197,
"start_col": 0,
"start_line": 1194
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | dst: Vale.X64.Decls.va_operand_reg_opr64 -> src: Vale.X64.Decls.va_operand_reg_opr64
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Nat64Equal dst src) | Prims.Tot | [
"total"
] | [] | [
"Vale.X64.Decls.va_operand_reg_opr64",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.X64.InsBasic.va_code_Nat64Equal",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_flags",
"Vale.X64.QuickCode.va_mod_reg_opr64",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Nat64Equal",
"Vale.X64.InsBasic.va_wpProof_Nat64Equal",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Nat64Equal (dst src: va_operand_reg_opr64)
: (va_quickCode unit (va_code_Nat64Equal dst src)) =
| (va_QProc (va_code_Nat64Equal dst src)
([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64 dst])
(va_wp_Nat64Equal dst src)
(va_wpProof_Nat64Equal dst src)) | false |
FStar.Pervasives.fsti | FStar.Pervasives.all_if_then_else | val all_if_then_else : heap: Type ->
a: Type ->
p: Type0 ->
wp_then: FStar.Pervasives.all_wp_h heap a ->
wp_else: FStar.Pervasives.all_wp_h heap a ->
post: FStar.Pervasives.all_post_h heap a ->
h0: heap
-> Prims.logical | let all_if_then_else
(heap a p: Type)
(wp_then wp_else: all_wp_h heap a)
(post: all_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 50,
"end_line": 660,
"start_col": 0,
"start_line": 655
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *)
unfold
let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x)
(** Sequential composition for [ALL_h] is like [EXN]: case analysis of
the exceptional result before "running" the continuation *)
unfold
let all_bind_wp
(heap: Type)
(a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0
(** Case analysis in [ALL_h] *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
p: Type0 ->
wp_then: FStar.Pervasives.all_wp_h heap a ->
wp_else: FStar.Pervasives.all_wp_h heap a ->
post: FStar.Pervasives.all_post_h heap a ->
h0: heap
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.all_wp_h",
"FStar.Pervasives.all_post_h",
"Prims.l_and",
"Prims.l_imp",
"Prims.l_not",
"Prims.logical"
] | [] | false | false | false | true | true | let all_if_then_else
(heap a p: Type)
(wp_then wp_else: all_wp_h heap a)
(post: all_post_h heap a)
(h0: heap)
=
| wp_then post h0 /\ (~p ==> wp_else post h0) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.all_ite_wp | val all_ite_wp : heap: Type ->
a: Type ->
wp: FStar.Pervasives.all_wp_h heap a ->
post: FStar.Pervasives.all_post_h heap a ->
h0: heap
-> Prims.logical | let all_ite_wp (heap a: Type) (wp: all_wp_h heap a) (post: all_post_h heap a) (h0: heap) =
forall (k: all_post_h heap a).
(forall (x: result a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 100,
"end_line": 666,
"start_col": 0,
"start_line": 664
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *)
unfold
let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x)
(** Sequential composition for [ALL_h] is like [EXN]: case analysis of
the exceptional result before "running" the continuation *)
unfold
let all_bind_wp
(heap: Type)
(a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0
(** Case analysis in [ALL_h] *)
unfold
let all_if_then_else
(heap a p: Type)
(wp_then wp_else: all_wp_h heap a)
(post: all_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** Naming postcondition for better sharing in [ALL_h] *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
wp: FStar.Pervasives.all_wp_h heap a ->
post: FStar.Pervasives.all_post_h heap a ->
h0: heap
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.all_wp_h",
"FStar.Pervasives.all_post_h",
"Prims.l_Forall",
"Prims.l_imp",
"FStar.Pervasives.result",
"Prims.guard_free",
"Prims.logical"
] | [] | false | false | false | true | true | let all_ite_wp (heap a: Type) (wp: all_wp_h heap a) (post: all_post_h heap a) (h0: heap) =
| forall (k: all_post_h heap a).
(forall (x: result a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0 | false |
|
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_NoNewline | val va_quick_NoNewline: Prims.unit -> (va_quickCode unit (va_code_NoNewline ())) | val va_quick_NoNewline: Prims.unit -> (va_quickCode unit (va_code_NoNewline ())) | let va_quick_NoNewline () : (va_quickCode unit (va_code_NoNewline ())) =
(va_QProc (va_code_NoNewline ()) ([]) va_wp_NoNewline va_wpProof_NoNewline) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 77,
"end_line": 1269,
"start_col": 0,
"start_line": 1268
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_LargeComment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_LargeComment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LargeComment c) ([]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_LargeComment (c:string) : (va_quickCode unit (va_code_LargeComment c)) =
(va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c))
//--
//-- NoNewline
val va_code_NoNewline : va_dummy:unit -> Tot va_code
val va_codegen_success_NoNewline : va_dummy:unit -> Tot va_pbool
val va_lemma_NoNewline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_NoNewline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_NoNewline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_NoNewline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_NoNewline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_NoNewline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_NoNewline ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_NoNewline",
"Prims.Nil",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.InsBasic.va_wp_NoNewline",
"Vale.X64.InsBasic.va_wpProof_NoNewline",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_NoNewline () : (va_quickCode unit (va_code_NoNewline ())) =
| (va_QProc (va_code_NoNewline ()) ([]) va_wp_NoNewline va_wpProof_NoNewline) | false |
FStar.Pervasives.fsti | FStar.Pervasives.all_return | val all_return : heap: Type -> a: Type -> x: a -> p: FStar.Pervasives.all_post_h heap a -> _: heap{Prims.l_True}
-> Prims.GTot Type0 | let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 69,
"end_line": 633,
"start_col": 0,
"start_line": 633
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | heap: Type -> a: Type -> x: a -> p: FStar.Pervasives.all_post_h heap a -> _: heap{Prims.l_True}
-> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Pervasives.all_post_h",
"FStar.Pervasives.V",
"Prims.l_True"
] | [] | false | false | false | false | true | let all_return (heap a: Type) (x: a) (p: all_post_h heap a) =
| p (V x) | false |
|
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Xgetbv_Avx | val va_quick_Xgetbv_Avx: Prims.unit -> (va_quickCode unit (va_code_Xgetbv_Avx ())) | val va_quick_Xgetbv_Avx: Prims.unit -> (va_quickCode unit (va_code_Xgetbv_Avx ())) | let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 26,
"end_line": 1123,
"start_col": 0,
"start_line": 1121
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Xgetbv_Avx ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Xgetbv_Avx",
"Prims.Cons",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.QuickCode.va_Mod_reg64",
"Vale.X64.Machine_s.rRdx",
"Vale.X64.Machine_s.rRax",
"Prims.Nil",
"Vale.X64.InsBasic.va_wp_Xgetbv_Avx",
"Vale.X64.InsBasic.va_wpProof_Xgetbv_Avx",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
| (va_QProc (va_code_Xgetbv_Avx ())
([va_Mod_reg64 rRdx; va_Mod_reg64 rRax])
va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx) | false |
FStar.Pervasives.fsti | FStar.Pervasives.all_stronger | val all_stronger : heap: Type ->
a: Type ->
wp1: FStar.Pervasives.all_wp_h heap a ->
wp2: FStar.Pervasives.all_wp_h heap a
-> Prims.logical | let all_stronger (heap a: Type) (wp1 wp2: all_wp_h heap a) =
(forall (p: all_post_h heap a) (h: heap). wp1 p h ==> wp2 p h) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 64,
"end_line": 671,
"start_col": 0,
"start_line": 670
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *)
unfold
let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x)
(** Sequential composition for [ALL_h] is like [EXN]: case analysis of
the exceptional result before "running" the continuation *)
unfold
let all_bind_wp
(heap: Type)
(a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0
(** Case analysis in [ALL_h] *)
unfold
let all_if_then_else
(heap a p: Type)
(wp_then wp_else: all_wp_h heap a)
(post: all_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** Naming postcondition for better sharing in [ALL_h] *)
unfold
let all_ite_wp (heap a: Type) (wp: all_wp_h heap a) (post: all_post_h heap a) (h0: heap) =
forall (k: all_post_h heap a).
(forall (x: result a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption in [ALL_h] *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
wp1: FStar.Pervasives.all_wp_h heap a ->
wp2: FStar.Pervasives.all_wp_h heap a
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.all_wp_h",
"Prims.l_Forall",
"FStar.Pervasives.all_post_h",
"Prims.l_imp",
"Prims.logical"
] | [] | false | false | false | true | true | let all_stronger (heap a: Type) (wp1 wp2: all_wp_h heap a) =
| (forall (p: all_post_h heap a) (h: heap). wp1 p h ==> wp2 p h) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.ex_bind_wp | val ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b) : GTot Type0 | val ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b) : GTot Type0 | let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m))) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 32,
"end_line": 549,
"start_col": 0,
"start_line": 542
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
b: Type ->
wp1: FStar.Pervasives.ex_wp a ->
wp2: (_: a -> Prims.GTot (FStar.Pervasives.ex_wp b)) ->
p: FStar.Pervasives.ex_post b
-> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Pervasives.ex_wp",
"FStar.Pervasives.ex_post",
"Prims.l_Forall",
"Prims.l_imp",
"FStar.Pervasives.result",
"Prims.guard_free",
"Prims.l_True",
"Prims.exn",
"FStar.Pervasives.E",
"Prims.string",
"FStar.Pervasives.Err"
] | [] | false | false | false | false | true | let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b) : GTot Type0 =
| forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m))) | false |
FStar.Pervasives.fsti | FStar.Pervasives.all_close_wp | val all_close_wp : heap: Type ->
a: Type ->
b: Type ->
wp: (_: b -> Prims.GTot (FStar.Pervasives.all_wp_h heap a)) ->
p: FStar.Pervasives.all_post_h heap a ->
h: heap
-> Prims.logical | let all_close_wp
(heap a b: Type)
(wp: (b -> GTot (all_wp_h heap a)))
(p: all_post_h heap a)
(h: heap)
= (forall (b: b). wp b p h) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 32,
"end_line": 680,
"start_col": 0,
"start_line": 675
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *)
unfold
let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x)
(** Sequential composition for [ALL_h] is like [EXN]: case analysis of
the exceptional result before "running" the continuation *)
unfold
let all_bind_wp
(heap: Type)
(a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0
(** Case analysis in [ALL_h] *)
unfold
let all_if_then_else
(heap a p: Type)
(wp_then wp_else: all_wp_h heap a)
(post: all_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** Naming postcondition for better sharing in [ALL_h] *)
unfold
let all_ite_wp (heap a: Type) (wp: all_wp_h heap a) (post: all_post_h heap a) (h0: heap) =
forall (k: all_post_h heap a).
(forall (x: result a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption in [ALL_h] *)
unfold
let all_stronger (heap a: Type) (wp1 wp2: all_wp_h heap a) =
(forall (p: all_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing a binder in the scope of an [ALL_h] wp *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
b: Type ->
wp: (_: b -> Prims.GTot (FStar.Pervasives.all_wp_h heap a)) ->
p: FStar.Pervasives.all_post_h heap a ->
h: heap
-> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.all_wp_h",
"FStar.Pervasives.all_post_h",
"Prims.l_Forall",
"Prims.logical"
] | [] | false | false | false | false | true | let all_close_wp
(heap a b: Type)
(wp: (b -> GTot (all_wp_h heap a)))
(p: all_post_h heap a)
(h: heap)
=
| (forall (b: b). wp b p h) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.dfst | val dfst (#a: Type) (#b: (a -> GTot Type)) (t: dtuple2 a b) : Tot a | val dfst (#a: Type) (#b: (a -> GTot Type)) (t: dtuple2 a b) : Tot a | let dfst (#a: Type) (#b: a -> GTot Type) (t: dtuple2 a b)
: Tot a
= Mkdtuple2?._1 t | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 19,
"end_line": 736,
"start_col": 0,
"start_line": 734
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *)
unfold
let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x)
(** Sequential composition for [ALL_h] is like [EXN]: case analysis of
the exceptional result before "running" the continuation *)
unfold
let all_bind_wp
(heap: Type)
(a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0
(** Case analysis in [ALL_h] *)
unfold
let all_if_then_else
(heap a p: Type)
(wp_then wp_else: all_wp_h heap a)
(post: all_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** Naming postcondition for better sharing in [ALL_h] *)
unfold
let all_ite_wp (heap a: Type) (wp: all_wp_h heap a) (post: all_post_h heap a) (h0: heap) =
forall (k: all_post_h heap a).
(forall (x: result a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption in [ALL_h] *)
unfold
let all_stronger (heap a: Type) (wp1 wp2: all_wp_h heap a) =
(forall (p: all_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing a binder in the scope of an [ALL_h] wp *)
unfold
let all_close_wp
(heap a b: Type)
(wp: (b -> GTot (all_wp_h heap a)))
(p: all_post_h heap a)
(h: heap)
= (forall (b: b). wp b p h)
(** Applying an [ALL_h] wp to a trivial postcondition *)
unfold
let all_trivial (heap a: Type) (wp: all_wp_h heap a) = (forall (h0: heap). wp (fun r h1 -> True) h0)
(** Introducing the [ALL_h] effect template *)
new_effect {
ALL_h (heap: Type) : a: Type -> wp: all_wp_h heap a -> Effect
with
return_wp = all_return heap
; bind_wp = all_bind_wp heap
; if_then_else = all_if_then_else heap
; ite_wp = all_ite_wp heap
; stronger = all_stronger heap
; close_wp = all_close_wp heap
; trivial = all_trivial heap
}
(**
Controlling inversions of inductive type
Given a value of an inductive type [v:t], where [t = A | B], the SMT
solver can only prove that [v=A \/ v=B] by _inverting_ [t]. This
inversion is controlled by the [ifuel] setting, which usually limits
the recursion depth of the number of such inversions that the solver
can perform.
The [inversion] predicate below is a way to circumvent the
[ifuel]-based restrictions on inversion depth. In particular, if the
[inversion t] is available in the SMT solver's context, it is free to
invert [t] infinitely, regardless of the [ifuel] setting.
Be careful using this, since it explicitly subverts the [ifuel]
setting. If used unwisely, this can lead to very poor SMT solver
performance. *)
[@@ remove_unused_type_parameters [0]]
val inversion (a: Type) : Type0
(** To introduce [inversion t] in the SMT solver's context, call
[allow_inversion t]. *)
val allow_inversion (a: Type) : Pure unit (requires True) (ensures (fun x -> inversion a))
(** Since the [option] type is so common, we always allow inverting
options, regardless of [ifuel] *)
val invertOption (a: Type)
: Lemma (requires True) (ensures (forall (x: option a). None? x \/ Some? x)) [SMTPat (option a)]
(** Values of type [a] or type [b] *)
type either a b =
| Inl : v: a -> either a b
| Inr : v: b -> either a b | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: Prims.dtuple2 a b -> a | Prims.Tot | [
"total"
] | [] | [
"Prims.dtuple2",
"Prims.__proj__Mkdtuple2__item___1"
] | [] | false | false | false | false | false | let dfst (#a: Type) (#b: (a -> GTot Type)) (t: dtuple2 a b) : Tot a =
| Mkdtuple2?._1 t | false |
FStar.Pervasives.fsti | FStar.Pervasives.all_trivial | val all_trivial : heap: Type -> a: Type -> wp: FStar.Pervasives.all_wp_h heap a -> Prims.logical | let all_trivial (heap a: Type) (wp: all_wp_h heap a) = (forall (h0: heap). wp (fun r h1 -> True) h0) | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 100,
"end_line": 684,
"start_col": 0,
"start_line": 684
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *)
unfold
let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x)
(** Sequential composition for [ALL_h] is like [EXN]: case analysis of
the exceptional result before "running" the continuation *)
unfold
let all_bind_wp
(heap: Type)
(a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0
(** Case analysis in [ALL_h] *)
unfold
let all_if_then_else
(heap a p: Type)
(wp_then wp_else: all_wp_h heap a)
(post: all_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** Naming postcondition for better sharing in [ALL_h] *)
unfold
let all_ite_wp (heap a: Type) (wp: all_wp_h heap a) (post: all_post_h heap a) (h0: heap) =
forall (k: all_post_h heap a).
(forall (x: result a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption in [ALL_h] *)
unfold
let all_stronger (heap a: Type) (wp1 wp2: all_wp_h heap a) =
(forall (p: all_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing a binder in the scope of an [ALL_h] wp *)
unfold
let all_close_wp
(heap a b: Type)
(wp: (b -> GTot (all_wp_h heap a)))
(p: all_post_h heap a)
(h: heap)
= (forall (b: b). wp b p h)
(** Applying an [ALL_h] wp to a trivial postcondition *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | heap: Type -> a: Type -> wp: FStar.Pervasives.all_wp_h heap a -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.all_wp_h",
"Prims.l_Forall",
"FStar.Pervasives.result",
"Prims.l_True",
"Prims.logical"
] | [] | false | false | false | true | true | let all_trivial (heap a: Type) (wp: all_wp_h heap a) =
| (forall (h0: heap). wp (fun r h1 -> True) h0) | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.dsnd | val dsnd (#a: Type) (#b: (a -> GTot Type)) (t: dtuple2 a b) : Tot (b (Mkdtuple2?._1 t)) | val dsnd (#a: Type) (#b: (a -> GTot Type)) (t: dtuple2 a b) : Tot (b (Mkdtuple2?._1 t)) | let dsnd (#a: Type) (#b: a -> GTot Type) (t: dtuple2 a b)
: Tot (b (Mkdtuple2?._1 t))
= Mkdtuple2?._2 t | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 19,
"end_line": 740,
"start_col": 0,
"start_line": 738
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *)
unfold
let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x)
(** Sequential composition for [ALL_h] is like [EXN]: case analysis of
the exceptional result before "running" the continuation *)
unfold
let all_bind_wp
(heap: Type)
(a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0
(** Case analysis in [ALL_h] *)
unfold
let all_if_then_else
(heap a p: Type)
(wp_then wp_else: all_wp_h heap a)
(post: all_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** Naming postcondition for better sharing in [ALL_h] *)
unfold
let all_ite_wp (heap a: Type) (wp: all_wp_h heap a) (post: all_post_h heap a) (h0: heap) =
forall (k: all_post_h heap a).
(forall (x: result a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption in [ALL_h] *)
unfold
let all_stronger (heap a: Type) (wp1 wp2: all_wp_h heap a) =
(forall (p: all_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing a binder in the scope of an [ALL_h] wp *)
unfold
let all_close_wp
(heap a b: Type)
(wp: (b -> GTot (all_wp_h heap a)))
(p: all_post_h heap a)
(h: heap)
= (forall (b: b). wp b p h)
(** Applying an [ALL_h] wp to a trivial postcondition *)
unfold
let all_trivial (heap a: Type) (wp: all_wp_h heap a) = (forall (h0: heap). wp (fun r h1 -> True) h0)
(** Introducing the [ALL_h] effect template *)
new_effect {
ALL_h (heap: Type) : a: Type -> wp: all_wp_h heap a -> Effect
with
return_wp = all_return heap
; bind_wp = all_bind_wp heap
; if_then_else = all_if_then_else heap
; ite_wp = all_ite_wp heap
; stronger = all_stronger heap
; close_wp = all_close_wp heap
; trivial = all_trivial heap
}
(**
Controlling inversions of inductive type
Given a value of an inductive type [v:t], where [t = A | B], the SMT
solver can only prove that [v=A \/ v=B] by _inverting_ [t]. This
inversion is controlled by the [ifuel] setting, which usually limits
the recursion depth of the number of such inversions that the solver
can perform.
The [inversion] predicate below is a way to circumvent the
[ifuel]-based restrictions on inversion depth. In particular, if the
[inversion t] is available in the SMT solver's context, it is free to
invert [t] infinitely, regardless of the [ifuel] setting.
Be careful using this, since it explicitly subverts the [ifuel]
setting. If used unwisely, this can lead to very poor SMT solver
performance. *)
[@@ remove_unused_type_parameters [0]]
val inversion (a: Type) : Type0
(** To introduce [inversion t] in the SMT solver's context, call
[allow_inversion t]. *)
val allow_inversion (a: Type) : Pure unit (requires True) (ensures (fun x -> inversion a))
(** Since the [option] type is so common, we always allow inverting
options, regardless of [ifuel] *)
val invertOption (a: Type)
: Lemma (requires True) (ensures (forall (x: option a). None? x \/ Some? x)) [SMTPat (option a)]
(** Values of type [a] or type [b] *)
type either a b =
| Inl : v: a -> either a b
| Inr : v: b -> either a b
(** Projections for the components of a dependent pair *)
let dfst (#a: Type) (#b: a -> GTot Type) (t: dtuple2 a b)
: Tot a
= Mkdtuple2?._1 t | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: Prims.dtuple2 a b -> b (Mkdtuple2?._1 t) | Prims.Tot | [
"total"
] | [] | [
"Prims.dtuple2",
"Prims.__proj__Mkdtuple2__item___2",
"Prims.__proj__Mkdtuple2__item___1"
] | [] | false | false | false | false | false | let dsnd (#a: Type) (#b: (a -> GTot Type)) (t: dtuple2 a b) : Tot (b (Mkdtuple2?._1 t)) =
| Mkdtuple2?._2 t | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Comment | val va_quick_Comment (c: string) : (va_quickCode unit (va_code_Comment c)) | val va_quick_Comment (c: string) : (va_quickCode unit (va_code_Comment c)) | let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c)) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 78,
"end_line": 1221,
"start_col": 0,
"start_line": 1220
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Prims.string -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Comment c) | Prims.Tot | [
"total"
] | [] | [
"Prims.string",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.X64.InsBasic.va_code_Comment",
"Prims.Nil",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.InsBasic.va_wp_Comment",
"Vale.X64.InsBasic.va_wpProof_Comment",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Comment (c: string) : (va_quickCode unit (va_code_Comment c)) =
| (va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c)) | false |
Hacl.Spec.Curve25519.Field64.Lemmas.fst | Hacl.Spec.Curve25519.Field64.Lemmas.lemma_fsub4 | val lemma_fsub4: fn1:nat -> fn2:nat -> c0:nat -> c1:nat ->
Lemma ((fn1 - fn2 + c0 * pow2 256 - c0 * 38 + c1 * pow2 256 - c1 * 38) % prime ==
(fn1 % prime - fn2 % prime) % prime) | val lemma_fsub4: fn1:nat -> fn2:nat -> c0:nat -> c1:nat ->
Lemma ((fn1 - fn2 + c0 * pow2 256 - c0 * 38 + c1 * pow2 256 - c1 * 38) % prime ==
(fn1 % prime - fn2 % prime) % prime) | let lemma_fsub4 fn1 fn2 c0 c1 =
calc (==) {
(fn1 - fn2 + c0 * pow2 256 - c0 * 38 + c1 * pow2 256 - c1 * 38) % prime;
(==) { lemma_mul_pow256_add (fn1 - fn2 + c0 * pow2 256 - c0 * 38 + c1 * pow2 256) (- c1) }
(fn1 - fn2 + c0 * pow2 256 - c0 * 38 + c1 * pow2 256 - c1 * pow2 256) % prime;
(==) { }
(fn1 - fn2 + c0 * pow2 256 - c0 * 38) % prime;
(==) { lemma_mul_pow256_add (fn1 - fn2 + c0 * pow2 256) (- c0) }
(fn1 - fn2 + c0 * pow2 256 - c0 * pow2 256) % prime;
(==) { }
(fn1 - fn2) % prime;
(==) { Math.Lemmas.lemma_mod_plus_distr_l fn1 (- fn2) prime }
(fn1 % prime - fn2) % prime;
(==) { Math.Lemmas.lemma_mod_sub_distr (fn1 % prime) fn2 prime }
(fn1 % prime - fn2 % prime) % prime;
} | {
"file_name": "code/curve25519/Hacl.Spec.Curve25519.Field64.Lemmas.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 5,
"end_line": 90,
"start_col": 0,
"start_line": 75
} | module Hacl.Spec.Curve25519.Field64.Lemmas
open FStar.Mul
open Lib.Sequence
open Lib.IntTypes
open Spec.Curve25519
open Hacl.Spec.Curve25519.Field64.Definition
module BSeq = Lib.ByteSequence
module SD = Hacl.Spec.Bignum.Definitions
module SL = Hacl.Spec.Bignum.Lib
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
val lemma_prime: unit -> Lemma (pow2 256 % prime == 38)
let lemma_prime () =
calc (==) {
pow2 256 % prime;
(==) { Math.Lemmas.pow2_plus 255 1 }
2 * pow2 255 % prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_r 2 (pow2 255) prime }
2 * (pow2 255 % prime) % prime;
(==) { Math.Lemmas.sub_div_mod_1 (pow2 255) prime }
2 * (19 % prime) % prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_r 2 19 prime }
38 % prime;
(==) { Math.Lemmas.small_mod 38 prime }
38;
}
val lemma_prime19: unit -> Lemma (pow2 255 % prime == 19)
let lemma_prime19 () =
assert_norm (pow2 255 % prime = 19 % prime);
FStar.Math.Lemmas.small_mod 19 prime
val lemma_mul_pow256_add: fn:int -> c:int ->
Lemma ((fn + c * pow2 256) % prime == (fn + c * 38) % prime)
let lemma_mul_pow256_add fn c =
calc (==) {
(fn + c * pow2 256) % prime;
(==) { Math.Lemmas.lemma_mod_plus_distr_r fn (c * pow2 256) prime }
(fn + c * pow2 256 % prime) % prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_r c (pow2 256) prime }
(fn + c * (pow2 256 % prime) % prime) % prime;
(==) { lemma_prime () }
(fn + c * 38 % prime) % prime;
(==) { Math.Lemmas.lemma_mod_plus_distr_r fn (c * 38) prime }
(fn + c * 38) % prime;
}
val lemma_mul_pow255_add: fn:int -> c:int ->
Lemma ((fn + c * pow2 255) % prime == (fn + c * 19) % prime)
let lemma_mul_pow255_add fn c =
calc (==) {
(fn + c * pow2 255) % prime;
(==) { Math.Lemmas.lemma_mod_plus_distr_r fn (c * pow2 255) prime }
(fn + c * pow2 255 % prime) % prime;
(==) { Math.Lemmas.lemma_mod_mul_distr_r c (pow2 255) prime }
(fn + c * (pow2 255 % prime) % prime) % prime;
(==) { lemma_prime19 () }
(fn + c * 19 % prime) % prime;
(==) { Math.Lemmas.lemma_mod_plus_distr_r fn (c * 19) prime }
(fn + c * 19) % prime;
}
val lemma_fsub4: fn1:nat -> fn2:nat -> c0:nat -> c1:nat ->
Lemma ((fn1 - fn2 + c0 * pow2 256 - c0 * 38 + c1 * pow2 256 - c1 * 38) % prime == | {
"checked_file": "/",
"dependencies": [
"Spec.Curve25519.fst.checked",
"prims.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Hacl.Spec.Curve25519.Field64.Definition.fst.checked",
"Hacl.Spec.Bignum.Lib.fst.checked",
"Hacl.Spec.Bignum.Definitions.fst.checked",
"Hacl.Spec.Bignum.Convert.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Spec.Curve25519.Field64.Lemmas.fst"
} | [
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Lib",
"short_module": "SL"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Bignum.Definitions",
"short_module": "SD"
},
{
"abbrev": true,
"full_module": "Lib.ByteSequence",
"short_module": "BSeq"
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field64.Definition",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Curve25519",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Sequence",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Spec.Curve25519.Field64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | fn1: Prims.nat -> fn2: Prims.nat -> c0: Prims.nat -> c1: Prims.nat
-> FStar.Pervasives.Lemma
(ensures
(fn1 - fn2 + c0 * Prims.pow2 256 - c0 * 38 + c1 * Prims.pow2 256 - c1 * 38) %
Spec.Curve25519.prime ==
(fn1 % Spec.Curve25519.prime - fn2 % Spec.Curve25519.prime) % Spec.Curve25519.prime) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.nat",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"Prims.op_Modulus",
"Prims.op_Subtraction",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.pow2",
"Spec.Curve25519.prime",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"Prims.unit",
"FStar.Calc.calc_step",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Hacl.Spec.Curve25519.Field64.Lemmas.lemma_mul_pow256_add",
"Prims.op_Minus",
"Prims.squash",
"FStar.Math.Lemmas.lemma_mod_plus_distr_l",
"FStar.Math.Lemmas.lemma_mod_sub_distr"
] | [] | false | false | true | false | false | let lemma_fsub4 fn1 fn2 c0 c1 =
| calc ( == ) {
(fn1 - fn2 + c0 * pow2 256 - c0 * 38 + c1 * pow2 256 - c1 * 38) % prime;
( == ) { lemma_mul_pow256_add (fn1 - fn2 + c0 * pow2 256 - c0 * 38 + c1 * pow2 256) (- c1) }
(fn1 - fn2 + c0 * pow2 256 - c0 * 38 + c1 * pow2 256 - c1 * pow2 256) % prime;
( == ) { () }
(fn1 - fn2 + c0 * pow2 256 - c0 * 38) % prime;
( == ) { lemma_mul_pow256_add (fn1 - fn2 + c0 * pow2 256) (- c0) }
(fn1 - fn2 + c0 * pow2 256 - c0 * pow2 256) % prime;
( == ) { () }
(fn1 - fn2) % prime;
( == ) { Math.Lemmas.lemma_mod_plus_distr_l fn1 (- fn2) prime }
(fn1 % prime - fn2) % prime;
( == ) { Math.Lemmas.lemma_mod_sub_distr (fn1 % prime) fn2 prime }
(fn1 % prime - fn2 % prime) % prime;
} | false |
FStar.Pervasives.fsti | FStar.Pervasives.all_bind_wp | val all_bind_wp
(heap a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 | val all_bind_wp
(heap a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 | let all_bind_wp
(heap: Type)
(a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0 | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 6,
"end_line": 651,
"start_col": 0,
"start_line": 638
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *)
unfold
let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x)
(** Sequential composition for [ALL_h] is like [EXN]: case analysis of
the exceptional result before "running" the continuation *) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
heap: Type ->
a: Type ->
b: Type ->
wp1: FStar.Pervasives.all_wp_h heap a ->
wp2: (_: a -> Prims.GTot (FStar.Pervasives.all_wp_h heap b)) ->
p: FStar.Pervasives.all_post_h heap b ->
h0: heap
-> Prims.GTot Type0 | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Pervasives.all_wp_h",
"FStar.Pervasives.all_post_h",
"FStar.Pervasives.result",
"Prims.l_True",
"Prims.exn",
"FStar.Pervasives.E",
"Prims.string",
"FStar.Pervasives.Err"
] | [] | false | false | false | false | true | let all_bind_wp
(heap a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
| wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0 | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Space | val va_quick_Space (n: nat) : (va_quickCode unit (va_code_Space n)) | val va_quick_Space (n: nat) : (va_quickCode unit (va_code_Space n)) | let va_quick_Space (n:nat) : (va_quickCode unit (va_code_Space n)) =
(va_QProc (va_code_Space n) ([]) (va_wp_Space n) (va_wpProof_Space n)) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 72,
"end_line": 1317,
"start_col": 0,
"start_line": 1316
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_LargeComment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_LargeComment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LargeComment c) ([]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_LargeComment (c:string) : (va_quickCode unit (va_code_LargeComment c)) =
(va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c))
//--
//-- NoNewline
val va_code_NoNewline : va_dummy:unit -> Tot va_code
val va_codegen_success_NoNewline : va_dummy:unit -> Tot va_pbool
val va_lemma_NoNewline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_NoNewline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_NoNewline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_NoNewline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_NoNewline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_NoNewline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_NoNewline () : (va_quickCode unit (va_code_NoNewline ())) =
(va_QProc (va_code_NoNewline ()) ([]) va_wp_NoNewline va_wpProof_NoNewline)
//--
//-- Newline
val va_code_Newline : va_dummy:unit -> Tot va_code
val va_codegen_success_Newline : va_dummy:unit -> Tot va_pbool
val va_lemma_Newline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Newline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Newline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Newline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Newline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Newline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Newline () : (va_quickCode unit (va_code_Newline ())) =
(va_QProc (va_code_Newline ()) ([]) va_wp_Newline va_wpProof_Newline)
//--
//-- Space
val va_code_Space : n:nat -> Tot va_code
val va_codegen_success_Space : n:nat -> Tot va_pbool
val va_lemma_Space : va_b0:va_code -> va_s0:va_state -> n:nat
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Space n) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Space (n:nat) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Space : n:nat -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Space n va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Space n) ([]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | n: Prims.nat -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Space n) | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.X64.InsBasic.va_code_Space",
"Prims.Nil",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.InsBasic.va_wp_Space",
"Vale.X64.InsBasic.va_wpProof_Space",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Space (n: nat) : (va_quickCode unit (va_code_Space n)) =
| (va_QProc (va_code_Space n) ([]) (va_wp_Space n) (va_wpProof_Space n)) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_LargeComment | val va_quick_LargeComment (c: string) : (va_quickCode unit (va_code_LargeComment c)) | val va_quick_LargeComment (c: string) : (va_quickCode unit (va_code_LargeComment c)) | let va_quick_LargeComment (c:string) : (va_quickCode unit (va_code_LargeComment c)) =
(va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c)) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 93,
"end_line": 1245,
"start_col": 0,
"start_line": 1244
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_LargeComment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_LargeComment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LargeComment c) ([]) va_s0 va_k
((va_sM, va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Prims.string
-> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_LargeComment c) | Prims.Tot | [
"total"
] | [] | [
"Prims.string",
"Vale.X64.QuickCode.va_QProc",
"Prims.unit",
"Vale.X64.InsBasic.va_code_LargeComment",
"Prims.Nil",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.InsBasic.va_wp_LargeComment",
"Vale.X64.InsBasic.va_wpProof_LargeComment",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_LargeComment (c: string) : (va_quickCode unit (va_code_LargeComment c)) =
| (va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c)) | false |
Vale.X64.InsBasic.fsti | Vale.X64.InsBasic.va_quick_Newline | val va_quick_Newline: Prims.unit -> (va_quickCode unit (va_code_Newline ())) | val va_quick_Newline: Prims.unit -> (va_quickCode unit (va_code_Newline ())) | let va_quick_Newline () : (va_quickCode unit (va_code_Newline ())) =
(va_QProc (va_code_Newline ()) ([]) va_wp_Newline va_wpProof_Newline) | {
"file_name": "obj/Vale.X64.InsBasic.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 71,
"end_line": 1293,
"start_col": 0,
"start_line": 1292
} | module Vale.X64.InsBasic
open FStar.Mul
open Vale.Def.Types_s
open Vale.Arch.HeapImpl
open Vale.Arch.Types
open Vale.X64.Machine_s
open Vale.X64.State
open Vale.X64.Decls
open Vale.X64.QuickCode
unfold let vale_heap = Vale.X64.Memory.vale_heap
unfold let vale_stack = Vale.X64.Stack_i.vale_stack
open Vale.X64.CPU_Features_s
//-- Mov64
val va_code_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\ va_state_eq va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) . let va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in
va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mov64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mov64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Mov64 dst src)) =
(va_QProc (va_code_Mov64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Mov64 dst src)
(va_wpProof_Mov64 dst src))
//--
//-- Cmovc64
val va_code_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0
src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) . let
va_sM = va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_if
(Vale.X64.Decls.cf (va_get_flags va_sM)) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_opr64
va_s0 src) (fun _ -> va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst) ==> va_k va_sM
(())))
val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cmovc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64
dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cmovc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Cmovc64 dst src)) =
(va_QProc (va_code_Cmovc64 dst src) ([va_mod_dst_opr64 dst]) (va_wp_Cmovc64 dst src)
(va_wpProof_Cmovc64 dst src))
//--
//-- Add64
val va_code_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst + va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64 dst src)) =
(va_QProc (va_code_Add64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64 dst src)
(va_wpProof_Add64 dst src))
//--
//-- Add64Wrap
val va_code_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Add64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Add64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src >= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src >= pow2_64) ==> va_k va_sM (())))
val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Add64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Add64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Add64Wrap dst src)) =
(va_QProc (va_code_Add64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Add64Wrap dst
src) (va_wpProof_Add64Wrap dst src))
//--
//-- AddLea64
val va_code_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 -> src2:va_operand_opr64
-> Tot va_code
val va_codegen_success_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> Tot va_pbool
val va_lemma_AddLea64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src1:va_operand_opr64 -> src2:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_AddLea64 dst src1 src2) va_s0 /\ va_is_dst_dst_opr64
dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 <
pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 /\
va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))
[@ va_qattr]
let va_wp_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src1 va_s0 /\ va_is_src_opr64 src2 va_s0 /\
va_get_ok va_s0 /\ Vale.X64.Decls.max_one_mem src1 src2 /\ va_eval_opr64 va_s0 src1 +
va_eval_opr64 va_s0 src2 < pow2_64 /\ (forall (va_x_dst:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst va_x_dst va_s0 in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_eval_opr64 va_s0 src1 + va_eval_opr64 va_s0 src2 ==> va_k va_sM (())))
val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->
src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)
([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_AddLea64 (dst:va_operand_dst_opr64) (src1:va_operand_opr64) (src2:va_operand_opr64) :
(va_quickCode unit (va_code_AddLea64 dst src1 src2)) =
(va_QProc (va_code_AddLea64 dst src1 src2) ([va_mod_dst_opr64 dst]) (va_wp_AddLea64 dst src1
src2) (va_wpProof_AddLea64 dst src1 src2))
//--
//-- Adc64
val va_code_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64 va_s0 src + va_eval_dst_opr64
va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if
Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ va_state_eq va_sM
(va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_eval_opr64
va_s0 src + va_eval_dst_opr64 va_s0 dst + 1 < pow2_64 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0) /\ (forall (va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM =
va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) /\ Vale.X64.Decls.updated_cf
(va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >= pow2_64) ==> va_k va_sM
(())))
val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64 dst src)) =
(va_QProc (va_code_Adc64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64 dst src)
(va_wpProof_Adc64 dst src))
//--
//-- Adc64Wrap
val va_code_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adc64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adc64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) ==> va_k va_sM (())))
val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adc64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adc64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adc64Wrap dst src)) =
(va_QProc (va_code_Adc64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adc64Wrap dst
src) (va_wpProof_Adc64Wrap dst src))
//--
//-- Adcx64Wrap
val va_code_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adcx64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adcx64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_cf
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else 0)
>= pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_of (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adcx64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adcx64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adcx64Wrap dst src)) =
(va_QProc (va_code_Adcx64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adcx64Wrap
dst src) (va_wpProof_Adcx64Wrap dst src))
//--
//-- Adox64Wrap
val va_code_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Adox64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Adox64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\ Vale.X64.Decls.valid_of
(va_get_flags va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64 (Vale.Arch.Types.add_wrap64
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) /\ Vale.X64.Decls.updated_of (va_get_flags va_sM)
(va_eval_dst_opr64 va_s0 dst + va_eval_opr64 va_s0 src + (if Vale.X64.Decls.overflow
(va_get_flags va_s0) then 1 else 0) >= pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags
va_sM) (va_get_flags va_s0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ adx_enabled /\
Vale.X64.Decls.valid_of (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.add_wrap64
(Vale.Arch.Types.add_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src)) (va_if
(Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) /\
Vale.X64.Decls.updated_of (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst + va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.overflow (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0) >=
pow2_64) /\ Vale.X64.Decls.maintained_cf (va_get_flags va_sM) (va_get_flags va_s0) ==> va_k
va_sM (())))
val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Adox64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Adox64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Adox64Wrap dst src)) =
(va_QProc (va_code_Adox64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Adox64Wrap
dst src) (va_wpProof_Adox64Wrap dst src))
//--
//-- Sub64
val va_code_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <= va_eval_dst_opr64 va_s0 dst -
va_eval_opr64 va_s0 src))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\
va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst
va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ 0 <=
va_eval_dst_opr64 va_s0 dst - va_eval_opr64 va_s0 src /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == va_eval_dst_opr64 va_s0
dst - va_eval_opr64 va_s0 src ==> va_k va_sM (())))
val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64 dst src)) =
(va_QProc (va_code_Sub64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64 dst src)
(va_wpProof_Sub64 dst src))
//--
//-- Sub64Wrap
val va_code_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sub64Wrap : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sub64Wrap dst src) va_s0 /\ va_is_dst_dst_opr64 dst
va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - va_eval_opr64 va_s0 src < 0) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - va_eval_opr64
va_s0 src < 0) ==> va_k va_sM (())))
val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sub64Wrap dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sub64Wrap (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sub64Wrap dst src)) =
(va_QProc (va_code_Sub64Wrap dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sub64Wrap dst
src) (va_wpProof_Sub64Wrap dst src))
//--
//-- Sbb64
val va_code_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Sbb64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Sbb64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ Vale.X64.Decls.valid_cf (va_get_flags
va_s0)))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64 (va_eval_dst_opr64 va_s0 dst)
(Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (if Vale.X64.Decls.cf (va_get_flags
va_s0) then 1 else 0)) /\ Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64
va_s0 dst - (va_eval_opr64 va_s0 src + (if Vale.X64.Decls.cf (va_get_flags va_s0) then 1 else
0)) < 0) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\
Vale.X64.Decls.valid_cf (va_get_flags va_s0) /\ (forall (va_x_dst:va_value_dst_opr64)
(va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_operand_dst_opr64 dst
va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.sub_wrap64
(va_eval_dst_opr64 va_s0 dst) (Vale.Arch.Types.add_wrap64 (va_eval_opr64 va_s0 src) (va_if
(Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0))) /\
Vale.X64.Decls.updated_cf (va_get_flags va_sM) (va_eval_dst_opr64 va_s0 dst - (va_eval_opr64
va_s0 src + va_if (Vale.X64.Decls.cf (va_get_flags va_s0)) (fun _ -> 1) (fun _ -> 0)) < 0) ==>
va_k va_sM (())))
val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Sbb64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Sbb64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Sbb64 dst src)) =
(va_QProc (va_code_Sbb64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Sbb64 dst src)
(va_wpProof_Sbb64 dst src))
//--
//-- Mul64Wrap
val va_code_Mul64Wrap : src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mul64Wrap : src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mul64Wrap : va_b0:va_code -> va_s0:va_state -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mul64Wrap src) va_s0 /\ va_is_src_opr64 src va_s0 /\
va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_get_reg64 rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat
(va_get_reg64 rRax va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_reg64 rRdx
va_sM (va_update_reg64 rRax va_sM (va_update_flags va_sM (va_update_ok va_sM va_s0))))))
[@ va_qattr]
let va_wp_Mul64Wrap (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) :
Type0 =
(va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall (va_x_efl:Vale.X64.Flags.t)
(va_x_rax:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax
va_x_rax (va_upd_flags va_x_efl va_s0)) in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_get_reg64
rRdx va_sM) + va_get_reg64 rRax va_sM == va_mul_nat (va_get_reg64 rRax va_s0) (va_eval_opr64
va_s0 src) ==> va_k va_sM (())))
val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->
Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mul64Wrap src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mul64Wrap (src:va_operand_opr64) : (va_quickCode unit (va_code_Mul64Wrap src)) =
(va_QProc (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags])
(va_wp_Mul64Wrap src) (va_wpProof_Mul64Wrap src))
//--
//-- Mulx64
val va_code_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Mulx64 : va_b0:va_code -> va_s0:va_state -> dst_hi:va_operand_dst_opr64 ->
dst_lo:va_operand_dst_opr64 -> src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Mulx64 dst_hi dst_lo src) va_s0 /\ va_is_dst_dst_opr64
dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok
va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64 va_sM dst_lo ==
va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) /\ va_state_eq va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM (va_update_operand_dst_opr64
dst_hi va_sM va_s0)))))
[@ va_qattr]
let va_wp_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64) (src:va_operand_opr64)
(va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst_hi va_s0 /\ va_is_dst_dst_opr64 dst_lo va_s0 /\ va_is_src_opr64 src
va_s0 /\ va_get_ok va_s0 /\ bmi2_enabled /\ dst_hi =!= dst_lo /\ (forall
(va_x_dst_hi:va_value_dst_opr64) (va_x_dst_lo:va_value_dst_opr64) . let va_sM =
va_upd_operand_dst_opr64 dst_lo va_x_dst_lo (va_upd_operand_dst_opr64 dst_hi va_x_dst_hi va_s0)
in va_get_ok va_sM /\ va_mul_nat pow2_64 (va_eval_dst_opr64 va_sM dst_hi) + va_eval_dst_opr64
va_sM dst_lo == va_mul_nat (va_get_reg64 rRdx va_s0) (va_eval_opr64 va_s0 src) ==> va_k va_sM
(())))
val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->
src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)
([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Mulx64 (dst_hi:va_operand_dst_opr64) (dst_lo:va_operand_dst_opr64)
(src:va_operand_opr64) : (va_quickCode unit (va_code_Mulx64 dst_hi dst_lo src)) =
(va_QProc (va_code_Mulx64 dst_hi dst_lo src) ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi])
(va_wp_Mulx64 dst_hi dst_lo src) (va_wpProof_Mulx64 dst_hi dst_lo src))
//--
//-- IMul64
val va_code_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_IMul64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_IMul64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) < pow2_64))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0
src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ va_mul_nat
(va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) < pow2_64 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== va_mul_nat (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k va_sM (())))
val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_IMul64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_IMul64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_IMul64 dst src)) =
(va_QProc (va_code_IMul64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_IMul64 dst src)
(va_wpProof_IMul64 dst src))
//--
//-- Xor64
val va_code_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_Xor64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xor64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ ~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\
~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\ Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\
Vale.X64.Decls.valid_of (va_get_flags va_sM) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ixor64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) /\
~(Vale.X64.Decls.overflow (va_get_flags va_sM)) /\ ~(Vale.X64.Decls.cf (va_get_flags va_sM)) /\
Vale.X64.Decls.valid_cf (va_get_flags va_sM) /\ Vale.X64.Decls.valid_of (va_get_flags va_sM)
==> va_k va_sM (())))
val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xor64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xor64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_Xor64 dst src)) =
(va_QProc (va_code_Xor64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Xor64 dst src)
(va_wpProof_Xor64 dst src))
//--
//-- And64
val va_code_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_code
val va_codegen_success_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> Tot va_pbool
val va_lemma_And64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
src:va_operand_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_And64 dst src) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_opr64 va_s0 src) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) (va_s0:va_state) (va_k:(va_state
-> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.iand64 (va_eval_dst_opr64 va_s0 dst) (va_eval_opr64 va_s0 src) ==> va_k
va_sM (())))
val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_And64 dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_And64 (dst:va_operand_dst_opr64) (src:va_operand_opr64) : (va_quickCode unit
(va_code_And64 dst src)) =
(va_QProc (va_code_And64 dst src) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_And64 dst src)
(va_wpProof_And64 dst src))
//--
//-- Shl64
val va_code_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shl64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shl64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishl64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shl64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shl64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shl64 dst amt)) =
(va_QProc (va_code_Shl64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shl64 dst amt)
(va_wpProof_Shl64 dst amt))
//--
//-- Shr64
val va_code_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot va_code
val va_codegen_success_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> Tot
va_pbool
val va_lemma_Shr64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->
amt:va_operand_shift_amt64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Shr64 dst amt) va_s0 /\ va_is_dst_dst_opr64 dst va_s0
/\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_eval_dst_opr64 va_sM dst == Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst)
(va_eval_shift_amt64 va_s0 amt) /\ va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM
(va_update_operand_dst_opr64 dst va_sM va_s0)))))
[@ va_qattr]
let va_wp_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_dst_opr64 dst va_s0 /\ va_is_src_shift_amt64 amt va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_dst_opr64) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl
(va_upd_operand_dst_opr64 dst va_x_dst va_s0) in va_get_ok va_sM /\ va_eval_dst_opr64 va_sM dst
== Vale.Arch.Types.ishr64 (va_eval_dst_opr64 va_s0 dst) (va_eval_shift_amt64 va_s0 amt) ==>
va_k va_sM (())))
val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->
va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Shr64 dst amt va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;
va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Shr64 (dst:va_operand_dst_opr64) (amt:va_operand_shift_amt64) : (va_quickCode unit
(va_code_Shr64 dst amt)) =
(va_QProc (va_code_Shr64 dst amt) ([va_Mod_flags; va_mod_dst_opr64 dst]) (va_wp_Shr64 dst amt)
(va_wpProof_Shr64 dst amt))
//--
//-- Cpuid_AES
val va_code_Cpuid_AES : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_AES : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_AES : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_AES ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_AES (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 33554432 > 0 == aesni_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 2 > 0 == pclmulqdq_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_AES : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_AES va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_AES () : (va_quickCode unit (va_code_Cpuid_AES ())) =
(va_QProc (va_code_Cpuid_AES ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_AES va_wpProof_Cpuid_AES)
//--
//-- Cpuid_Sha
val va_code_Cpuid_Sha : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sha : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sha : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sha ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 536870912 > 0 == sha_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sha (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM)
536870912 > 0 == sha_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sha : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sha va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sha () : (va_quickCode unit (va_code_Cpuid_Sha ())) =
(va_QProc (va_code_Cpuid_Sha ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sha va_wpProof_Cpuid_Sha)
//--
//-- Cpuid_Adx_Bmi2
val va_code_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Adx_Bmi2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Adx_Bmi2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Adx_Bmi2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 > 0 == bmi2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Adx_Bmi2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 256 >
0 == bmi2_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 524288 > 0 == adx_enabled
==> va_k va_sM (())))
val va_wpProof_Cpuid_Adx_Bmi2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Adx_Bmi2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64
rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0,
va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Adx_Bmi2 () : (va_quickCode unit (va_code_Cpuid_Adx_Bmi2 ())) =
(va_QProc (va_code_Cpuid_Adx_Bmi2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Adx_Bmi2 va_wpProof_Cpuid_Adx_Bmi2)
//--
//-- Cpuid_Avx
val va_code_Cpuid_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 268435456 > 0 == avx_cpuid_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx () : (va_quickCode unit (va_code_Cpuid_Avx ())) =
(va_QProc (va_code_Cpuid_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx va_wpProof_Cpuid_Avx)
//--
//-- Cpuid_Avx2
val va_code_Cpuid_Avx2 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx2 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx2 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx2 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0 == avx2_cpuid_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx2 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 32 > 0
== avx2_cpuid_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx2 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx2 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx2 () : (va_quickCode unit (va_code_Cpuid_Avx2 ())) =
(va_QProc (va_code_Cpuid_Avx2 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx2 va_wpProof_Cpuid_Avx2)
//--
//-- Cpuid_Sse
val va_code_Cpuid_Sse : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Sse : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Sse : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Sse ()) va_s0 /\ va_get_ok va_s0 /\ va_get_reg64
rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Sse (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRdx va_sM) 67108864 > 0 == sse2_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 524288 > 0 == sse4_1_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 512 > 0 == ssse3_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Sse : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Sse va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Sse () : (va_quickCode unit (va_code_Cpuid_Sse ())) =
(va_QProc (va_code_Cpuid_Sse ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Sse va_wpProof_Cpuid_Sse)
//--
//-- Cpuid_Movbe
val va_code_Cpuid_Movbe : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Movbe : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\ va_state_eq
va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM
(va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Movbe (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled ==> va_k va_sM
(())))
val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Movbe va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Movbe () : (va_quickCode unit (va_code_Cpuid_Movbe ())) =
(va_QProc (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Movbe va_wpProof_Cpuid_Movbe)
//--
//-- Cpuid_Rdrand
val va_code_Cpuid_Rdrand : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Rdrand : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Rdrand : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Rdrand ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Rdrand (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 1073741824 > 0 == rdrand_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Rdrand : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Rdrand va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Rdrand () : (va_quickCode unit (va_code_Cpuid_Rdrand ())) =
(va_QProc (va_code_Cpuid_Rdrand ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Rdrand va_wpProof_Cpuid_Rdrand)
//--
//-- Cpuid_Avx512
val va_code_Cpuid_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536 > 0 == avx512f_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 == avx512dq_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 == avx512bw_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 == avx512vl_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 7 /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall
(va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64
rRdx va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax
va_x_rax va_s0))) in va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 65536
> 0 == avx512f_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 131072 > 0 ==
avx512dq_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 1073741824 > 0 ==
avx512bw_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRbx va_sM) 2147483648 > 0 ==
avx512vl_enabled ==> va_k va_sM (())))
val va_wpProof_Cpuid_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Avx512 () : (va_quickCode unit (va_code_Cpuid_Avx512 ())) =
(va_QProc (va_code_Cpuid_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Avx512 va_wpProof_Cpuid_Avx512)
//--
//-- Cpuid_Osxsave
val va_code_Cpuid_Osxsave : va_dummy:unit -> Tot va_code
val va_codegen_success_Cpuid_Osxsave : va_dummy:unit -> Tot va_pbool
val va_lemma_Cpuid_Osxsave : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Cpuid_Osxsave ()) va_s0 /\ va_get_ok va_s0 /\
va_get_reg64 rRax va_s0 = 1))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx
va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))
[@ va_qattr]
let va_wp_Cpuid_Osxsave (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ va_get_reg64 rRax va_s0 = 1 /\ (forall (va_x_rax:nat64) (va_x_rbx:nat64)
(va_x_rcx:nat64) (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRcx
va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax va_s0))) in va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 134217728 > 0 == osxsave_enabled ==> va_k
va_sM (())))
val va_wpProof_Cpuid_Osxsave : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Cpuid_Osxsave va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Cpuid_Osxsave () : (va_quickCode unit (va_code_Cpuid_Osxsave ())) =
(va_QProc (va_code_Cpuid_Osxsave ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;
va_Mod_reg64 rRax]) va_wp_Cpuid_Osxsave va_wpProof_Cpuid_Osxsave)
//--
//-- Xgetbv_Avx
val va_code_Xgetbv_Avx : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\ va_state_eq va_sM
(va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled
/\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM
(())))
val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx () : (va_quickCode unit (va_code_Xgetbv_Avx ())) =
(va_QProc (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx
va_wpProof_Xgetbv_Avx)
//--
//-- Xgetbv_Avx512
val va_code_Xgetbv_Avx512 : va_dummy:unit -> Tot va_code
val va_codegen_success_Xgetbv_Avx512 : va_dummy:unit -> Tot va_pbool
val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\ va_get_ok va_s0 /\
osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\
Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\
va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM
va_s0)))))
[@ va_qattr]
let va_wp_Xgetbv_Avx512 (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ osxsave_enabled /\ va_get_reg64 rRcx va_s0 = 0 /\ (forall (va_x_rax:nat64)
(va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in
va_get_ok va_sM /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 ==
opmask_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 ==
zmm_hi256_xcr0_enabled /\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 ==
hi16_zmm_xcr0_enabled ==> va_k va_sM (())))
val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Xgetbv_Avx512 va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;
va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Xgetbv_Avx512 () : (va_quickCode unit (va_code_Xgetbv_Avx512 ())) =
(va_QProc (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_wp_Xgetbv_Avx512
va_wpProof_Xgetbv_Avx512)
//--
//-- Nat64Equal
val va_code_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot va_code
val va_codegen_success_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> Tot
va_pbool
val va_lemma_Nat64Equal : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr64 ->
src:va_operand_reg_opr64
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Nat64Equal dst src) va_s0 /\ va_is_dst_reg_opr64 dst
va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\ (if
(va_eval_reg_opr64 va_s0 src = 18446744073709551615) then (va_eval_reg_opr64 va_sM dst = 0)
else (va_eval_reg_opr64 va_sM dst = 1)) /\ va_state_eq va_sM (va_update_flags va_sM
(va_update_ok va_sM (va_update_operand_reg_opr64 src va_sM (va_update_operand_reg_opr64 dst
va_sM va_s0))))))
[@ va_qattr]
let va_wp_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) (va_s0:va_state)
(va_k:(va_state -> unit -> Type0)) : Type0 =
(va_is_dst_reg_opr64 dst va_s0 /\ va_is_dst_reg_opr64 src va_s0 /\ va_get_ok va_s0 /\ (forall
(va_x_dst:va_value_reg_opr64) (va_x_src:va_value_reg_opr64) (va_x_efl:Vale.X64.Flags.t) . let
va_sM = va_upd_flags va_x_efl (va_upd_operand_reg_opr64 src va_x_src (va_upd_operand_reg_opr64
dst va_x_dst va_s0)) in va_get_ok va_sM /\ va_if (va_eval_reg_opr64 va_s0 src =
18446744073709551615) (fun _ -> va_eval_reg_opr64 va_sM dst = 0) (fun _ -> va_eval_reg_opr64
va_sM dst = 1) ==> va_k va_sM (())))
val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state
-> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Nat64Equal dst src va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;
va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Nat64Equal (dst:va_operand_reg_opr64) (src:va_operand_reg_opr64) : (va_quickCode unit
(va_code_Nat64Equal dst src)) =
(va_QProc (va_code_Nat64Equal dst src) ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64
dst]) (va_wp_Nat64Equal dst src) (va_wpProof_Nat64Equal dst src))
//--
//-- Comment
val va_code_Comment : c:string -> Tot va_code
val va_codegen_success_Comment : c:string -> Tot va_pbool
val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Comment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Comment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Comment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Comment c) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_Comment (c:string) : (va_quickCode unit (va_code_Comment c)) =
(va_QProc (va_code_Comment c) ([]) (va_wp_Comment c) (va_wpProof_Comment c))
//--
//-- LargeComment
val va_code_LargeComment : c:string -> Tot va_code
val va_codegen_success_LargeComment : c:string -> Tot va_pbool
val va_lemma_LargeComment : va_b0:va_code -> va_s0:va_state -> c:string
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_LargeComment c) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_LargeComment (c:string) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_LargeComment : c:string -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_LargeComment c va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LargeComment c) ([]) va_s0 va_k
((va_sM, va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_LargeComment (c:string) : (va_quickCode unit (va_code_LargeComment c)) =
(va_QProc (va_code_LargeComment c) ([]) (va_wp_LargeComment c) (va_wpProof_LargeComment c))
//--
//-- NoNewline
val va_code_NoNewline : va_dummy:unit -> Tot va_code
val va_codegen_success_NoNewline : va_dummy:unit -> Tot va_pbool
val va_lemma_NoNewline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_NoNewline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_NoNewline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_NoNewline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_NoNewline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_NoNewline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g))))
[@ "opaque_to_smt" va_qattr]
let va_quick_NoNewline () : (va_quickCode unit (va_code_NoNewline ())) =
(va_QProc (va_code_NoNewline ()) ([]) va_wp_NoNewline va_wpProof_NoNewline)
//--
//-- Newline
val va_code_Newline : va_dummy:unit -> Tot va_code
val va_codegen_success_Newline : va_dummy:unit -> Tot va_pbool
val va_lemma_Newline : va_b0:va_code -> va_s0:va_state
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Newline ()) va_s0 /\ va_get_ok va_s0))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
va_state_eq va_sM (va_update_ok va_sM va_s0)))
[@ va_qattr]
let va_wp_Newline (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =
(va_get_ok va_s0 /\ (let va_sM = va_s0 in va_get_ok va_sM ==> va_k va_sM (())))
val va_wpProof_Newline : va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Newline va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Newline ()) ([]) va_s0 va_k ((va_sM,
va_f0, va_g)))) | {
"checked_file": "/",
"dependencies": [
"Vale.X64.State.fsti.checked",
"Vale.X64.Stack_i.fsti.checked",
"Vale.X64.QuickCode.fst.checked",
"Vale.X64.Memory.fsti.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.X64.Flags.fsti.checked",
"Vale.X64.Decls.fsti.checked",
"Vale.X64.CPU_Features_s.fst.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Vale.X64.InsBasic.fsti"
} | [
{
"abbrev": true,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "Vale.X64.Instructions_s",
"short_module": "I"
},
{
"abbrev": false,
"full_module": "Vale.X64.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Taint_Semantics",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.InsLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.StateLemmas",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.CPU_Features_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Vale.X64.QuickCode.va_quickCode Prims.unit (Vale.X64.InsBasic.va_code_Newline ()) | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.X64.QuickCode.va_QProc",
"Vale.X64.InsBasic.va_code_Newline",
"Prims.Nil",
"Vale.X64.QuickCode.mod_t",
"Vale.X64.InsBasic.va_wp_Newline",
"Vale.X64.InsBasic.va_wpProof_Newline",
"Vale.X64.QuickCode.va_quickCode"
] | [] | false | false | false | false | false | let va_quick_Newline () : (va_quickCode unit (va_code_Newline ())) =
| (va_QProc (va_code_Newline ()) ([]) va_wp_Newline va_wpProof_Newline) | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.map | val map : k: Prims.eqtype -> v: Type -> Type | let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
} | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 3,
"end_line": 35,
"start_col": 0,
"start_line": 32
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | k: Prims.eqtype -> v: Type -> Type | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.Map.t",
"FStar.Set.equal",
"FStar.Map.domain",
"FStar.Set.complement",
"FStar.Set.empty"
] | [] | false | false | false | true | true | let map (k: eqtype) (v: Type) =
| m: Map.t k v {(Map.domain m) `Set.equal` (Set.complement Set.empty)} | false |
|
FStar.Pervasives.fsti | FStar.Pervasives.coerce_eq | val coerce_eq: #a: Type -> #b: Type -> squash (a == b) -> x: a -> b | val coerce_eq: #a: Type -> #b: Type -> squash (a == b) -> x: a -> b | let coerce_eq (#a:Type) (#b:Type) (_:squash (a == b)) (x:a) : b = x | {
"file_name": "ulib/FStar.Pervasives.fsti",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 67,
"end_line": 1216,
"start_col": 0,
"start_line": 1216
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.Pervasives
(* This is a file from the core library, dependencies must be explicit *)
open Prims
include FStar.Pervasives.Native
/// This module is implicitly opened in the scope of all other
/// modules.
///
/// It provides several basic definitions in F* that are common to
/// most programs. Broadly, these include:
///
/// - Utility types and functions, like [id], [either], dependent
/// tuples, etc.
///
/// - Utility effect definitions, including [DIV] for divergence,
/// [EXN] of exceptions, [STATE_h] a template for state, and (the
/// poorly named) [ALL_h] which combines them all.
///
/// - Some utilities to control proofs, e.g., inversion of inductive
/// type definitions.
///
/// - Built-in attributes that can be used to decorate definitions and
/// trigger various kinds of special treatments for those
/// definitions.
(** [remove_unused_type_parameters]
This attribute is used to decorate signatures in interfaces for
type abbreviations, indicating that the 0-based positional
parameters are unused in the definition and should be eliminated
for extraction.
This is important particularly for use with F# extraction, since
F# does not accept type abbreviations with unused type parameters.
See tests/bug-reports/RemoveUnusedTyparsIFace.A.fsti
*)
val remove_unused_type_parameters : list int -> Tot unit
(** Values of type [pattern] are used to tag [Lemma]s with SMT
quantifier triggers *)
type pattern : Type0 = unit
(** The concrete syntax [SMTPat] desugars to [smt_pat] *)
val smt_pat (#a: Type) (x: a) : Tot pattern
(** The concrete syntax [SMTPatOr] desugars to [smt_pat_or]. This is
used to represent a disjunction of conjunctions of patterns.
Note, the typing discipline and syntax of patterns is laxer than
it should be. Patterns like [SMTPatOr [SMTPatOr [...]]] are
expressible, but unsupported by F*
TODO: We should tighten this up, perhaps just reusing the
attribute mechanism for patterns.
*)
val smt_pat_or (x: list (list pattern)) : Tot pattern
(** eqtype is defined in prims at universe 0
Although, usually, only universe 0 types have decidable equality,
sometimes it is possible to define a type in a higher univese also
with decidable equality (e.g., type t : Type u#1 = | Unit)
Further, sometimes, as in Lemma below, we need to use a
universe-polymorphic equality type (although it is only ever
instantiated with `unit`)
*)
type eqtype_u = a:Type{hasEq a}
(** [Lemma] is a very widely used effect abbreviation.
It stands for a unit-returning [Ghost] computation, whose main
value is its logical payload in proving an implication between its
pre- and postcondition.
[Lemma] is desugared specially. The valid forms are:
Lemma (ensures post)
Lemma post [SMTPat ...]
Lemma (ensures post) [SMTPat ...]
Lemma (ensures post) (decreases d)
Lemma (ensures post) (decreases d) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d)
Lemma (requires pre) (ensures post) [SMTPat ...]
Lemma (requires pre) (ensures post) (decreases d) [SMTPat ...]
and
Lemma post (== Lemma (ensures post))
the squash argument on the postcondition allows to assume the
precondition for the *well-formedness* of the postcondition.
*)
effect Lemma (a: eqtype_u) (pre: Type) (post: (squash pre -> Type)) (pats: list pattern) =
Pure a pre (fun r -> post ())
(** IN the default mode of operation, all proofs in a verification
condition are bundled into a single SMT query. Sub-terms marked
with the [spinoff] below are the exception: each of them is
spawned off into a separate SMT query *)
val spinoff (p: Type0) : Type0
val spinoff_eq (p:Type0) : Lemma (spinoff p == p)
val spinoff_equiv (p:Type0) : Lemma (p <==> spinoff p) [SMTPat (spinoff p)]
(** Logically equivalent to assert, but spins off separate query *)
val assert_spinoff (p: Type) : Pure unit (requires (spinoff (squash p))) (ensures (fun x -> p))
(** The polymorphic identity function *)
unfold
let id (#a: Type) (x: a) : a = x
(** Trivial postconditions for the [PURE] effect *)
unfold
let trivial_pure_post (a: Type) : pure_post a = fun _ -> True
(** Sometimes it is convenient to explicit introduce nullary symbols
into the ambient context, so that SMT can appeal to their definitions
even when they are no mentioned explicitly in the program, e.g., when
needed for triggers.
Use [intro_ambient t] for that.
See, e.g., LowStar.Monotonic.Buffer.fst and its usage there for loc_none *)
[@@ remove_unused_type_parameters [0; 1;]]
val ambient (#a: Type) (x: a) : Type0
(** cf. [ambient], above *)
val intro_ambient (#a: Type) (x: a) : Tot (squash (ambient x))
/// Controlling normalization
(** In any invocation of the F* normalizer, every occurrence of
[normalize_term e] is reduced to the full normal for of [e]. *)
val normalize_term (#a: Type) (x: a) : Tot a
(** In any invocation of the F* normalizer, every occurrence of
[normalize e] is reduced to the full normal for of [e]. *)
val normalize (a: Type0) : Type0
(** Value of [norm_step] are used to enable specific normalization
steps, controlling how the normalizer reduces terms. *)
val norm_step : Type0
(** Logical simplification, e.g., [P /\ True ~> P] *)
val simplify : norm_step
(** Weak reduction: Do not reduce under binders *)
val weak : norm_step
(** Head normal form *)
val hnf : norm_step
(** Reduce primitive operators, e.g., [1 + 1 ~> 2] *)
val primops : norm_step
(** Unfold all non-recursive definitions *)
val delta : norm_step
(** Turn on debugging for this specific call. *)
val norm_debug : norm_step
(** Unroll recursive calls
Note: Since F*'s termination check is semantic rather than
syntactically structural, recursive calls in inconsistent contexts,
or recursive evaluation of open terms can diverge.
When asking for the [zeta] step, F* implements a heuristic to
disable [zeta] when reducing terms beneath a blocked match. This
helps prevent some trivial looping behavior. However, it also
means that with [zeta] alone, your term may not reduce as much as
you might want. See [zeta_full] for that.
*)
val zeta : norm_step
(** Unroll recursive calls
Unlike [zeta], [zeta_full] has no looping prevention
heuristics. F* will try to unroll recursive functions as much as
it can, potentially looping. Use with care.
Note, [zeta_full] implies [zeta].
See [tests/micro-benchmarks/ReduceRecUnderMatch.fst] for an example.
*)
val zeta_full : norm_step
(** Reduce case analysis (i.e., match) *)
val iota : norm_step
(** Use normalization-by-evaluation, instead of interpretation (experimental) *)
val nbe : norm_step
(** Reify effectful definitions into their representations *)
val reify_ : norm_step
(** Unlike [delta], unfold definitions for only the names in the given
list. Each string is a fully qualified name like [A.M.f] *)
val delta_only (s: list string) : Tot norm_step
(** Unfold definitions for only the names in the given list, but
unfold each definition encountered after unfolding as well.
For example, given
{[
let f0 = 0
let f1 = f0 + 1
]}
[norm [delta_only [`%f1]] f1] will reduce to [f0 + 1].
[norm [delta_fully [`%f1]] f1] will reduce to [0 + 1].
Each string is a fully qualified name like [A.M.f], typically
constructed using a quotation, as in the example above. *)
val delta_fully (s: list string) : Tot norm_step
(** Rather than mention a symbol to unfold by name, it can be
convenient to tag a collection of related symbols with a common
attribute and then to ask the normalizer to reduce them all.
For example, given:
{[
irreducible let my_attr = ()
[@@my_attr]
let f0 = 0
[@@my_attr]
let f1 = f0 + 1
]}
{[norm [delta_attr [`%my_attr]] f1]}
will reduce to [0 + 1].
*)
val delta_attr (s: list string) : Tot norm_step
(**
For example, given:
{[
unfold
let f0 = 0
inline_for_extraction
let f1 = f0 + 1
]}
{[norm [delta_qualifier ["unfold"; "inline_for_extraction"]] f1]}
will reduce to [0 + 1].
*)
val delta_qualifier (s: list string) : Tot norm_step
val delta_namespace (s: list string) : Tot norm_step
(**
This step removes the some internal meta nodes during normalization
In most cases you shouldn't need to use this step explicitly
*)
val unmeta : norm_step
(**
This step removes ascriptions during normalization
An ascription is a type or computation type annotation on
an expression, written as (e <: t) or (e <: C)
normalize (e <: (t|C)) usually would normalize both the expression e
and the ascription
However, with unascribe step on, it will drop the ascription
and return the result of (normalize e),
Removing ascriptions may improve the performance,
as the normalization has less work to do
However, ascriptions help in re-typechecking of the terms,
and in some cases, are necessary for doing so
Use it with care
*)
val unascribe : norm_step
(** [norm s e] requests normalization of [e] with the reduction steps
[s]. *)
val norm (s: list norm_step) (#a: Type) (x: a) : Tot a
(** [assert_norm p] reduces [p] as much as possible and then asks the
SMT solver to prove the reduct, concluding [p] *)
val assert_norm (p: Type) : Pure unit (requires (normalize p)) (ensures (fun _ -> p))
(** Sometimes it is convenient to introduce an equation between a term
and its normal form in the context. *)
val normalize_term_spec (#a: Type) (x: a) : Lemma (normalize_term #a x == x)
(** Like [normalize_term_spec], but specialized to [Type0] *)
val normalize_spec (a: Type0) : Lemma (normalize a == a)
(** Like [normalize_term_spec], but with specific normalization steps *)
val norm_spec (s: list norm_step) (#a: Type) (x: a) : Lemma (norm s #a x == x)
(** Use the following to expose an ["opaque_to_smt"] definition to the
solver as: [reveal_opaque (`%defn) defn] *)
let reveal_opaque (s: string) = norm_spec [delta_only [s]]
(** Wrappers over pure wp combinators that return a pure_wp type
(with monotonicity refinement) *)
unfold
let pure_return (a:Type) (x:a) : pure_wp a =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_return0 a x
unfold
let pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_bind_wp0 a b wp1 wp2
unfold
let pure_if_then_else (a p:Type) (wp_then wp_else:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_if_then_else0 a p wp_then wp_else
unfold
let pure_ite_wp (a:Type) (wp:pure_wp a) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_ite_wp0 a wp
unfold
let pure_close_wp (a b:Type) (wp:b -> Tot (pure_wp a)) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_close_wp0 a b wp
unfold
let pure_null_wp (a:Type) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_null_wp0 a
[@@ "opaque_to_smt"]
unfold
let pure_assert_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assert_wp0 p
[@@ "opaque_to_smt"]
unfold
let pure_assume_wp (p:Type) : Tot (pure_wp unit) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
pure_assume_wp0 p
/// The [DIV] effect for divergent computations
///
/// The wp-calculus for [DIV] is same as that of [PURE]
(** The effect of divergence: from a specificational perspective it is
identical to PURE, however the specs are given a partial
correctness interpretation. Computations with the [DIV] effect may
not terminate. *)
new_effect {
DIV : a:Type -> wp:pure_wp a -> Effect
with
return_wp = pure_return
; bind_wp = pure_bind_wp
; if_then_else = pure_if_then_else
; ite_wp = pure_ite_wp
; stronger = pure_stronger
; close_wp = pure_close_wp
; trivial = pure_trivial
}
(** [PURE] computations can be silently promoted for use in a [DIV] context *)
sub_effect PURE ~> DIV { lift_wp = purewp_id }
(** [Div] is the Hoare-style counterpart of the wp-indexed [DIV] *)
unfold
let div_hoare_to_wp (#a:Type) (#pre:pure_pre) (post:pure_post' a pre) : Tot (pure_wp a) =
reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;
fun (p:pure_post a) -> pre /\ (forall a. post a ==> p a)
effect Div (a: Type) (pre: pure_pre) (post: pure_post' a pre) =
DIV a (div_hoare_to_wp post)
(** [Dv] is the instance of [DIV] with trivial pre- and postconditions *)
effect Dv (a: Type) = DIV a (pure_null_wp a)
(** We use the [EXT] effect to underspecify external system calls
as being impure but having no observable effect on the state *)
effect EXT (a: Type) = Dv a
/// The [STATE_h] effect template for stateful computations, generic
/// in the type of the state.
///
/// Note, [STATE_h] is itself not a computation type in F*, since it
/// is parameterized by the type of heap. However, instantiations of
/// [STATE_h] with specific types of the heap are computation
/// types. See, e.g., [FStar.ST] for such instantiations.
///
/// Weakest preconditions for stateful computations transform
/// [st_post_h] postconditions to [st_pre_h] preconditions. Both are
/// parametric in the type of the state, here denoted by the
/// [heap:Type] variable.
(** Preconditions are predicates on the [heap] *)
let st_pre_h (heap: Type) = heap -> GTot Type0
(** Postconditions relate [a]-typed results to the final [heap], here
refined by some pure proposition [pre], typically instantiated to
the precondition applied to the initial [heap] *)
let st_post_h' (heap a pre: Type) = a -> _: heap{pre} -> GTot Type0
(** Postconditions without refinements *)
let st_post_h (heap a: Type) = st_post_h' heap a True
(** The type of the main WP-transformer for stateful computations *)
let st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)
(** Returning a value does not transform the state *)
unfold
let st_return (heap a: Type) (x: a) (p: st_post_h heap a) = p x
(** Sequential composition of stateful WPs *)
unfold
let st_bind_wp
(heap: Type)
(a b: Type)
(wp1: st_wp_h heap a)
(wp2: (a -> GTot (st_wp_h heap b)))
(p: st_post_h heap b)
(h0: heap)
= wp1 (fun a h1 -> wp2 a p h1) h0
(** Branching for stateful WPs *)
unfold
let st_if_then_else
(heap a p: Type)
(wp_then wp_else: st_wp_h heap a)
(post: st_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** As with [PURE] the [wp] combinator names the postcondition as
[k] to avoid duplicating it. *)
unfold
let st_ite_wp (heap a: Type) (wp: st_wp_h heap a) (post: st_post_h heap a) (h0: heap) =
forall (k: st_post_h heap a).
(forall (x: a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption for stateful WPs *)
unfold
let st_stronger (heap a: Type) (wp1 wp2: st_wp_h heap a) =
(forall (p: st_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing the scope of a binder within a stateful WP *)
unfold
let st_close_wp (heap a b: Type) (wp: (b -> GTot (st_wp_h heap a))) (p: st_post_h heap a) (h: heap) =
(forall (b: b). wp b p h)
(** Applying a stateful WP to a trivial postcondition *)
unfold
let st_trivial (heap a: Type) (wp: st_wp_h heap a) = (forall h0. wp (fun r h1 -> True) h0)
(** Introducing a new effect template [STATE_h] *)
new_effect {
STATE_h (heap: Type) : result: Type -> wp: st_wp_h heap result -> Effect
with
return_wp = st_return heap
; bind_wp = st_bind_wp heap
; if_then_else = st_if_then_else heap
; ite_wp = st_ite_wp heap
; stronger = st_stronger heap
; close_wp = st_close_wp heap
; trivial = st_trivial heap
}
/// The [EXN] effect for computations that may raise exceptions or
/// fatal errors
///
/// Weakest preconditions for stateful computations transform
/// [ex_post] postconditions (predicates on [result]s) to [ex_pre]
/// precondition propositions.
(** Normal results are represented using [V x].
Handleable exceptions are represented [E e].
Fatal errors are [Err msg]. *)
noeq
type result (a: Type) =
| V : v: a -> result a
| E : e: exn -> result a
| Err : msg: string -> result a
(** Exceptional preconditions are just propositions *)
let ex_pre = Type0
(** Postconditions on results refined by a precondition *)
let ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0
(** Postconditions on results *)
let ex_post (a: Type) = ex_post' a True
(** Exceptions WP-predicate transformers *)
let ex_wp (a: Type) = ex_post a -> GTot ex_pre
(** Returning a value [x] normally promotes it to the [V x] result *)
unfold
let ex_return (a: Type) (x: a) (p: ex_post a) : GTot Type0 = p (V x)
(** Sequential composition of exception-raising code requires case analysing
the result of the first computation before "running" the second one *)
unfold
let ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)
: GTot Type0 =
forall (k: ex_post b).
(forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>
(wp1 (function
| V ra1 -> wp2 ra1 k
| E e -> k (E e)
| Err m -> k (Err m)))
(** As for other effects, branching in [ex_wp] appears in two forms.
First, a simple case analysis on [p] *)
unfold
let ex_if_then_else (a p: Type) (wp_then wp_else: ex_wp a) (post: ex_post a) =
wp_then post /\ (~p ==> wp_else post)
(** Naming continuations for use with branching *)
unfold
let ex_ite_wp (a: Type) (wp: ex_wp a) (post: ex_post a) =
forall (k: ex_post a).
(forall (rb: result a). {:pattern (guard_free (k rb))} post rb ==> k rb) ==> wp k
(** Subsumption for exceptional WPs *)
unfold
let ex_stronger (a: Type) (wp1 wp2: ex_wp a) = (forall (p: ex_post a). wp1 p ==> wp2 p)
(** Closing the scope of a binder for exceptional WPs *)
unfold
let ex_close_wp (a b: Type) (wp: (b -> GTot (ex_wp a))) (p: ex_post a) = (forall (b: b). wp b p)
(** Applying a computation with a trivial postcondition *)
unfold
let ex_trivial (a: Type) (wp: ex_wp a) = wp (fun r -> True)
(** Introduce a new effect for [EXN] *)
new_effect {
EXN : result: Type -> wp: ex_wp result -> Effect
with
return_wp = ex_return
; bind_wp = ex_bind_wp
; if_then_else = ex_if_then_else
; ite_wp = ex_ite_wp
; stronger = ex_stronger
; close_wp = ex_close_wp
; trivial = ex_trivial
}
(** A Hoare-style abbreviation for EXN *)
effect Exn (a: Type) (pre: ex_pre) (post: ex_post' a pre) =
EXN a (fun (p: ex_post a) -> pre /\ (forall (r: result a). post r ==> p r))
(** We include divergence in exceptions.
NOTE: BE WARNED, CODE IN THE [EXN] EFFECT IS ONLY CHECKED FOR
PARTIAL CORRECTNESS *)
unfold
let lift_div_exn (a: Type) (wp: pure_wp a) (p: ex_post a) = wp (fun a -> p (V a))
sub_effect DIV ~> EXN { lift_wp = lift_div_exn }
(** A variant of [Exn] with trivial pre- and postconditions *)
effect Ex (a: Type) = Exn a True (fun v -> True)
/// The [ALL_h] effect template for computations that may diverge,
/// raise exceptions or fatal errors, and uses a generic state.
///
/// Note, this effect is poorly named, particularly as F* has since
/// gained many more user-defined effect. We no longer have an effect
/// that includes all others.
///
/// We might rename this in the future to something like [StExnDiv_h].
///
/// We layer state on top of exceptions, meaning that raising an
/// exception does not discard the state.
///
/// As with [STATE_h], [ALL_h] is not a computation type, though its
/// instantiation with a specific type of [heap] (in FStar.All) is.
(** [all_pre_h] is a predicate on the initial state *)
let all_pre_h (h: Type) = h -> GTot Type0
(** Postconditions relate [result]s to final [heap]s refined by a precondition *)
let all_post_h' (h a pre: Type) = result a -> _: h{pre} -> GTot Type0
(** A variant of [all_post_h'] without the precondition refinement *)
let all_post_h (h a: Type) = all_post_h' h a True
(** WP predicate transformers for the [All_h] effect template *)
let all_wp_h (h a: Type) = all_post_h h a -> Tot (all_pre_h h)
(** Returning a value [x] normally promotes it to the [V x] result
without touching the [heap] *)
unfold
let all_return (heap a: Type) (x: a) (p: all_post_h heap a) = p (V x)
(** Sequential composition for [ALL_h] is like [EXN]: case analysis of
the exceptional result before "running" the continuation *)
unfold
let all_bind_wp
(heap: Type)
(a b: Type)
(wp1: all_wp_h heap a)
(wp2: (a -> GTot (all_wp_h heap b)))
(p: all_post_h heap b)
(h0: heap)
: GTot Type0 =
wp1 (fun ra h1 ->
(match ra with
| V v -> wp2 v p h1
| E e -> p (E e) h1
| Err msg -> p (Err msg) h1))
h0
(** Case analysis in [ALL_h] *)
unfold
let all_if_then_else
(heap a p: Type)
(wp_then wp_else: all_wp_h heap a)
(post: all_post_h heap a)
(h0: heap)
= wp_then post h0 /\ (~p ==> wp_else post h0)
(** Naming postcondition for better sharing in [ALL_h] *)
unfold
let all_ite_wp (heap a: Type) (wp: all_wp_h heap a) (post: all_post_h heap a) (h0: heap) =
forall (k: all_post_h heap a).
(forall (x: result a) (h: heap). {:pattern (guard_free (k x h))} post x h ==> k x h) ==> wp k h0
(** Subsumption in [ALL_h] *)
unfold
let all_stronger (heap a: Type) (wp1 wp2: all_wp_h heap a) =
(forall (p: all_post_h heap a) (h: heap). wp1 p h ==> wp2 p h)
(** Closing a binder in the scope of an [ALL_h] wp *)
unfold
let all_close_wp
(heap a b: Type)
(wp: (b -> GTot (all_wp_h heap a)))
(p: all_post_h heap a)
(h: heap)
= (forall (b: b). wp b p h)
(** Applying an [ALL_h] wp to a trivial postcondition *)
unfold
let all_trivial (heap a: Type) (wp: all_wp_h heap a) = (forall (h0: heap). wp (fun r h1 -> True) h0)
(** Introducing the [ALL_h] effect template *)
new_effect {
ALL_h (heap: Type) : a: Type -> wp: all_wp_h heap a -> Effect
with
return_wp = all_return heap
; bind_wp = all_bind_wp heap
; if_then_else = all_if_then_else heap
; ite_wp = all_ite_wp heap
; stronger = all_stronger heap
; close_wp = all_close_wp heap
; trivial = all_trivial heap
}
(**
Controlling inversions of inductive type
Given a value of an inductive type [v:t], where [t = A | B], the SMT
solver can only prove that [v=A \/ v=B] by _inverting_ [t]. This
inversion is controlled by the [ifuel] setting, which usually limits
the recursion depth of the number of such inversions that the solver
can perform.
The [inversion] predicate below is a way to circumvent the
[ifuel]-based restrictions on inversion depth. In particular, if the
[inversion t] is available in the SMT solver's context, it is free to
invert [t] infinitely, regardless of the [ifuel] setting.
Be careful using this, since it explicitly subverts the [ifuel]
setting. If used unwisely, this can lead to very poor SMT solver
performance. *)
[@@ remove_unused_type_parameters [0]]
val inversion (a: Type) : Type0
(** To introduce [inversion t] in the SMT solver's context, call
[allow_inversion t]. *)
val allow_inversion (a: Type) : Pure unit (requires True) (ensures (fun x -> inversion a))
(** Since the [option] type is so common, we always allow inverting
options, regardless of [ifuel] *)
val invertOption (a: Type)
: Lemma (requires True) (ensures (forall (x: option a). None? x \/ Some? x)) [SMTPat (option a)]
(** Values of type [a] or type [b] *)
type either a b =
| Inl : v: a -> either a b
| Inr : v: b -> either a b
(** Projections for the components of a dependent pair *)
let dfst (#a: Type) (#b: a -> GTot Type) (t: dtuple2 a b)
: Tot a
= Mkdtuple2?._1 t
let dsnd (#a: Type) (#b: a -> GTot Type) (t: dtuple2 a b)
: Tot (b (Mkdtuple2?._1 t))
= Mkdtuple2?._2 t
(** Dependent triples, with sugar [x:a & y:b x & c x y] *)
unopteq
type dtuple3 (a: Type) (b: (a -> GTot Type)) (c: (x: a -> b x -> GTot Type)) =
| Mkdtuple3 : _1: a -> _2: b _1 -> _3: c _1 _2 -> dtuple3 a b c
(** Dependent quadruples, with sugar [x:a & y:b x & z:c x y & d x y z] *)
unopteq
type dtuple4
(a: Type) (b: (x: a -> GTot Type)) (c: (x: a -> b x -> GTot Type))
(d: (x: a -> y: b x -> z: c x y -> GTot Type))
= | Mkdtuple4 : _1: a -> _2: b _1 -> _3: c _1 _2 -> _4: d _1 _2 _3 -> dtuple4 a b c d
(** Dependent quadruples, with sugar [x:a & y:b x & z:c x y & d x y z] *)
unopteq
type dtuple5
(a: Type) (b: (x: a -> GTot Type)) (c: (x: a -> b x -> GTot Type))
(d: (x: a -> y: b x -> z: c x y -> GTot Type))
(e: (x: a -> y: b x -> z: c x y -> w: d x y z -> GTot Type))
= | Mkdtuple5 : _1: a -> _2: b _1 -> _3: c _1 _2 -> _4: d _1 _2 _3 -> _5: e _1 _2 _3 _4 -> dtuple5 a b c d e
(** Explicitly discarding a value *)
let ignore (#a: Type) (x: a) : Tot unit = ()
(** In a context where [false] is provable, you can prove that any
type [a] is inhabited.
There are many proofs of this fact in F*. Here, in the implementation, we build an
infinitely looping function, since the termination check succeeds
in a [False] context. *)
val false_elim (#a: Type) (u: unit{False}) : Tot a
/// Attributes:
///
/// An attribute is any F* term.
///
/// Attributes are desugared and checked for being well-scoped. But,
/// they are not type-checked.
///
/// It is associated with a definition using the [[@@attribute]]
/// notation, just preceding the definition.
(** We collect several internal ocaml attributes into a single
inductive type.
This may be unnecessary. In the future, we are likely to flatten
this definition into several definitions of abstract top-level
names.
An example:
{[
[@@ CInline ] let f x = UInt32.(x +%^ 1)
]}
is extracted to C by KaRaMeL to a C definition tagged with the
[inline] qualifier. *)
type __internal_ocaml_attributes =
| PpxDerivingShow (* Generate [@@@ deriving show ] on the resulting OCaml type *)
| PpxDerivingShowConstant of string (* Similar, but for constant printers. *)
| PpxDerivingYoJson (* Generate [@@@ deriving yojson ] on the resulting OCaml type *)
| CInline
(* KaRaMeL-only: generates a C "inline" attribute on the resulting
* function declaration. *)
| Substitute
(* KaRaMeL-only: forces KaRaMeL to inline the function at call-site; this is
* deprecated and the recommended way is now to use F*'s
* [inline_for_extraction], which now also works for stateful functions. *)
| Gc
(* KaRaMeL-only: instructs KaRaMeL to heap-allocate any value of this
* data-type; this requires running with a conservative GC as the
* allocations are not freed. *)
| Comment of string
(* KaRaMeL-only: attach a comment to the declaration. Note that using F*-doc
* syntax automatically fills in this attribute. *)
| CPrologue of string
(* KaRaMeL-only: verbatim C code to be prepended to the declaration.
* Multiple attributes are valid and accumulate, separated by newlines. *)
| CEpilogue of string (* Ibid. *)
| CConst of string
(* KaRaMeL-only: indicates that the parameter with that name is to be marked
* as C const. This will be checked by the C compiler, not by KaRaMeL or F*.
*
* This is deprecated and doesn't work as intended. Use
* LowStar.ConstBuffer.fst instead! *)
| CCConv of string (* A calling convention for C, one of stdcall, cdecl, fastcall *)
| CAbstractStruct
(* KaRaMeL-only: for types that compile to struct types (records and
* inductives), indicate that the header file should only contain a forward
* declaration, which in turn forces the client to only ever use this type
* through a pointer. *)
| CIfDef (* KaRaMeL-only: on a given `val foo`, compile if foo with #ifdef. *)
| CMacro
(* KaRaMeL-only: for a top-level `let v = e`, compile as a macro *)
| CNoInline
(* For security-sensitive functions only: generate special attributes in C
to prevent inlining; if the function is subjected to a -static-header
option, the `inline` attribute will be removed, but the static will
remain. *)
(** The [inline_let] attribute on a local let-binding, instructs the
extraction pipeline to inline the definition. This may be both to
avoid generating unnecessary intermediate variables, and also to
enable further partial evaluation. Note, use this with care, since
inlining all lets can lead to an exponential blowup in code
size. *)
val inline_let : unit
(** The [rename_let] attribute support a form of metaprogramming for
the names of let-bound variables used in extracted code.
This is useful, particularly in conjunction with partial
evaluation, to ensure that names reflect their usage context.
See tests/micro-benchmarks/Renaming*.fst *)
val rename_let (new_name: string) : Tot unit
(** The [plugin] attribute is used in conjunction with native
compilation of F* components, accelerating their reduction
relative to the default strategy of just interpreting them.
See examples/native_tactics for several examples. *)
val plugin (x: int) : Tot unit
(** An attribute to mark things that the typechecker should *first*
elaborate and typecheck, but unfold before verification. *)
val tcnorm : unit
(** We erase all ghost functions and unit-returning pure functions to
[()] at extraction. This creates a small issue with abstract
types. Consider a module that defines an abstract type [t] whose
(internal) definition is [unit] and also defines [f: int -> t]. [f]
would be erased to be just [()] inside the module, while the
client calls to [f] would not, since [t] is abstract. To get
around this, when extracting interfaces, if we encounter an
abstract type, we tag it with this attribute, so that
extraction can treat it specially.
Note, since the use of cross-module inlining (the [--cmi] option),
this attribute is no longer necessary. We retain it for legacy,
but will remove it in the future. *)
val must_erase_for_extraction : unit
(** This attribute is used with the Dijkstra Monads for Free
construction to track position information in generated VCs *)
val dm4f_bind_range : unit
(** When attached a top-level definition, the typechecker will succeed
if and only if checking the definition results in an error. The
error number list is actually OPTIONAL. If present, it will be
checked that the definition raises exactly those errors in the
specified multiplicity, but order does not matter. *)
val expect_failure (errs: list int) : Tot unit
(** When --lax is present, with the previous attribute since some
definitions only fail when verification is turned on. With this
attribute, one can ensure that a definition fails while lax-checking
too. Same semantics as above, but lax mode will be turned on for the
definition. *)
val expect_lax_failure (errs: list int) : Tot unit
(** Print the time it took to typecheck a top-level definition *)
val tcdecltime : unit
(** This attribute is to be used as a hint for the unifier. A
function-typed symbol `t` marked with this attribute will be treated
as being injective in all its arguments by the unifier. That is,
given a problem `t a1..an =?= t b1..bn` the unifier will solve it by
proving `ai =?= bi` for all `i`, without trying to unfold the
definition of `t`. *)
val unifier_hint_injective : unit
(**
This attribute is used to control the evaluation order
and unfolding strategy for certain definitions.
In particular, given
{[
[@@(strict_on_arguments [1;2])]
let f x0 (x1:list x0) (x1:option x0) = e
]}
An application [f e0 e1 e2] is reduced by the normalizer by:
1. evaluating [e0 ~>* v0, e1 ~>* v1, e2 ~>* v2]
2 a.
If, according to the positional arguments [1;2],
if v1 and v2 have constant head symbols
(e.g., v1 = Cons _ _ _, and v2 = None _)
then [f] is unfolded to [e] and reduced as
{[e[v0/x0][v1/x1][v2/x2]]}
2 b.
Otherwise, [f] is not unfolded and the term is [f e0 e1 e2]
reduces to [f v0 v1 v2]. *)
val strict_on_arguments (x: list int) : Tot unit
(**
* An attribute to tag a tactic designated to solve any
* unsolved implicit arguments remaining at the end of type inference.
**)
val resolve_implicits : unit
(**
* Implicit arguments can be tagged with an attribute [abc] to dispatch
* their solving to a user-defined tactic also tagged with the same
* attribute and resolve_implicits [@@abc; resolve_implicits].
* However, sometimes it is useful to have multiple such
* [abc]-tagged tactics in scope. In such a scenario, to choose among them,
* one can use the attribute as shown below to declare that [t] overrides
* all the tactics [t1...tn] and should be used to solve [abc]-tagged
* implicits, so long as [t] is not iself overridden by some other tactic.
[@@resolve_implicits; abc; override_resolve_implicits_handler abc [`%t1; ... `%tn]]
let t = e
**)
val override_resolve_implicits_handler : #a:Type -> a -> list string -> Tot unit
(** A tactic registered to solve implicits with the (handle_smt_goals)
attribute will receive the SMT goal generated during typechecking
just before it is passed to the SMT solver.
*)
val handle_smt_goals : unit
(** This attribute can be added to an inductive type definition,
indicating that it should be erased on extraction to `unit`.
However, any pattern matching on the inductive type results
in a `Ghost` effect, ensuring that computationally relevant
code cannot rely on the values of the erasable type.
See tests/micro-benchmarks/Erasable.fst, for examples. Also
see https://github.com/FStarLang/FStar/issues/1844 *)
val erasable : unit
(** [commute_nested_matches]
This attribute can be used to decorate an inductive type [t]
During normalization, if reduction is blocked on matching the
constructors of [t] in the following sense:
[
match (match e0 with | P1 -> e1 | ... | Pn -> en) with
| Q1 -> f1 ... | Qm -> fm
]
i.e., the outer match is stuck due to the inner match on [e0]
being stuck, and if the head constructor the outer [Qi] patterns
are the constructors of the decorated inductive type [t], then,
this is reduced to
[
match e0 with
| P1 -> (match e1 with | Q1 -> f1 ... | Qm -> fm)
| ...
| Pn -> (match en with | Q1 -> f1 ... | Qm -> fm)
]
This is sometimes useful when partially evaluating code before
extraction, particularly when aiming to obtain first-order code
for KaRaMeL. However, this attribute should be used with care,
since if after the rewriting the inner matches do not reduce, then
this can cause an explosion in code size.
See tests/micro-benchmarks/CommuteNestedMatches.fst
and examples/layeredeffects/LowParseWriters.fsti
*)
val commute_nested_matches : unit
(** This attribute controls extraction: it can be used to disable
extraction of a given top-level definition into a specific backend,
such as "OCaml". If any extracted code must call into an erased
function, an error will be raised (code 340).
*)
val noextract_to (backend:string) : Tot unit
(** This attribute decorates a let binding, e.g.,
[@@normalize_for_extraction steps]
let f = e
The effect is that prior to extraction, F* will first reduce [e]
using the normalization [steps], and then proceed to extract it as
usual.
Almost the same behavior can be achieved by using a
[postprocess_for_extraction_with t] attribute, which runs tactic
[t] on the goal [e == ?u] and extracts the solution to [?u] in
place of [e]. However, using a tactic to postprocess a term is
more general than needed for some cases.
In particular, if we intend to only normalize [e] before
extraction (rather than applying some other form of equational
reasoning), then using [normalize_for_extraction] can be more
efficient, for the following reason:
Since we are reducing [e] just before extraction, F* can enable an
otherwise non-user-facing normalization feature that allows all
arguments marked [@@@erasable] to be erased to [()]---these terms
will anyway be extracted to [()] so erasing them during
normalization is a useful optimization.
*)
val normalize_for_extraction (steps:list norm_step) : Tot unit
(** A layered effect definition may optionally be annotated with
(ite_soundness_by t) attribute, where t is another attribute
When so, the implicits and the smt guard generated when
checking the soundness of the if-then-else combinator, are
dispatched to the tactic in scope that has the t attribute (in addition
to the resolve_implicits attribute as usual)
See examples/layeredeffects/IteSoundess.fst for a few examples
*)
val ite_soundness_by (attribute: unit): Tot unit
(** By-default functions that have a layered effect, need to have a type
annotation for their bodies
However, a layered effect definition may contain the default_effect
attribute to indicate to the typechecker that for missing annotations,
use the default effect.
The default effect attribute takes as argument a string, that is the name
of the default effect, two caveats:
- The argument must be a string constant (not a name, for example)
- The argument should be the fully qualified name
For example, the TAC effect in FStar.Tactics.Effect.fsti specifies
its default effect as FStar.Tactics.Tac
F* will typecheck that the default effect only takes one argument,
the result type of the computation
*)
val default_effect (s:string) : Tot unit
(** A layered effect may optionally be annotated with the
top_level_effect attribute so indicate that this effect may
appear at the top-level
(e.g., a top-level let x = e, where e has a layered effect type)
The top_level_effect attribute takes (optional) string argument, that is the
name of the effect abbreviation that may constrain effect arguments
for the top-level effect
As with default effect, the string argument must be a string constant,
and fully qualified
E.g. a Hoare-style effect `M a pre post`, may have the attribute
`@@ top_level_effect "N"`, where the effect abbreviation `N` may be:
effect N a post = M a True post
i.e., enforcing a trivial precondition if `M` appears at the top-level
If the argument to `top_level_effect` is absent, then the effect itself
is allowed at the top-level with any effect arguments
See tests/micro-benchmarks/TopLevelIndexedEffects.fst for examples
*)
val top_level_effect (s:string) : Tot unit
(** This attribute can be annotated on the binders in an effect signature
to indicate that they are effect parameters. For example, for a
state effect that is parametric in the type of the state, the state
index may be marked as an effect parameter.
Also see https://github.com/FStarLang/FStar/wiki/Indexed-effects
*)
val effect_param : unit
(** Bind definition for a layered effect may optionally contain range
arguments, that are provided by the typechecker during reification
This attribute on the effect definition indicates that the bind
has range arguments.
See for example the TAC effect in FStar.Tactics.Effect.fsti
*)
val bind_has_range_args : unit
(** An indexed effect definition may be annotated with
this attribute to indicate that the effect should be
extracted "natively". E.g., the `bind` of the effect is
extracted to primitive `let` bindings
As an example, `Steel` effects (the effect for concurrent
separation logic) are marked as such
*)
val primitive_extraction : unit
(** A qualifier on a type definition which when used in co-domain position
on an arrow type will be extracted as if it were an impure effect type.
e.g., if you have
[@@extract_as_impure_effect]
val stt (a:Type) (pre:_) (post:_) : Type
then arrows of the form `a -> stt b p q` will be extracted
similarly to `a -> Dv b`.
*)
val extract_as_impure_effect : unit
(** A binder in a definition/declaration may optionally be annotated as strictly_positive
When the let definition is used in a data constructor type in an inductive
definition, this annotation is used to check the positivity of the inductive
Further F* checks that the binder is actually positive in the let definition
See tests/micro-benchmarks/Positivity.fst and NegativeTests.Positivity.fst for a few examples
*)
val strictly_positive : unit
(** A binder in a definition/declaration may optionally be annotated as unused.
This is used in the strict positivity checker. E.g., a type such as the one
below is accepted
let f ([@@@unused] a:Type) = unit
type t = | MkT: f t -> t
F* checks that the binder is actually unused in the definition
See tests/micro-benchmarks/Positivity.fst for a few examples
*)
val unused : unit
(** This attribute may be added to an inductive type
to disable auto generated projectors
Normally there should not be any need to use this unless:
for some reason F* cannot typecheck the auto-generated projectors.
Another reason to use this attribute may be to avoid generating and
typechecking lot of projectors, most of which are not going to be used
in the rest of the program
*)
val no_auto_projectors : unit
(** As [no_auto_projectors] but also do not even generate declarations
for them. *)
val no_auto_projectors_decls : unit
(** This attribute can be added to a let definition
and indicates to the typechecker to typecheck the signature of the definition
without using subtyping. This is sometimes useful for indicating that a lemma
can be applied by the tactic engine without requiring to check additional
subtyping obligations
*)
val no_subtyping : unit
val admit_termination : unit
(** Pure and ghost inner let bindings are now always inlined during
the wp computation, if: the return type is not unit and the head
symbol is not marked irreducible.
To circumvent this behavior, singleton can be used.
See the example usage in ulib/FStar.Algebra.Monoid.fst. *)
val singleton (#a: Type) (x: a) : Tot (y: a{y == x})
(** A weakening coercion from eqtype to Type.
One of its uses is in types of layered effect combinators that
are subjected to stricter typing discipline (no subtyping) *)
unfold let eqtype_as_type (a:eqtype) : Type = a
(** A coercion of the [x] from [a] to [b], when [a] is provably equal
to [b]. In most cases, F* will silently coerce from [a] to [b]
along a provable equality (as in the body of this | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Pervasives.fsti"
} | [
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives.Native",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.squash (a == b) -> x: a -> b | Prims.Tot | [
"total"
] | [] | [
"Prims.squash",
"Prims.eq2"
] | [] | false | false | false | true | false | let coerce_eq (#a: Type) (#b: Type) (_: squash (a == b)) (x: a) : b =
| x | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.composable_maps | val composable_maps (#a: _) (#k: eqtype) (p: pcm a) (m0 m1: map k a) : prop | val composable_maps (#a: _) (#k: eqtype) (p: pcm a) (m0 m1: map k a) : prop | let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 54,
"end_line": 43,
"start_col": 0,
"start_line": 38
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: FStar.PCM.pcm a -> m0: Pulse.Lib.PCM.Map.map k a -> m1: Pulse.Lib.PCM.Map.map k a -> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"Pulse.Lib.PCM.Map.map",
"Prims.l_Forall",
"FStar.PCM.composable",
"FStar.Map.sel",
"Prims.prop"
] | [] | false | false | false | false | true | let composable_maps (#a: _) (#k: eqtype) (p: pcm a) (m0 m1: map k a) : prop =
| forall k. composable p (Map.sel m0 k) (Map.sel m1 k) | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.compose_maps_comm | val compose_maps_comm (#k #a: _) (p: pcm a) (m0 m1: map k a)
: Lemma (requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0) | val compose_maps_comm (#k #a: _) (p: pcm a) (m0 m1: map k a)
: Lemma (requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0) | let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10) | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 30,
"end_line": 74,
"start_col": 0,
"start_line": 63
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: FStar.PCM.pcm a -> m0: Pulse.Lib.PCM.Map.map k a -> m1: Pulse.Lib.PCM.Map.map k a
-> FStar.Pervasives.Lemma (requires Pulse.Lib.PCM.Map.composable_maps p m0 m1)
(ensures Pulse.Lib.PCM.Map.compose_maps p m0 m1 == Pulse.Lib.PCM.Map.compose_maps p m1 m0) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"Pulse.Lib.PCM.Map.map",
"Prims._assert",
"FStar.Map.equal",
"Prims.unit",
"FStar.Classical.Sugar.forall_intro",
"Prims.eq2",
"FStar.Map.sel",
"FStar.PCM.__proj__Mkpcm__item__comm",
"Prims.squash",
"Pulse.Lib.PCM.Map.compose_maps",
"Pulse.Lib.PCM.Map.composable_maps",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let compose_maps_comm #k #a (p: pcm a) (m0: map k a) (m1: map k a)
: Lemma (requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0) =
| let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key . Map.sel m01 key == Map.sel m10 key
with (p.comm (Map.sel m0 key) (Map.sel m1 key));
assert (Map.equal m01 m10) | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.pointwise | val pointwise (#a: _) (k: eqtype) (p: pcm a) : pcm (map k a) | val pointwise (#a: _) (k: eqtype) (p: pcm a) : pcm (map k a) | let pointwise (#a:_) (k:eqtype) (p:pcm a)
: pcm (map k a)
= {
p = pcm'_map_of_pcm k p;
comm = (fun m0 m1 -> compose_maps_comm p m0 m1);
assoc = (fun m0 m1 m2 -> composable_maps_assoc_l p m0 m1 m2);
assoc_r = (fun m0 m1 m2 -> composable_maps_assoc_r p m0 m1 m2);
is_unit = (fun m -> is_unit p m);
refine = (fun m -> forall k. p.refine (Map.sel m k))
} | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 169,
"start_col": 0,
"start_line": 160
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= ()
/// Composition is commutative
let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10)
/// Composability is left-associative
let composable_maps_assoc_l #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m0 key) (Map.sel m1 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m01 = compose_maps p m0 m1 in
introduce forall key.
composable p (Map.sel m01 key) (Map.sel m2 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal
(compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2)))
/// Composability is right-associative
let composable_maps_assoc_r #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m1 key) (Map.sel m2 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m12 = compose_maps p m1 m2 in
introduce forall key.
composable p (Map.sel m0 key) (Map.sel m12 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p (compose_maps p m0 m1) m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal m012 m012')
/// The core of the constructed PCM
/// The unit is just the pointwise unit
let pcm'_map_of_pcm (#a:_) (k:eqtype) (p:pcm a)
: pcm' (map k a)
= {
composable = composable_maps p;
op = compose_maps p;
one = Map.const p.p.one
}
/// The unit is really a unit
let is_unit #k #a (p:pcm a) (m:map k a)
: Lemma (composable_maps p (Map.const p.p.one) m /\
compose_maps p (Map.const p.p.one) m `Map.equal` m /\
compose_maps p m (Map.const p.p.one) `Map.equal` m)
= introduce forall k. composable p p.p.one (Map.sel m k)
with (
p.is_unit (Map.sel m k)
);
introduce forall k. Map.sel (compose_maps p (Map.const p.p.one) m) k == Map.sel m k /\
Map.sel (compose_maps p m (Map.const p.p.one)) k == Map.sel m k
with (
p.is_unit (Map.sel m k);
p.comm p.p.one (Map.sel m k)
)
/// The main function of this module: | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | k: Prims.eqtype -> p: FStar.PCM.pcm a -> FStar.PCM.pcm (Pulse.Lib.PCM.Map.map k a) | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"FStar.PCM.Mkpcm",
"Pulse.Lib.PCM.Map.map",
"Pulse.Lib.PCM.Map.pcm'_map_of_pcm",
"FStar.PCM.__proj__Mkpcm'__item__composable",
"Pulse.Lib.PCM.Map.compose_maps_comm",
"Prims.unit",
"Prims.l_and",
"FStar.PCM.__proj__Mkpcm'__item__op",
"Pulse.Lib.PCM.Map.composable_maps_assoc_l",
"Pulse.Lib.PCM.Map.composable_maps_assoc_r",
"Pulse.Lib.PCM.Map.is_unit",
"Prims.l_Forall",
"FStar.PCM.__proj__Mkpcm__item__refine",
"FStar.Map.sel",
"Prims.prop"
] | [] | false | false | false | false | false | let pointwise (#a: _) (k: eqtype) (p: pcm a) : pcm (map k a) =
| {
p = pcm'_map_of_pcm k p;
comm = (fun m0 m1 -> compose_maps_comm p m0 m1);
assoc = (fun m0 m1 m2 -> composable_maps_assoc_l p m0 m1 m2);
assoc_r = (fun m0 m1 m2 -> composable_maps_assoc_r p m0 m1 m2);
is_unit = (fun m -> is_unit p m);
refine = (fun m -> forall k. p.refine (Map.sel m k))
} | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.pcm'_map_of_pcm | val pcm'_map_of_pcm (#a: _) (k: eqtype) (p: pcm a) : pcm' (map k a) | val pcm'_map_of_pcm (#a: _) (k: eqtype) (p: pcm a) : pcm' (map k a) | let pcm'_map_of_pcm (#a:_) (k:eqtype) (p:pcm a)
: pcm' (map k a)
= {
composable = composable_maps p;
op = compose_maps p;
one = Map.const p.p.one
} | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 140,
"start_col": 0,
"start_line": 134
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= ()
/// Composition is commutative
let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10)
/// Composability is left-associative
let composable_maps_assoc_l #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m0 key) (Map.sel m1 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m01 = compose_maps p m0 m1 in
introduce forall key.
composable p (Map.sel m01 key) (Map.sel m2 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal
(compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2)))
/// Composability is right-associative
let composable_maps_assoc_r #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m1 key) (Map.sel m2 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m12 = compose_maps p m1 m2 in
introduce forall key.
composable p (Map.sel m0 key) (Map.sel m12 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p (compose_maps p m0 m1) m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal m012 m012')
/// The core of the constructed PCM | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | k: Prims.eqtype -> p: FStar.PCM.pcm a -> FStar.PCM.pcm' (Pulse.Lib.PCM.Map.map k a) | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"FStar.PCM.Mkpcm'",
"Pulse.Lib.PCM.Map.map",
"Pulse.Lib.PCM.Map.composable_maps",
"Pulse.Lib.PCM.Map.compose_maps",
"FStar.Map.const",
"FStar.PCM.__proj__Mkpcm'__item__one",
"FStar.PCM.__proj__Mkpcm__item__p",
"FStar.PCM.pcm'"
] | [] | false | false | false | false | false | let pcm'_map_of_pcm (#a: _) (k: eqtype) (p: pcm a) : pcm' (map k a) =
| { composable = composable_maps p; op = compose_maps p; one = Map.const p.p.one } | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.compatible_pointwise | val compatible_pointwise (#a #k: _) (p: pcm a) (m0 m1: map k a)
: Lemma (requires compatible (pointwise k p) m0 m1)
(ensures forall k. compatible p (Map.sel m0 k) (Map.sel m1 k)) | val compatible_pointwise (#a #k: _) (p: pcm a) (m0 m1: map k a)
: Lemma (requires compatible (pointwise k p) m0 m1)
(ensures forall k. compatible p (Map.sel m0 k) (Map.sel m1 k)) | let compatible_pointwise #a #k
(p:pcm a)
(m0 m1:map k a)
: Lemma
(requires compatible (pointwise k p) m0 m1)
(ensures forall k. compatible p (Map.sel m0 k) (Map.sel m1 k))
= let pcm' = pointwise k p in
introduce forall k. compatible p (Map.sel m0 k) (Map.sel m1 k)
with (
eliminate exists frame.
composable pcm' m0 frame /\ op pcm' frame m0 == m1
returns _
with _. (
introduce exists (frame:a).
composable p
(Map.sel m0 k)
frame /\
op p frame (Map.sel m0 k) == Map.sel m1 k
with (Map.sel frame k)
and ())) | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 16,
"end_line": 193,
"start_col": 0,
"start_line": 174
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= ()
/// Composition is commutative
let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10)
/// Composability is left-associative
let composable_maps_assoc_l #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m0 key) (Map.sel m1 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m01 = compose_maps p m0 m1 in
introduce forall key.
composable p (Map.sel m01 key) (Map.sel m2 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal
(compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2)))
/// Composability is right-associative
let composable_maps_assoc_r #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m1 key) (Map.sel m2 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m12 = compose_maps p m1 m2 in
introduce forall key.
composable p (Map.sel m0 key) (Map.sel m12 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p (compose_maps p m0 m1) m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal m012 m012')
/// The core of the constructed PCM
/// The unit is just the pointwise unit
let pcm'_map_of_pcm (#a:_) (k:eqtype) (p:pcm a)
: pcm' (map k a)
= {
composable = composable_maps p;
op = compose_maps p;
one = Map.const p.p.one
}
/// The unit is really a unit
let is_unit #k #a (p:pcm a) (m:map k a)
: Lemma (composable_maps p (Map.const p.p.one) m /\
compose_maps p (Map.const p.p.one) m `Map.equal` m /\
compose_maps p m (Map.const p.p.one) `Map.equal` m)
= introduce forall k. composable p p.p.one (Map.sel m k)
with (
p.is_unit (Map.sel m k)
);
introduce forall k. Map.sel (compose_maps p (Map.const p.p.one) m) k == Map.sel m k /\
Map.sel (compose_maps p m (Map.const p.p.one)) k == Map.sel m k
with (
p.is_unit (Map.sel m k);
p.comm p.p.one (Map.sel m k)
)
/// The main function of this module:
/// Given a [k] and [p:pcm a], lift it pointwise
let pointwise (#a:_) (k:eqtype) (p:pcm a)
: pcm (map k a)
= {
p = pcm'_map_of_pcm k p;
comm = (fun m0 m1 -> compose_maps_comm p m0 m1);
assoc = (fun m0 m1 m2 -> composable_maps_assoc_l p m0 m1 m2);
assoc_r = (fun m0 m1 m2 -> composable_maps_assoc_r p m0 m1 m2);
is_unit = (fun m -> is_unit p m);
refine = (fun m -> forall k. p.refine (Map.sel m k))
}
/// Now some constructions that allow us to lift frame-preserving updates | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: FStar.PCM.pcm a -> m0: Pulse.Lib.PCM.Map.map k a -> m1: Pulse.Lib.PCM.Map.map k a
-> FStar.Pervasives.Lemma (requires FStar.PCM.compatible (Pulse.Lib.PCM.Map.pointwise k p) m0 m1)
(ensures forall (k: k). FStar.PCM.compatible p (FStar.Map.sel m0 k) (FStar.Map.sel m1 k)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"Pulse.Lib.PCM.Map.map",
"FStar.Classical.Sugar.forall_intro",
"FStar.PCM.compatible",
"FStar.Map.sel",
"FStar.Classical.Sugar.exists_elim",
"Prims.l_and",
"FStar.PCM.composable",
"Prims.eq2",
"FStar.PCM.op",
"Prims.l_Exists",
"Prims.squash",
"FStar.Classical.Sugar.exists_intro",
"Prims.unit",
"Pulse.Lib.PCM.Map.pointwise",
"Prims.l_Forall",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let compatible_pointwise #a #k (p: pcm a) (m0: map k a) (m1: map k a)
: Lemma (requires compatible (pointwise k p) m0 m1)
(ensures forall k. compatible p (Map.sel m0 k) (Map.sel m1 k)) =
| let pcm' = pointwise k p in
introduce forall k . compatible p (Map.sel m0 k) (Map.sel m1 k)
with (eliminate exists frame.
composable pcm' m0 frame /\ op pcm' frame m0 == m1
returns _
with _.
(introduce exists (frame: a).composable p (Map.sel m0 k) frame /\
op p frame (Map.sel m0 k) == Map.sel m1 k
with (Map.sel frame k)
and ())) | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.compose_maps | val compose_maps
(#a: _)
(#k: eqtype)
(p: pcm a)
(m0: map k a)
(m1: map k a {composable_maps p m0 m1})
: map k a | val compose_maps
(#a: _)
(#k: eqtype)
(p: pcm a)
(m0: map k a)
(m1: map k a {composable_maps p m0 m1})
: map k a | let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k) | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 56,
"end_line": 52,
"start_col": 0,
"start_line": 46
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: FStar.PCM.pcm a ->
m0: Pulse.Lib.PCM.Map.map k a ->
m1: Pulse.Lib.PCM.Map.map k a {Pulse.Lib.PCM.Map.composable_maps p m0 m1}
-> Pulse.Lib.PCM.Map.map k a | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"Pulse.Lib.PCM.Map.map",
"Pulse.Lib.PCM.Map.composable_maps",
"FStar.Map.map_literal",
"FStar.PCM.op",
"FStar.Map.sel"
] | [] | false | false | false | false | false | let compose_maps
(#a: _)
(#k: eqtype)
(p: pcm a)
(m0: map k a)
(m1: map k a {composable_maps p m0 m1})
: map k a =
| Map.map_literal (fun k -> op p (Map.sel m0 k) (Map.sel m1 k)) | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.lift_frame_preserving_upd | val lift_frame_preserving_upd
(#a #k: _)
(#p: pcm a)
(v0 v1: Ghost.erased a)
(f: frame_preserving_upd p v0 v1)
(m0: Ghost.erased (map k a))
(key: k{Map.sel m0 key == Ghost.reveal v0})
: frame_preserving_upd (pointwise k p) m0 (Map.upd m0 key v1) | val lift_frame_preserving_upd
(#a #k: _)
(#p: pcm a)
(v0 v1: Ghost.erased a)
(f: frame_preserving_upd p v0 v1)
(m0: Ghost.erased (map k a))
(key: k{Map.sel m0 key == Ghost.reveal v0})
: frame_preserving_upd (pointwise k p) m0 (Map.upd m0 key v1) | let lift_frame_preserving_upd #a #k (#p:pcm a)
(v0 v1: Ghost.erased a)
(f:frame_preserving_upd p v0 v1)
(m0: Ghost.erased (map k a))
(key:k { Map.sel m0 key == Ghost.reveal v0 })
: frame_preserving_upd (pointwise k p) m0 (Map.upd m0 key v1)
= fun full_m0 ->
let p' = pointwise k p in
let full_v0 = Map.sel full_m0 key in
assert (compatible (pointwise _ p) m0 full_m0);
assert (p.refine full_v0);
compatible_pointwise #a #k p m0 full_m0;
assert (compatible p v0 full_v0);
let full_v1 = f full_v0 in
let full_m1 = Map.upd full_m0 key full_v1 in
assert (p'.refine full_m1);
compatible_pointwise_upd p v1 full_v1 m0 full_m0 key;
assert (
let m1 = Map.upd m0 key v1 in
compatible p' m1 full_m1
);
lift_frame_preservation p m0 full_m0 v1 full_v1 key;
full_m1 | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 17,
"end_line": 303,
"start_col": 0,
"start_line": 281
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= ()
/// Composition is commutative
let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10)
/// Composability is left-associative
let composable_maps_assoc_l #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m0 key) (Map.sel m1 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m01 = compose_maps p m0 m1 in
introduce forall key.
composable p (Map.sel m01 key) (Map.sel m2 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal
(compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2)))
/// Composability is right-associative
let composable_maps_assoc_r #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m1 key) (Map.sel m2 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m12 = compose_maps p m1 m2 in
introduce forall key.
composable p (Map.sel m0 key) (Map.sel m12 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p (compose_maps p m0 m1) m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal m012 m012')
/// The core of the constructed PCM
/// The unit is just the pointwise unit
let pcm'_map_of_pcm (#a:_) (k:eqtype) (p:pcm a)
: pcm' (map k a)
= {
composable = composable_maps p;
op = compose_maps p;
one = Map.const p.p.one
}
/// The unit is really a unit
let is_unit #k #a (p:pcm a) (m:map k a)
: Lemma (composable_maps p (Map.const p.p.one) m /\
compose_maps p (Map.const p.p.one) m `Map.equal` m /\
compose_maps p m (Map.const p.p.one) `Map.equal` m)
= introduce forall k. composable p p.p.one (Map.sel m k)
with (
p.is_unit (Map.sel m k)
);
introduce forall k. Map.sel (compose_maps p (Map.const p.p.one) m) k == Map.sel m k /\
Map.sel (compose_maps p m (Map.const p.p.one)) k == Map.sel m k
with (
p.is_unit (Map.sel m k);
p.comm p.p.one (Map.sel m k)
)
/// The main function of this module:
/// Given a [k] and [p:pcm a], lift it pointwise
let pointwise (#a:_) (k:eqtype) (p:pcm a)
: pcm (map k a)
= {
p = pcm'_map_of_pcm k p;
comm = (fun m0 m1 -> compose_maps_comm p m0 m1);
assoc = (fun m0 m1 m2 -> composable_maps_assoc_l p m0 m1 m2);
assoc_r = (fun m0 m1 m2 -> composable_maps_assoc_r p m0 m1 m2);
is_unit = (fun m -> is_unit p m);
refine = (fun m -> forall k. p.refine (Map.sel m k))
}
/// Now some constructions that allow us to lift frame-preserving updates
/// If a two maps are compatible, then they are also compatible pointwise
let compatible_pointwise #a #k
(p:pcm a)
(m0 m1:map k a)
: Lemma
(requires compatible (pointwise k p) m0 m1)
(ensures forall k. compatible p (Map.sel m0 k) (Map.sel m1 k))
= let pcm' = pointwise k p in
introduce forall k. compatible p (Map.sel m0 k) (Map.sel m1 k)
with (
eliminate exists frame.
composable pcm' m0 frame /\ op pcm' frame m0 == m1
returns _
with _. (
introduce exists (frame:a).
composable p
(Map.sel m0 k)
frame /\
op p frame (Map.sel m0 k) == Map.sel m1 k
with (Map.sel frame k)
and ()))
/// A very specific lemma for use in lifting frame-preserving updates
///
/// If two maps are compatible, then updating them at a key with
/// values that are compatible produces compatible maps
let compatible_pointwise_upd #a (#k:eqtype)
(p:pcm a)
(v1 full_v1:a)
(m0 full_m0:map k a)
(key:k)
: Lemma
(requires
compatible p v1 full_v1 /\
compatible (pointwise k p) m0 full_m0)
(ensures
compatible (pointwise k p) (Map.upd m0 key v1)
(Map.upd full_m0 key full_v1))
= compatible_pointwise p m0 full_m0;
assert (compatible p (Map.sel m0 key) (Map.sel full_m0 key));
let m1 = (Map.upd m0 key v1) in
let full_m1 = (Map.upd full_m0 key full_v1) in
let p' = pointwise k p in
eliminate exists (frame_m0:_). composable p' m0 frame_m0 /\ op p' frame_m0 m0 == full_m0
returns _
with _. (
eliminate exists (frame0:_). composable p v1 frame0 /\ op p frame0 v1 == full_v1
returns _
with _. (
introduce exists (frame:_).
composable p' m1 frame /\ op p' frame m1 == full_m1
with (Map.upd frame_m0 key frame0)
and (
let w = Map.upd frame_m0 key frame0 in
assert (Map.equal (compose_maps p w m1) full_m1)
)))
/// If any frame composes with [v0] to produce [full_v0]
/// can also be composed with [v1] to produce [full_v1]
///
/// Then any frame composable with a map contains [v0] yielding a map
/// containing [full_v0], is also composable with a map containing
/// [v1] yielding [full_v1] at that key.
let lift_frame_preservation #a (#k:eqtype) (p:pcm a)
(m0 full_m0:map k a)
(v1 full_v1:a)
(key:k)
: Lemma
(requires (
let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
(forall (frame:a{composable p v0 frame}). {:pattern composable p v0 frame}
composable p v1 frame /\
(op p v0 frame == full_v0 ==>
op p v1 frame == full_v1))))
(ensures (
let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
let p' = pointwise k p in
(forall (frame:_{composable p' m0 frame}).
composable p' m1 frame /\
(op p' m0 frame == full_m0 ==>
op p' m1 frame == full_m1))))
= let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
let p' = pointwise k p in
introduce forall (frame:_{composable p' m0 frame}).
composable p' m1 frame /\
(op p' m0 frame == full_m0 ==>
op p' m1 frame == full_m1)
with (
introduce _ /\ _
with ()
and ( introduce _ ==> _
with _. (
assert (compose_maps p m1 frame `Map.equal` full_m1)
)
)
)
/// Lift a frame-preserving update from [v0] to [v1] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
v0: FStar.Ghost.erased a ->
v1: FStar.Ghost.erased a ->
f: FStar.PCM.frame_preserving_upd p (FStar.Ghost.reveal v0) (FStar.Ghost.reveal v1) ->
m0: FStar.Ghost.erased (Pulse.Lib.PCM.Map.map k a) ->
key: k{FStar.Map.sel (FStar.Ghost.reveal m0) key == FStar.Ghost.reveal v0}
-> FStar.PCM.frame_preserving_upd (Pulse.Lib.PCM.Map.pointwise k p)
(FStar.Ghost.reveal m0)
(FStar.Map.upd (FStar.Ghost.reveal m0) key (FStar.Ghost.reveal v1)) | Prims.Tot | [
"total"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"FStar.Ghost.erased",
"FStar.PCM.frame_preserving_upd",
"FStar.Ghost.reveal",
"Pulse.Lib.PCM.Map.map",
"Prims.eq2",
"FStar.Map.sel",
"Prims.l_and",
"FStar.PCM.__proj__Mkpcm__item__refine",
"Pulse.Lib.PCM.Map.pointwise",
"FStar.PCM.compatible",
"Prims.unit",
"Pulse.Lib.PCM.Map.lift_frame_preservation",
"Prims._assert",
"FStar.Map.t",
"FStar.Map.upd",
"Pulse.Lib.PCM.Map.compatible_pointwise_upd",
"Prims.l_Forall",
"FStar.PCM.composable",
"Prims.l_imp",
"FStar.PCM.op",
"Pulse.Lib.PCM.Map.compatible_pointwise"
] | [] | false | false | false | false | false | let lift_frame_preserving_upd
#a
#k
(#p: pcm a)
(v0: Ghost.erased a)
(v1: Ghost.erased a)
(f: frame_preserving_upd p v0 v1)
(m0: Ghost.erased (map k a))
(key: k{Map.sel m0 key == Ghost.reveal v0})
: frame_preserving_upd (pointwise k p) m0 (Map.upd m0 key v1) =
| fun full_m0 ->
let p' = pointwise k p in
let full_v0 = Map.sel full_m0 key in
assert (compatible (pointwise _ p) m0 full_m0);
assert (p.refine full_v0);
compatible_pointwise #a #k p m0 full_m0;
assert (compatible p v0 full_v0);
let full_v1 = f full_v0 in
let full_m1 = Map.upd full_m0 key full_v1 in
assert (p'.refine full_m1);
compatible_pointwise_upd p v1 full_v1 m0 full_m0 key;
assert (let m1 = Map.upd m0 key v1 in
compatible p' m1 full_m1);
lift_frame_preservation p m0 full_m0 v1 full_v1 key;
full_m1 | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.compatible_pointwise_upd | val compatible_pointwise_upd
(#a: _)
(#k: eqtype)
(p: pcm a)
(v1 full_v1: a)
(m0 full_m0: map k a)
(key: k)
: Lemma (requires compatible p v1 full_v1 /\ compatible (pointwise k p) m0 full_m0)
(ensures compatible (pointwise k p) (Map.upd m0 key v1) (Map.upd full_m0 key full_v1)) | val compatible_pointwise_upd
(#a: _)
(#k: eqtype)
(p: pcm a)
(v1 full_v1: a)
(m0 full_m0: map k a)
(key: k)
: Lemma (requires compatible p v1 full_v1 /\ compatible (pointwise k p) m0 full_m0)
(ensures compatible (pointwise k p) (Map.upd m0 key v1) (Map.upd full_m0 key full_v1)) | let compatible_pointwise_upd #a (#k:eqtype)
(p:pcm a)
(v1 full_v1:a)
(m0 full_m0:map k a)
(key:k)
: Lemma
(requires
compatible p v1 full_v1 /\
compatible (pointwise k p) m0 full_m0)
(ensures
compatible (pointwise k p) (Map.upd m0 key v1)
(Map.upd full_m0 key full_v1))
= compatible_pointwise p m0 full_m0;
assert (compatible p (Map.sel m0 key) (Map.sel full_m0 key));
let m1 = (Map.upd m0 key v1) in
let full_m1 = (Map.upd full_m0 key full_v1) in
let p' = pointwise k p in
eliminate exists (frame_m0:_). composable p' m0 frame_m0 /\ op p' frame_m0 m0 == full_m0
returns _
with _. (
eliminate exists (frame0:_). composable p v1 frame0 /\ op p frame0 v1 == full_v1
returns _
with _. (
introduce exists (frame:_).
composable p' m1 frame /\ op p' frame m1 == full_m1
with (Map.upd frame_m0 key frame0)
and (
let w = Map.upd frame_m0 key frame0 in
assert (Map.equal (compose_maps p w m1) full_m1)
))) | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 7,
"end_line": 228,
"start_col": 0,
"start_line": 199
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= ()
/// Composition is commutative
let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10)
/// Composability is left-associative
let composable_maps_assoc_l #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m0 key) (Map.sel m1 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m01 = compose_maps p m0 m1 in
introduce forall key.
composable p (Map.sel m01 key) (Map.sel m2 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal
(compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2)))
/// Composability is right-associative
let composable_maps_assoc_r #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m1 key) (Map.sel m2 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m12 = compose_maps p m1 m2 in
introduce forall key.
composable p (Map.sel m0 key) (Map.sel m12 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p (compose_maps p m0 m1) m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal m012 m012')
/// The core of the constructed PCM
/// The unit is just the pointwise unit
let pcm'_map_of_pcm (#a:_) (k:eqtype) (p:pcm a)
: pcm' (map k a)
= {
composable = composable_maps p;
op = compose_maps p;
one = Map.const p.p.one
}
/// The unit is really a unit
let is_unit #k #a (p:pcm a) (m:map k a)
: Lemma (composable_maps p (Map.const p.p.one) m /\
compose_maps p (Map.const p.p.one) m `Map.equal` m /\
compose_maps p m (Map.const p.p.one) `Map.equal` m)
= introduce forall k. composable p p.p.one (Map.sel m k)
with (
p.is_unit (Map.sel m k)
);
introduce forall k. Map.sel (compose_maps p (Map.const p.p.one) m) k == Map.sel m k /\
Map.sel (compose_maps p m (Map.const p.p.one)) k == Map.sel m k
with (
p.is_unit (Map.sel m k);
p.comm p.p.one (Map.sel m k)
)
/// The main function of this module:
/// Given a [k] and [p:pcm a], lift it pointwise
let pointwise (#a:_) (k:eqtype) (p:pcm a)
: pcm (map k a)
= {
p = pcm'_map_of_pcm k p;
comm = (fun m0 m1 -> compose_maps_comm p m0 m1);
assoc = (fun m0 m1 m2 -> composable_maps_assoc_l p m0 m1 m2);
assoc_r = (fun m0 m1 m2 -> composable_maps_assoc_r p m0 m1 m2);
is_unit = (fun m -> is_unit p m);
refine = (fun m -> forall k. p.refine (Map.sel m k))
}
/// Now some constructions that allow us to lift frame-preserving updates
/// If a two maps are compatible, then they are also compatible pointwise
let compatible_pointwise #a #k
(p:pcm a)
(m0 m1:map k a)
: Lemma
(requires compatible (pointwise k p) m0 m1)
(ensures forall k. compatible p (Map.sel m0 k) (Map.sel m1 k))
= let pcm' = pointwise k p in
introduce forall k. compatible p (Map.sel m0 k) (Map.sel m1 k)
with (
eliminate exists frame.
composable pcm' m0 frame /\ op pcm' frame m0 == m1
returns _
with _. (
introduce exists (frame:a).
composable p
(Map.sel m0 k)
frame /\
op p frame (Map.sel m0 k) == Map.sel m1 k
with (Map.sel frame k)
and ()))
/// A very specific lemma for use in lifting frame-preserving updates
///
/// If two maps are compatible, then updating them at a key with | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: FStar.PCM.pcm a ->
v1: a ->
full_v1: a ->
m0: Pulse.Lib.PCM.Map.map k a ->
full_m0: Pulse.Lib.PCM.Map.map k a ->
key: k
-> FStar.Pervasives.Lemma
(requires
FStar.PCM.compatible p v1 full_v1 /\
FStar.PCM.compatible (Pulse.Lib.PCM.Map.pointwise k p) m0 full_m0)
(ensures
FStar.PCM.compatible (Pulse.Lib.PCM.Map.pointwise k p)
(FStar.Map.upd m0 key v1)
(FStar.Map.upd full_m0 key full_v1)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"Pulse.Lib.PCM.Map.map",
"FStar.Classical.Sugar.exists_elim",
"Prims.l_and",
"FStar.PCM.composable",
"Prims.eq2",
"FStar.PCM.op",
"Prims.l_Exists",
"FStar.Map.t",
"Prims.squash",
"FStar.Classical.Sugar.exists_intro",
"FStar.Map.upd",
"Prims.unit",
"Prims._assert",
"FStar.Map.equal",
"Pulse.Lib.PCM.Map.compose_maps",
"Pulse.Lib.PCM.Map.pointwise",
"FStar.PCM.compatible",
"FStar.Map.sel",
"Pulse.Lib.PCM.Map.compatible_pointwise",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let compatible_pointwise_upd
#a
(#k: eqtype)
(p: pcm a)
(v1: a)
(full_v1: a)
(m0: map k a)
(full_m0: map k a)
(key: k)
: Lemma (requires compatible p v1 full_v1 /\ compatible (pointwise k p) m0 full_m0)
(ensures compatible (pointwise k p) (Map.upd m0 key v1) (Map.upd full_m0 key full_v1)) =
| compatible_pointwise p m0 full_m0;
assert (compatible p (Map.sel m0 key) (Map.sel full_m0 key));
let m1 = (Map.upd m0 key v1) in
let full_m1 = (Map.upd full_m0 key full_v1) in
let p' = pointwise k p in
eliminate exists (frame_m0: _).
composable p' m0 frame_m0 /\ op p' frame_m0 m0 == full_m0
returns _
with _.
(eliminate exists (frame0: _).
composable p v1 frame0 /\ op p frame0 v1 == full_v1
returns _
with _.
(introduce exists (frame: _).composable p' m1 frame /\ op p' frame m1 == full_m1
with (Map.upd frame_m0 key frame0)
and (let w = Map.upd frame_m0 key frame0 in
assert (Map.equal (compose_maps p w m1) full_m1)))) | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.composable_maps_assoc_r | val composable_maps_assoc_r (#k #a: _) (p: pcm a) (m0 m1 m2: map k a)
: Lemma (requires composable_maps p m0 m1 /\ composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\ composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 == compose_maps p m0 (compose_maps p m1 m2)) | val composable_maps_assoc_r (#k #a: _) (p: pcm a) (m0 m1 m2: map k a)
: Lemma (requires composable_maps p m0 m1 /\ composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\ composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 == compose_maps p m0 (compose_maps p m1 m2)) | let composable_maps_assoc_r #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m1 key) (Map.sel m2 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m12 = compose_maps p m1 m2 in
introduce forall key.
composable p (Map.sel m0 key) (Map.sel m12 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p (compose_maps p m0 m1) m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal m012 m012') | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 33,
"end_line": 130,
"start_col": 0,
"start_line": 106
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= ()
/// Composition is commutative
let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10)
/// Composability is left-associative
let composable_maps_assoc_l #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m0 key) (Map.sel m1 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m01 = compose_maps p m0 m1 in
introduce forall key.
composable p (Map.sel m01 key) (Map.sel m2 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal
(compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2))) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: FStar.PCM.pcm a ->
m0: Pulse.Lib.PCM.Map.map k a ->
m1: Pulse.Lib.PCM.Map.map k a ->
m2: Pulse.Lib.PCM.Map.map k a
-> FStar.Pervasives.Lemma
(requires
Pulse.Lib.PCM.Map.composable_maps p m0 m1 /\
Pulse.Lib.PCM.Map.composable_maps p (Pulse.Lib.PCM.Map.compose_maps p m0 m1) m2)
(ensures
Pulse.Lib.PCM.Map.composable_maps p m1 m2 /\
Pulse.Lib.PCM.Map.composable_maps p m0 (Pulse.Lib.PCM.Map.compose_maps p m1 m2) /\
Pulse.Lib.PCM.Map.compose_maps p (Pulse.Lib.PCM.Map.compose_maps p m0 m1) m2 ==
Pulse.Lib.PCM.Map.compose_maps p m0 (Pulse.Lib.PCM.Map.compose_maps p m1 m2)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"Pulse.Lib.PCM.Map.map",
"Prims._assert",
"FStar.Map.equal",
"Prims.unit",
"FStar.Classical.Sugar.forall_intro",
"Prims.eq2",
"FStar.Map.sel",
"FStar.PCM.__proj__Mkpcm__item__assoc_r",
"Prims.squash",
"Pulse.Lib.PCM.Map.compose_maps",
"FStar.PCM.composable",
"Prims.l_and",
"Pulse.Lib.PCM.Map.composable_maps",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let composable_maps_assoc_r #k #a (p: pcm a) (m0: map k a) (m1: map k a) (m2: map k a)
: Lemma (requires composable_maps p m0 m1 /\ composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\ composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 == compose_maps p m0 (compose_maps p m1 m2)) =
| introduce forall key . composable p (Map.sel m1 key) (Map.sel m2 key)
with (p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key));
let m12 = compose_maps p m1 m2 in
introduce forall key . composable p (Map.sel m0 key) (Map.sel m12 key)
with (p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key));
let m012 = compose_maps p (compose_maps p m0 m1) m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key . Map.sel m012 key == Map.sel m012' key
with (p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key));
assert (Map.equal m012 m012') | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.lift_frame_preservation | val lift_frame_preservation
(#a: _)
(#k: eqtype)
(p: pcm a)
(m0 full_m0: map k a)
(v1 full_v1: a)
(key: k)
: Lemma
(requires
(let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
(forall (frame: a{composable p v0 frame}). {:pattern composable p v0 frame}
composable p v1 frame /\ (op p v0 frame == full_v0 ==> op p v1 frame == full_v1))))
(ensures
(let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
let p' = pointwise k p in
(forall (frame: _{composable p' m0 frame}).
composable p' m1 frame /\ (op p' m0 frame == full_m0 ==> op p' m1 frame == full_m1)))) | val lift_frame_preservation
(#a: _)
(#k: eqtype)
(p: pcm a)
(m0 full_m0: map k a)
(v1 full_v1: a)
(key: k)
: Lemma
(requires
(let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
(forall (frame: a{composable p v0 frame}). {:pattern composable p v0 frame}
composable p v1 frame /\ (op p v0 frame == full_v0 ==> op p v1 frame == full_v1))))
(ensures
(let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
let p' = pointwise k p in
(forall (frame: _{composable p' m0 frame}).
composable p' m1 frame /\ (op p' m0 frame == full_m0 ==> op p' m1 frame == full_m1)))) | let lift_frame_preservation #a (#k:eqtype) (p:pcm a)
(m0 full_m0:map k a)
(v1 full_v1:a)
(key:k)
: Lemma
(requires (
let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
(forall (frame:a{composable p v0 frame}). {:pattern composable p v0 frame}
composable p v1 frame /\
(op p v0 frame == full_v0 ==>
op p v1 frame == full_v1))))
(ensures (
let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
let p' = pointwise k p in
(forall (frame:_{composable p' m0 frame}).
composable p' m1 frame /\
(op p' m0 frame == full_m0 ==>
op p' m1 frame == full_m1))))
= let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
let p' = pointwise k p in
introduce forall (frame:_{composable p' m0 frame}).
composable p' m1 frame /\
(op p' m0 frame == full_m0 ==>
op p' m1 frame == full_m1)
with (
introduce _ /\ _
with ()
and ( introduce _ ==> _
with _. (
assert (compose_maps p m1 frame `Map.equal` full_m1)
)
)
) | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 7,
"end_line": 277,
"start_col": 0,
"start_line": 236
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= ()
/// Composition is commutative
let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10)
/// Composability is left-associative
let composable_maps_assoc_l #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m0 key) (Map.sel m1 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m01 = compose_maps p m0 m1 in
introduce forall key.
composable p (Map.sel m01 key) (Map.sel m2 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal
(compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2)))
/// Composability is right-associative
let composable_maps_assoc_r #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m1 key) (Map.sel m2 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m12 = compose_maps p m1 m2 in
introduce forall key.
composable p (Map.sel m0 key) (Map.sel m12 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p (compose_maps p m0 m1) m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal m012 m012')
/// The core of the constructed PCM
/// The unit is just the pointwise unit
let pcm'_map_of_pcm (#a:_) (k:eqtype) (p:pcm a)
: pcm' (map k a)
= {
composable = composable_maps p;
op = compose_maps p;
one = Map.const p.p.one
}
/// The unit is really a unit
let is_unit #k #a (p:pcm a) (m:map k a)
: Lemma (composable_maps p (Map.const p.p.one) m /\
compose_maps p (Map.const p.p.one) m `Map.equal` m /\
compose_maps p m (Map.const p.p.one) `Map.equal` m)
= introduce forall k. composable p p.p.one (Map.sel m k)
with (
p.is_unit (Map.sel m k)
);
introduce forall k. Map.sel (compose_maps p (Map.const p.p.one) m) k == Map.sel m k /\
Map.sel (compose_maps p m (Map.const p.p.one)) k == Map.sel m k
with (
p.is_unit (Map.sel m k);
p.comm p.p.one (Map.sel m k)
)
/// The main function of this module:
/// Given a [k] and [p:pcm a], lift it pointwise
let pointwise (#a:_) (k:eqtype) (p:pcm a)
: pcm (map k a)
= {
p = pcm'_map_of_pcm k p;
comm = (fun m0 m1 -> compose_maps_comm p m0 m1);
assoc = (fun m0 m1 m2 -> composable_maps_assoc_l p m0 m1 m2);
assoc_r = (fun m0 m1 m2 -> composable_maps_assoc_r p m0 m1 m2);
is_unit = (fun m -> is_unit p m);
refine = (fun m -> forall k. p.refine (Map.sel m k))
}
/// Now some constructions that allow us to lift frame-preserving updates
/// If a two maps are compatible, then they are also compatible pointwise
let compatible_pointwise #a #k
(p:pcm a)
(m0 m1:map k a)
: Lemma
(requires compatible (pointwise k p) m0 m1)
(ensures forall k. compatible p (Map.sel m0 k) (Map.sel m1 k))
= let pcm' = pointwise k p in
introduce forall k. compatible p (Map.sel m0 k) (Map.sel m1 k)
with (
eliminate exists frame.
composable pcm' m0 frame /\ op pcm' frame m0 == m1
returns _
with _. (
introduce exists (frame:a).
composable p
(Map.sel m0 k)
frame /\
op p frame (Map.sel m0 k) == Map.sel m1 k
with (Map.sel frame k)
and ()))
/// A very specific lemma for use in lifting frame-preserving updates
///
/// If two maps are compatible, then updating them at a key with
/// values that are compatible produces compatible maps
let compatible_pointwise_upd #a (#k:eqtype)
(p:pcm a)
(v1 full_v1:a)
(m0 full_m0:map k a)
(key:k)
: Lemma
(requires
compatible p v1 full_v1 /\
compatible (pointwise k p) m0 full_m0)
(ensures
compatible (pointwise k p) (Map.upd m0 key v1)
(Map.upd full_m0 key full_v1))
= compatible_pointwise p m0 full_m0;
assert (compatible p (Map.sel m0 key) (Map.sel full_m0 key));
let m1 = (Map.upd m0 key v1) in
let full_m1 = (Map.upd full_m0 key full_v1) in
let p' = pointwise k p in
eliminate exists (frame_m0:_). composable p' m0 frame_m0 /\ op p' frame_m0 m0 == full_m0
returns _
with _. (
eliminate exists (frame0:_). composable p v1 frame0 /\ op p frame0 v1 == full_v1
returns _
with _. (
introduce exists (frame:_).
composable p' m1 frame /\ op p' frame m1 == full_m1
with (Map.upd frame_m0 key frame0)
and (
let w = Map.upd frame_m0 key frame0 in
assert (Map.equal (compose_maps p w m1) full_m1)
)))
/// If any frame composes with [v0] to produce [full_v0]
/// can also be composed with [v1] to produce [full_v1]
///
/// Then any frame composable with a map contains [v0] yielding a map
/// containing [full_v0], is also composable with a map containing | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: FStar.PCM.pcm a ->
m0: Pulse.Lib.PCM.Map.map k a ->
full_m0: Pulse.Lib.PCM.Map.map k a ->
v1: a ->
full_v1: a ->
key: k
-> FStar.Pervasives.Lemma
(requires
(let v0 = FStar.Map.sel m0 key in
let full_v0 = FStar.Map.sel full_m0 key in
let m1 = FStar.Map.upd m0 key v1 in
let full_m1 = FStar.Map.upd full_m0 key full_v1 in
forall (frame: a{FStar.PCM.composable p v0 frame}).
{:pattern FStar.PCM.composable p v0 frame}
FStar.PCM.composable p v1 frame /\
(FStar.PCM.op p v0 frame == full_v0 ==> FStar.PCM.op p v1 frame == full_v1)))
(ensures
(let v0 = FStar.Map.sel m0 key in
let full_v0 = FStar.Map.sel full_m0 key in
let m1 = FStar.Map.upd m0 key v1 in
let full_m1 = FStar.Map.upd full_m0 key full_v1 in
let p' = Pulse.Lib.PCM.Map.pointwise k p in
forall (frame: Pulse.Lib.PCM.Map.map k a {FStar.PCM.composable p' m0 frame}).
FStar.PCM.composable p' m1 frame /\
(FStar.PCM.op p' m0 frame == full_m0 ==> FStar.PCM.op p' m1 frame == full_m1))) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"Pulse.Lib.PCM.Map.map",
"FStar.Classical.Sugar.forall_intro",
"FStar.PCM.composable",
"Prims.l_and",
"Prims.l_imp",
"Prims.eq2",
"FStar.PCM.op",
"FStar.Map.t",
"FStar.Classical.Sugar.and_intro",
"Prims.squash",
"Prims.unit",
"FStar.Classical.Sugar.implies_intro",
"Prims._assert",
"FStar.Map.equal",
"Pulse.Lib.PCM.Map.compose_maps",
"Pulse.Lib.PCM.Map.pointwise",
"FStar.Map.upd",
"FStar.Map.sel",
"Prims.l_Forall",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let lift_frame_preservation
#a
(#k: eqtype)
(p: pcm a)
(m0: map k a)
(full_m0: map k a)
(v1: a)
(full_v1: a)
(key: k)
: Lemma
(requires
(let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
(forall (frame: a{composable p v0 frame}). {:pattern composable p v0 frame}
composable p v1 frame /\ (op p v0 frame == full_v0 ==> op p v1 frame == full_v1))))
(ensures
(let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
let p' = pointwise k p in
(forall (frame: _{composable p' m0 frame}).
composable p' m1 frame /\ (op p' m0 frame == full_m0 ==> op p' m1 frame == full_m1)))) =
| let v0 = Map.sel m0 key in
let full_v0 = Map.sel full_m0 key in
let m1 = Map.upd m0 key v1 in
let full_m1 = Map.upd full_m0 key full_v1 in
let p' = pointwise k p in
introduce forall (frame: _{composable p' m0 frame}) . composable p' m1 frame /\
(op p' m0 frame == full_m0 ==> op p' m1 frame == full_m1)
with (introduce _ /\ _
with ()
and (introduce _ ==> _
with _. (assert ((compose_maps p m1 frame) `Map.equal` full_m1)))) | false |
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.is_unit | val is_unit (#k #a: _) (p: pcm a) (m: map k a)
: Lemma
(composable_maps p (Map.const p.p.one) m /\ (compose_maps p (Map.const p.p.one) m) `Map.equal` m /\
(compose_maps p m (Map.const p.p.one)) `Map.equal` m) | val is_unit (#k #a: _) (p: pcm a) (m: map k a)
: Lemma
(composable_maps p (Map.const p.p.one) m /\ (compose_maps p (Map.const p.p.one) m) `Map.equal` m /\
(compose_maps p m (Map.const p.p.one)) `Map.equal` m) | let is_unit #k #a (p:pcm a) (m:map k a)
: Lemma (composable_maps p (Map.const p.p.one) m /\
compose_maps p (Map.const p.p.one) m `Map.equal` m /\
compose_maps p m (Map.const p.p.one) `Map.equal` m)
= introduce forall k. composable p p.p.one (Map.sel m k)
with (
p.is_unit (Map.sel m k)
);
introduce forall k. Map.sel (compose_maps p (Map.const p.p.one) m) k == Map.sel m k /\
Map.sel (compose_maps p m (Map.const p.p.one)) k == Map.sel m k
with (
p.is_unit (Map.sel m k);
p.comm p.p.one (Map.sel m k)
) | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 6,
"end_line": 156,
"start_col": 0,
"start_line": 143
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= ()
/// Composition is commutative
let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10)
/// Composability is left-associative
let composable_maps_assoc_l #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m0 key) (Map.sel m1 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m01 = compose_maps p m0 m1 in
introduce forall key.
composable p (Map.sel m01 key) (Map.sel m2 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal
(compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2)))
/// Composability is right-associative
let composable_maps_assoc_r #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2)
(ensures
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2) /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m1 key) (Map.sel m2 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m12 = compose_maps p m1 m2 in
introduce forall key.
composable p (Map.sel m0 key) (Map.sel m12 key)
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p (compose_maps p m0 m1) m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc_r (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal m012 m012')
/// The core of the constructed PCM
/// The unit is just the pointwise unit
let pcm'_map_of_pcm (#a:_) (k:eqtype) (p:pcm a)
: pcm' (map k a)
= {
composable = composable_maps p;
op = compose_maps p;
one = Map.const p.p.one
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: FStar.PCM.pcm a -> m: Pulse.Lib.PCM.Map.map k a
-> FStar.Pervasives.Lemma
(ensures
Pulse.Lib.PCM.Map.composable_maps p (FStar.Map.const (Mkpcm'?.one (Mkpcm?.p p))) m /\
FStar.Map.equal (Pulse.Lib.PCM.Map.compose_maps p
(FStar.Map.const (Mkpcm'?.one (Mkpcm?.p p)))
m)
m /\
FStar.Map.equal (Pulse.Lib.PCM.Map.compose_maps p
m
(FStar.Map.const (Mkpcm'?.one (Mkpcm?.p p))))
m) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"Pulse.Lib.PCM.Map.map",
"FStar.Classical.Sugar.forall_intro",
"Prims.l_and",
"Prims.eq2",
"FStar.Map.sel",
"Pulse.Lib.PCM.Map.compose_maps",
"FStar.Map.const",
"FStar.PCM.__proj__Mkpcm'__item__one",
"FStar.PCM.__proj__Mkpcm__item__p",
"FStar.PCM.__proj__Mkpcm__item__comm",
"Prims.unit",
"FStar.PCM.__proj__Mkpcm__item__is_unit",
"Prims.squash",
"FStar.PCM.composable",
"Prims.l_True",
"Pulse.Lib.PCM.Map.composable_maps",
"FStar.Map.equal",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let is_unit #k #a (p: pcm a) (m: map k a)
: Lemma
(composable_maps p (Map.const p.p.one) m /\ (compose_maps p (Map.const p.p.one) m) `Map.equal` m /\
(compose_maps p m (Map.const p.p.one)) `Map.equal` m) =
| introduce forall k . composable p p.p.one (Map.sel m k)
with (p.is_unit (Map.sel m k));
introduce forall k . Map.sel (compose_maps p (Map.const p.p.one) m) k == Map.sel m k /\
Map.sel (compose_maps p m (Map.const p.p.one)) k == Map.sel m k
with (p.is_unit (Map.sel m k);
p.comm p.p.one (Map.sel m k)) | false |
FStar.UInt128.fst | FStar.UInt128.carry_bv | val carry_bv : a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64 -> FStar.BV.bv_t 64 | let carry_bv (a b: uint_t 64) =
bvshr (bvxor (int2bv a)
(bvor (bvxor (int2bv a) (int2bv b)) (bvxor (bvsub (int2bv a) (int2bv b)) (int2bv b))))
63 | {
"file_name": "ulib/FStar.UInt128.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 12,
"end_line": 55,
"start_col": 0,
"start_line": 52
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt128
open FStar.Mul
module UInt = FStar.UInt
module Seq = FStar.Seq
module BV = FStar.BitVector
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
open FStar.BV
open FStar.Tactics.V2
module T = FStar.Tactics.V2
module TBV = FStar.Tactics.BV
#set-options "--max_fuel 0 --max_ifuel 0 --split_queries no"
#set-options "--using_facts_from '*,-FStar.Tactics,-FStar.Reflection'"
(* TODO: explain why exactly this is needed? It leads to failures in
HACL* otherwise, claiming that some functions are not Low*. *)
#set-options "--normalize_pure_terms_for_extraction"
[@@ noextract_to "krml"]
noextract
let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63
[@@ noextract_to "krml"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.BV.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Calc.fsti.checked",
"FStar.BV.fsti.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt128.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.BV",
"short_module": "TBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BV",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.BitVector",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64 -> FStar.BV.bv_t 64 | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt.uint_t",
"FStar.BV.bvshr",
"FStar.BV.bvxor",
"FStar.BV.int2bv",
"FStar.BV.bvor",
"FStar.BV.bvsub",
"FStar.BV.bv_t"
] | [] | false | false | false | false | false | let carry_bv (a b: uint_t 64) =
| bvshr (bvxor (int2bv a)
(bvor (bvxor (int2bv a) (int2bv b)) (bvxor (bvsub (int2bv a) (int2bv b)) (int2bv b))))
63 | false |
|
Pulse.Lib.PCM.Map.fst | Pulse.Lib.PCM.Map.composable_maps_assoc_l | val composable_maps_assoc_l (#k #a: _) (p: pcm a) (m0 m1 m2: map k a)
: Lemma (requires composable_maps p m1 m2 /\ composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\ composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 == compose_maps p m0 (compose_maps p m1 m2)) | val composable_maps_assoc_l (#k #a: _) (p: pcm a) (m0 m1 m2: map k a)
: Lemma (requires composable_maps p m1 m2 /\ composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\ composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 == compose_maps p m0 (compose_maps p m1 m2)) | let composable_maps_assoc_l #k #a
(p:pcm a)
(m0 m1 m2: map k a)
: Lemma
(requires
composable_maps p m1 m2 /\
composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\
composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 ==
compose_maps p m0 (compose_maps p m1 m2))
= introduce forall key.
composable p (Map.sel m0 key) (Map.sel m1 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m01 = compose_maps p m0 m1 in
introduce forall key.
composable p (Map.sel m01 key) (Map.sel m2 key)
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key.
Map.sel m012 key == Map.sel m012' key
with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );
assert (Map.equal
(compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2))) | {
"file_name": "share/steel/examples/pulse/lib/Pulse.Lib.PCM.Map.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 60,
"end_line": 103,
"start_col": 0,
"start_line": 77
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: N. Swamy
*)
module Pulse.Lib.PCM.Map
(** Given a PCM on [p:pcm a] and a key type [k:eqtype], this module
builds a [pcm (map k a)] by lifting [p] pointwise. It also lifts
frame-preserving updates on [p] to frame-preserving updates on
entries of the map. **)
open FStar.Map
open FStar.PCM
module Map = FStar.Map
/// The carrier type of our constructed PCM
///
/// -- FStar.Map comes with a notion of domain that we don't need here
/// So, we'll just worked with maps whose domain is always
/// universal.
let map (k:eqtype) (v:Type) =
m:Map.t k v {
Map.domain m `Set.equal` Set.complement Set.empty
}
/// Maps are composable if they are composable pointwise
let composable_maps (#a:_)
(#k:eqtype)
(p:pcm a)
(m0 m1: map k a)
: prop
= forall k. Map.sel m0 k `composable p` Map.sel m1 k
/// Compose maps pointwise
let compose_maps (#a:_) (#k:eqtype)
(p:pcm a)
(m0:map k a)
(m1:map k a { composable_maps p m0 m1 })
: map k a
= Map.map_literal (fun k ->
Map.sel m0 k `op p` Map.sel m1 k)
/// Composability is commutative
let composable_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma (composable_maps p m0 m1 <==>
composable_maps p m1 m0)
= ()
/// Composition is commutative
let compose_maps_comm #k #a
(p:pcm a)
(m0 m1: map k a)
: Lemma
(requires composable_maps p m0 m1)
(ensures compose_maps p m0 m1 == compose_maps p m1 m0)
= let m01 = compose_maps p m0 m1 in
let m10 = compose_maps p m1 m0 in
introduce forall key.
Map.sel m01 key == Map.sel m10 key
with ( p.comm (Map.sel m0 key) (Map.sel m1 key) );
assert (Map.equal m01 m10) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Map.fsti.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.Sugar.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Lib.PCM.Map.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Map",
"short_module": "Map"
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Lib.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: FStar.PCM.pcm a ->
m0: Pulse.Lib.PCM.Map.map k a ->
m1: Pulse.Lib.PCM.Map.map k a ->
m2: Pulse.Lib.PCM.Map.map k a
-> FStar.Pervasives.Lemma
(requires
Pulse.Lib.PCM.Map.composable_maps p m1 m2 /\
Pulse.Lib.PCM.Map.composable_maps p m0 (Pulse.Lib.PCM.Map.compose_maps p m1 m2))
(ensures
Pulse.Lib.PCM.Map.composable_maps p m0 m1 /\
Pulse.Lib.PCM.Map.composable_maps p (Pulse.Lib.PCM.Map.compose_maps p m0 m1) m2 /\
Pulse.Lib.PCM.Map.compose_maps p (Pulse.Lib.PCM.Map.compose_maps p m0 m1) m2 ==
Pulse.Lib.PCM.Map.compose_maps p m0 (Pulse.Lib.PCM.Map.compose_maps p m1 m2)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.eqtype",
"FStar.PCM.pcm",
"Pulse.Lib.PCM.Map.map",
"Prims._assert",
"FStar.Map.equal",
"Pulse.Lib.PCM.Map.compose_maps",
"Prims.unit",
"FStar.Classical.Sugar.forall_intro",
"Prims.eq2",
"FStar.Map.sel",
"FStar.PCM.__proj__Mkpcm__item__assoc",
"Prims.squash",
"FStar.PCM.composable",
"Prims.l_and",
"Pulse.Lib.PCM.Map.composable_maps",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let composable_maps_assoc_l #k #a (p: pcm a) (m0: map k a) (m1: map k a) (m2: map k a)
: Lemma (requires composable_maps p m1 m2 /\ composable_maps p m0 (compose_maps p m1 m2))
(ensures
composable_maps p m0 m1 /\ composable_maps p (compose_maps p m0 m1) m2 /\
compose_maps p (compose_maps p m0 m1) m2 == compose_maps p m0 (compose_maps p m1 m2)) =
| introduce forall key . composable p (Map.sel m0 key) (Map.sel m1 key)
with (p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key));
let m01 = compose_maps p m0 m1 in
introduce forall key . composable p (Map.sel m01 key) (Map.sel m2 key)
with (p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key));
let m012 = compose_maps p m01 m2 in
let m012' = compose_maps p m0 (compose_maps p m1 m2) in
introduce forall key . Map.sel m012 key == Map.sel m012' key
with (p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key));
assert (Map.equal (compose_maps p (compose_maps p m0 m1) m2)
(compose_maps p m0 (compose_maps p m1 m2))) | false |
FStar.UInt128.fst | FStar.UInt128.carry_uint64 | val carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) | val carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) | let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63 | {
"file_name": "ulib/FStar.UInt128.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 44,
"end_line": 48,
"start_col": 0,
"start_line": 43
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt128
open FStar.Mul
module UInt = FStar.UInt
module Seq = FStar.Seq
module BV = FStar.BitVector
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
open FStar.BV
open FStar.Tactics.V2
module T = FStar.Tactics.V2
module TBV = FStar.Tactics.BV
#set-options "--max_fuel 0 --max_ifuel 0 --split_queries no"
#set-options "--using_facts_from '*,-FStar.Tactics,-FStar.Reflection'"
(* TODO: explain why exactly this is needed? It leads to failures in
HACL* otherwise, claiming that some functions are not Low*. *)
#set-options "--normalize_pure_terms_for_extraction"
[@@ noextract_to "krml"] | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.BV.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Calc.fsti.checked",
"FStar.BV.fsti.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt128.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.BV",
"short_module": "TBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BV",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.BitVector",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64 -> FStar.UInt.uint_t 64 | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt.uint_t",
"Prims.nat",
"FStar.UInt.shift_right",
"FStar.UInt.sub_mod",
"FStar.UInt.logor",
"FStar.UInt.logxor"
] | [] | false | false | false | false | false | let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
| let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63 | false |
Hacl.Bignum4096_32.fsti | Hacl.Bignum4096_32.lbignum | val lbignum : t: Hacl.Bignum.Definitions.limb_t -> len: Lib.IntTypes.size_t -> Type0 | let lbignum = Hacl.Bignum.Definitions.lbignum | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 28,
"start_col": 0,
"start_line": 28
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BS = Hacl.Bignum.SafeAPI
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
inline_for_extraction noextract
let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U32
inline_for_extraction noextract
let n_limbs: BN.meta_len t_limbs = 128ul
inline_for_extraction noextract
let n_bytes = n_limbs `FStar.UInt32.mul` 4ul
// A static assert that the number of bytes vs number of blocks matches. This is
// important for bn_to_bytes_be which takes a number of bytes, not a number of
// limbs. (It would be nice to fix this.)
let _ = assert_norm (Hacl.Bignum.Definitions.blocks n_bytes 4ul = n_limbs)
let _ = assert_norm (4096ul = Lib.IntTypes.(size (bits t_limbs)) `FStar.UInt32.mul` n_limbs) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.SafeAPI.fst.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum4096_32.fsti"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | t: Hacl.Bignum.Definitions.limb_t -> len: Lib.IntTypes.size_t -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Bignum.Definitions.lbignum"
] | [] | false | false | false | true | true | let lbignum =
| Hacl.Bignum.Definitions.lbignum | false |
|
Hacl.Bignum4096_32.fsti | Hacl.Bignum4096_32.t_limbs | val t_limbs:Hacl.Bignum.Definitions.limb_t | val t_limbs:Hacl.Bignum.Definitions.limb_t | let t_limbs: Hacl.Bignum.Definitions.limb_t = Lib.IntTypes.U32 | {
"file_name": "code/bignum/Hacl.Bignum4096_32.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 62,
"end_line": 12,
"start_col": 0,
"start_line": 12
} | module Hacl.Bignum4096_32
open FStar.Mul
module BN = Hacl.Bignum
module BS = Hacl.Bignum.SafeAPI
module MA = Hacl.Bignum.MontArithmetic
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Bignum.SafeAPI.fst.checked",
"Hacl.Bignum.MontArithmetic.fsti.checked",
"Hacl.Bignum.Definitions.fst.checked",
"Hacl.Bignum.Convert.fst.checked",
"Hacl.Bignum.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Bignum4096_32.fsti"
} | [
{
"abbrev": true,
"full_module": "Hacl.Bignum.MontArithmetic",
"short_module": "MA"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum.SafeAPI",
"short_module": "BS"
},
{
"abbrev": true,
"full_module": "Hacl.Bignum",
"short_module": "BN"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Bignum.Definitions.limb_t | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.U32"
] | [] | false | false | false | true | false | let t_limbs:Hacl.Bignum.Definitions.limb_t =
| Lib.IntTypes.U32 | false |
FStar.UInt128.fst | FStar.UInt128.constant_time_carry | val constant_time_carry (a b: U64.t) : Tot U64.t | val constant_time_carry (a b: U64.t) : Tot U64.t | let constant_time_carry (a b: U64.t) : Tot U64.t =
let open U64 in
// CONSTANT_TIME_CARRY macro
// ((a ^ ((a ^ b) | ((a - b) ^ b))) >> (sizeof(a) * 8 - 1))
// 63 = sizeof(a) * 8 - 1
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63ul | {
"file_name": "ulib/FStar.UInt128.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 103,
"start_col": 0,
"start_line": 98
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt128
open FStar.Mul
module UInt = FStar.UInt
module Seq = FStar.Seq
module BV = FStar.BitVector
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
open FStar.BV
open FStar.Tactics.V2
module T = FStar.Tactics.V2
module TBV = FStar.Tactics.BV
#set-options "--max_fuel 0 --max_ifuel 0 --split_queries no"
#set-options "--using_facts_from '*,-FStar.Tactics,-FStar.Reflection'"
(* TODO: explain why exactly this is needed? It leads to failures in
HACL* otherwise, claiming that some functions are not Low*. *)
#set-options "--normalize_pure_terms_for_extraction"
[@@ noextract_to "krml"]
noextract
let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63
[@@ noextract_to "krml"]
noextract
let carry_bv (a b: uint_t 64) =
bvshr (bvxor (int2bv a)
(bvor (bvxor (int2bv a) (int2bv b)) (bvxor (bvsub (int2bv a) (int2bv b)) (int2bv b))))
63
let carry_uint64_ok (a b:uint_t 64)
: squash (int2bv (carry_uint64 a b) == carry_bv a b)
= _ by (T.norm [delta_only [`%carry_uint64]; unascribe];
let open FStar.Tactics.BV in
mapply (`trans);
arith_to_bv_tac ();
arith_to_bv_tac ();
T.norm [delta_only [`%carry_bv]];
trefl())
let fact1 (a b: uint_t 64) = carry_bv a b == int2bv 1
let fact0 (a b: uint_t 64) = carry_bv a b == int2bv 0
let lem_ult_1 (a b: uint_t 64)
: squash (bvult (int2bv a) (int2bv b) ==> fact1 a b)
= assert (bvult (int2bv a) (int2bv b) ==> fact1 a b)
by (T.norm [delta_only [`%fact1;`%carry_bv]];
set_options "--smtencoding.elim_box true --using_facts_from '__Nothing__' --z3smtopt '(set-option :smt.case_split 1)'";
smt())
let lem_ult_2 (a b:uint_t 64)
: squash (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b)
= assert (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b)
by (T.norm [delta_only [`%fact0;`%carry_bv]];
set_options "--smtencoding.elim_box true --using_facts_from '__Nothing__' --z3smtopt '(set-option :smt.case_split 1)'")
let int2bv_ult (#n: pos) (a b: uint_t n)
: Lemma (ensures a < b <==> bvult #n (int2bv #n a) (int2bv #n b))
= introduce (a < b) ==> (bvult #n (int2bv #n a) (int2bv #n b))
with _ . FStar.BV.int2bv_lemma_ult_1 a b;
introduce (bvult #n (int2bv #n a) (int2bv #n b)) ==> (a < b)
with _ . FStar.BV.int2bv_lemma_ult_2 a b
let lem_ult (a b:uint_t 64)
: Lemma (if a < b
then fact1 a b
else fact0 a b)
= int2bv_ult a b;
lem_ult_1 a b;
lem_ult_2 a b | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.BV.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Calc.fsti.checked",
"FStar.BV.fsti.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt128.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.BV",
"short_module": "TBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BV",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.BitVector",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt64.t -> b: FStar.UInt64.t -> FStar.UInt64.t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt64.t",
"FStar.UInt64.op_Greater_Greater_Hat",
"FStar.UInt64.op_Hat_Hat",
"FStar.UInt64.op_Bar_Hat",
"FStar.UInt64.op_Subtraction_Percent_Hat",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | true | false | let constant_time_carry (a b: U64.t) : Tot U64.t =
| let open U64 in a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63ul | false |
Hacl.HPKE.Curve51_CP128_SHA512.fsti | Hacl.HPKE.Curve51_CP128_SHA512.cs | val cs:S.ciphersuite | val cs:S.ciphersuite | let cs:S.ciphersuite = (DH.DH_Curve25519, Hash.SHA2_256, S.Seal AEAD.CHACHA20_POLY1305, Hash.SHA2_512) | {
"file_name": "code/hpke/Hacl.HPKE.Curve51_CP128_SHA512.fsti",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 102,
"end_line": 10,
"start_col": 0,
"start_line": 10
} | module Hacl.HPKE.Curve51_CP128_SHA512
open Hacl.Impl.HPKE
module S = Spec.Agile.HPKE
module DH = Spec.Agile.DH
module AEAD = Spec.Agile.AEAD
module Hash = Spec.Agile.Hash | {
"checked_file": "/",
"dependencies": [
"Spec.Agile.HPKE.fsti.checked",
"Spec.Agile.Hash.fsti.checked",
"Spec.Agile.DH.fst.checked",
"Spec.Agile.AEAD.fsti.checked",
"prims.fst.checked",
"Hacl.Impl.HPKE.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.HPKE.Curve51_CP128_SHA512.fsti"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Hash"
},
{
"abbrev": true,
"full_module": "Spec.Agile.AEAD",
"short_module": "AEAD"
},
{
"abbrev": true,
"full_module": "Spec.Agile.DH",
"short_module": "DH"
},
{
"abbrev": true,
"full_module": "Spec.Agile.HPKE",
"short_module": "S"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.HPKE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Spec.Agile.HPKE.ciphersuite | Prims.Tot | [
"total"
] | [] | [
"FStar.Pervasives.Native.Mktuple4",
"Spec.Agile.DH.algorithm",
"Spec.Agile.HPKE.hash_algorithm",
"Spec.Agile.HPKE.aead",
"Spec.Hash.Definitions.hash_alg",
"Spec.Agile.DH.DH_Curve25519",
"Spec.Hash.Definitions.SHA2_256",
"Spec.Agile.HPKE.Seal",
"Spec.Agile.AEAD.CHACHA20_POLY1305",
"Spec.Hash.Definitions.SHA2_512"
] | [] | false | false | false | true | false | let cs:S.ciphersuite =
| (DH.DH_Curve25519, Hash.SHA2_256, S.Seal AEAD.CHACHA20_POLY1305, Hash.SHA2_512) | false |
FStar.UInt128.fst | FStar.UInt128.sub_mod_impl | val sub_mod_impl (a b: t) : t | val sub_mod_impl (a b: t) : t | let sub_mod_impl (a b: t) : t =
let l = U64.sub_mod a.low b.low in
{ low = l;
high = U64.sub_mod (U64.sub_mod a.high b.high) (carry a.low l); } | {
"file_name": "ulib/FStar.UInt128.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 69,
"end_line": 302,
"start_col": 0,
"start_line": 299
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt128
open FStar.Mul
module UInt = FStar.UInt
module Seq = FStar.Seq
module BV = FStar.BitVector
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
open FStar.BV
open FStar.Tactics.V2
module T = FStar.Tactics.V2
module TBV = FStar.Tactics.BV
#set-options "--max_fuel 0 --max_ifuel 0 --split_queries no"
#set-options "--using_facts_from '*,-FStar.Tactics,-FStar.Reflection'"
(* TODO: explain why exactly this is needed? It leads to failures in
HACL* otherwise, claiming that some functions are not Low*. *)
#set-options "--normalize_pure_terms_for_extraction"
[@@ noextract_to "krml"]
noextract
let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63
[@@ noextract_to "krml"]
noextract
let carry_bv (a b: uint_t 64) =
bvshr (bvxor (int2bv a)
(bvor (bvxor (int2bv a) (int2bv b)) (bvxor (bvsub (int2bv a) (int2bv b)) (int2bv b))))
63
let carry_uint64_ok (a b:uint_t 64)
: squash (int2bv (carry_uint64 a b) == carry_bv a b)
= _ by (T.norm [delta_only [`%carry_uint64]; unascribe];
let open FStar.Tactics.BV in
mapply (`trans);
arith_to_bv_tac ();
arith_to_bv_tac ();
T.norm [delta_only [`%carry_bv]];
trefl())
let fact1 (a b: uint_t 64) = carry_bv a b == int2bv 1
let fact0 (a b: uint_t 64) = carry_bv a b == int2bv 0
let lem_ult_1 (a b: uint_t 64)
: squash (bvult (int2bv a) (int2bv b) ==> fact1 a b)
= assert (bvult (int2bv a) (int2bv b) ==> fact1 a b)
by (T.norm [delta_only [`%fact1;`%carry_bv]];
set_options "--smtencoding.elim_box true --using_facts_from '__Nothing__' --z3smtopt '(set-option :smt.case_split 1)'";
smt())
let lem_ult_2 (a b:uint_t 64)
: squash (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b)
= assert (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b)
by (T.norm [delta_only [`%fact0;`%carry_bv]];
set_options "--smtencoding.elim_box true --using_facts_from '__Nothing__' --z3smtopt '(set-option :smt.case_split 1)'")
let int2bv_ult (#n: pos) (a b: uint_t n)
: Lemma (ensures a < b <==> bvult #n (int2bv #n a) (int2bv #n b))
= introduce (a < b) ==> (bvult #n (int2bv #n a) (int2bv #n b))
with _ . FStar.BV.int2bv_lemma_ult_1 a b;
introduce (bvult #n (int2bv #n a) (int2bv #n b)) ==> (a < b)
with _ . FStar.BV.int2bv_lemma_ult_2 a b
let lem_ult (a b:uint_t 64)
: Lemma (if a < b
then fact1 a b
else fact0 a b)
= int2bv_ult a b;
lem_ult_1 a b;
lem_ult_2 a b
let constant_time_carry (a b: U64.t) : Tot U64.t =
let open U64 in
// CONSTANT_TIME_CARRY macro
// ((a ^ ((a ^ b) | ((a - b) ^ b))) >> (sizeof(a) * 8 - 1))
// 63 = sizeof(a) * 8 - 1
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63ul
let carry_uint64_equiv (a b:UInt64.t)
: Lemma (U64.v (constant_time_carry a b) == carry_uint64 (U64.v a) (U64.v b))
= ()
// This type gets a special treatment in KaRaMeL and its definition is never
// printed in the resulting C file.
type uint128: Type0 = { low: U64.t; high: U64.t }
let t = uint128
let _ = intro_ambient n
let _ = intro_ambient t
[@@ noextract_to "krml"]
let v x = U64.v x.low + (U64.v x.high) * (pow2 64)
let div_mod (x:nat) (k:nat{k > 0}) : Lemma (x / k * k + x % k == x) = ()
let uint_to_t x =
div_mod x (pow2 64);
{ low = U64.uint_to_t (x % (pow2 64));
high = U64.uint_to_t (x / (pow2 64)); }
let v_inj (x1 x2: t): Lemma (requires (v x1 == v x2))
(ensures x1 == x2) =
assert (uint_to_t (v x1) == uint_to_t (v x2));
assert (uint_to_t (v x1) == x1);
assert (uint_to_t (v x2) == x2);
()
(* A weird helper used below... seems like the native encoding of
bitvectors may be making these proofs much harder than they should be? *)
let bv2int_fun (#n:pos) (a b : bv_t n)
: Lemma (requires a == b)
(ensures bv2int a == bv2int b)
= ()
(* This proof is quite brittle. It has a bunch of annotations to get
decent verification performance. *)
let constant_time_carry_ok (a b:U64.t)
: Lemma (constant_time_carry a b ==
(if U64.lt a b then U64.uint_to_t 1 else U64.uint_to_t 0))
= calc (==) {
U64.v (constant_time_carry a b);
(==) { carry_uint64_equiv a b }
carry_uint64 (U64.v a) (U64.v b);
(==) { inverse_num_lemma (carry_uint64 (U64.v a) (U64.v b)) }
bv2int (int2bv (carry_uint64 (U64.v a) (U64.v b)));
(==) { carry_uint64_ok (U64.v a) (U64.v b);
bv2int_fun (int2bv (carry_uint64 (U64.v a) (U64.v b))) (carry_bv (U64.v a) (U64.v b));
()
}
bv2int (carry_bv (U64.v a) (U64.v b));
(==) {
lem_ult (U64.v a) (U64.v b);
bv2int_fun (carry_bv (U64.v a) (U64.v b)) (if U64.v a < U64.v b then int2bv 1 else int2bv 0)
}
bv2int
(if U64.v a < U64.v b
then int2bv 1
else int2bv 0);
};
assert (
bv2int (if U64.v a < U64.v b then int2bv 1 else int2bv 0)
== U64.v (if U64.lt a b then U64.uint_to_t 1 else U64.uint_to_t 0)) by (T.norm []);
U64.v_inj (constant_time_carry a b) (if U64.lt a b then U64.uint_to_t 1 else U64.uint_to_t 0)
let carry (a b: U64.t) : Pure U64.t
(requires True)
(ensures (fun r -> U64.v r == (if U64.v a < U64.v b then 1 else 0))) =
constant_time_carry_ok a b;
constant_time_carry a b
let carry_sum_ok (a b:U64.t) :
Lemma (U64.v (carry (U64.add_mod a b) b) == (U64.v a + U64.v b) / (pow2 64)) = ()
let add (a b: t) : Pure t
(requires (v a + v b < pow2 128))
(ensures (fun r -> v a + v b = v r)) =
let l = U64.add_mod a.low b.low in
carry_sum_ok a.low b.low;
{ low = l;
high = U64.add (U64.add a.high b.high) (carry l b.low); }
let add_underspec (a b: t) =
let l = U64.add_mod a.low b.low in
begin
if v a + v b < pow2 128
then carry_sum_ok a.low b.low
else ()
end;
{ low = l;
high = U64.add_underspec (U64.add_underspec a.high b.high) (carry l b.low); }
val mod_mod: a:nat -> k:nat{k>0} -> k':nat{k'>0} ->
Lemma ((a % k) % (k'*k) == a % k)
let mod_mod a k k' =
assert (a % k < k);
assert (a % k < k' * k)
let mod_spec (a:nat) (k:nat{k > 0}) :
Lemma (a % k == a - a / k * k) = ()
val div_product : n:nat -> m1:nat{m1>0} -> m2:nat{m2>0} ->
Lemma (n / (m1*m2) == (n / m1) / m2)
let div_product n m1 m2 =
Math.division_multiplication_lemma n m1 m2
val mul_div_cancel : n:nat -> k:nat{k>0} ->
Lemma ((n * k) / k == n)
let mul_div_cancel n k =
Math.cancel_mul_div n k
val mod_mul: n:nat -> k1:pos -> k2:pos ->
Lemma ((n % k2) * k1 == (n * k1) % (k1*k2))
let mod_mul n k1 k2 =
Math.modulo_scale_lemma n k1 k2
let mod_spec_rew_n (n:nat) (k:nat{k > 0}) :
Lemma (n == n / k * k + n % k) = mod_spec n k
val mod_add: n1:nat -> n2:nat -> k:nat{k > 0} ->
Lemma ((n1 % k + n2 % k) % k == (n1 + n2) % k)
let mod_add n1 n2 k = Math.modulo_distributivity n1 n2 k
val mod_add_small: n1:nat -> n2:nat -> k:nat{k > 0} -> Lemma
(requires (n1 % k + n2 % k < k))
(ensures (n1 % k + n2 % k == (n1 + n2) % k))
let mod_add_small n1 n2 k =
mod_add n1 n2 k;
Math.small_modulo_lemma_1 (n1%k + n2%k) k
// This proof is pretty stable with the calc proof, but it can fail
// ~1% of the times, so add a retry.
#push-options "--split_queries no --z3rlimit 20 --retry 5"
let add_mod (a b: t) : Pure t
(requires True)
(ensures (fun r -> (v a + v b) % pow2 128 = v r)) =
let l = U64.add_mod a.low b.low in
let r = { low = l;
high = U64.add_mod (U64.add_mod a.high b.high) (carry l b.low)} in
let a_l = U64.v a.low in
let a_h = U64.v a.high in
let b_l = U64.v b.low in
let b_h = U64.v b.high in
carry_sum_ok a.low b.low;
Math.lemma_mod_plus_distr_l (a_h + b_h) ((a_l + b_l) / (pow2 64)) (pow2 64);
calc (==) {
U64.v r.high * pow2 64;
== {}
((a_h + b_h + (a_l + b_l) / (pow2 64)) % pow2 64) * pow2 64;
== { mod_mul (a_h + b_h + (a_l + b_l) / (pow2 64)) (pow2 64) (pow2 64) }
((a_h + b_h + (a_l + b_l) / (pow2 64)) * pow2 64) % (pow2 64 * pow2 64);
== {}
((a_h + b_h + (a_l + b_l)/(pow2 64)) * pow2 64)
% pow2 128;
== {}
(a_h * pow2 64 + b_h * pow2 64 + ((a_l + b_l)/(pow2 64)) * pow2 64)
% pow2 128;
};
assert (U64.v r.low == (U64.v r.low) % pow2 128);
mod_add_small (a_h * pow2 64 +
b_h * pow2 64 +
(a_l + b_l) / (pow2 64) * (pow2 64))
((a_l + b_l) % (pow2 64))
(pow2 128);
assert (U64.v r.low + U64.v r.high * pow2 64 ==
(a_h * pow2 64 +
b_h * pow2 64 +
(a_l + b_l) / (pow2 64) * (pow2 64) + (a_l + b_l) % (pow2 64)) % pow2 128);
mod_spec_rew_n (a_l + b_l) (pow2 64);
assert (v r ==
(a_h * pow2 64 +
b_h * pow2 64 +
a_l + b_l) % pow2 128);
assert_spinoff ((v a + v b) % pow2 128 = v r);
r
#pop-options
#push-options "--retry 5"
let sub (a b: t) : Pure t
(requires (v a - v b >= 0))
(ensures (fun r -> v r = v a - v b)) =
let l = U64.sub_mod a.low b.low in
{ low = l;
high = U64.sub (U64.sub a.high b.high) (carry a.low l); }
#pop-options
let sub_underspec (a b: t) =
let l = U64.sub_mod a.low b.low in
{ low = l;
high = U64.sub_underspec (U64.sub_underspec a.high b.high) (carry a.low l); } | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.BV.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Calc.fsti.checked",
"FStar.BV.fsti.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt128.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.BV",
"short_module": "TBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BV",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.BitVector",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt128.t -> b: FStar.UInt128.t -> FStar.UInt128.t | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt128.t",
"FStar.UInt128.Mkuint128",
"FStar.UInt64.sub_mod",
"FStar.UInt128.__proj__Mkuint128__item__high",
"FStar.UInt128.carry",
"FStar.UInt128.__proj__Mkuint128__item__low",
"FStar.UInt64.t"
] | [] | false | false | false | true | false | let sub_mod_impl (a b: t) : t =
| let l = U64.sub_mod a.low b.low in
{ low = l; high = U64.sub_mod (U64.sub_mod a.high b.high) (carry a.low l) } | false |
FStar.UInt128.fst | FStar.UInt128.lem_ult_2 | val lem_ult_2 (a b: uint_t 64) : squash (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b) | val lem_ult_2 (a b: uint_t 64) : squash (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b) | let lem_ult_2 (a b:uint_t 64)
: squash (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b)
= assert (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b)
by (T.norm [delta_only [`%fact0;`%carry_bv]];
set_options "--smtencoding.elim_box true --using_facts_from '__Nothing__' --z3smtopt '(set-option :smt.case_split 1)'") | {
"file_name": "ulib/FStar.UInt128.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 130,
"end_line": 81,
"start_col": 0,
"start_line": 77
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt128
open FStar.Mul
module UInt = FStar.UInt
module Seq = FStar.Seq
module BV = FStar.BitVector
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
open FStar.BV
open FStar.Tactics.V2
module T = FStar.Tactics.V2
module TBV = FStar.Tactics.BV
#set-options "--max_fuel 0 --max_ifuel 0 --split_queries no"
#set-options "--using_facts_from '*,-FStar.Tactics,-FStar.Reflection'"
(* TODO: explain why exactly this is needed? It leads to failures in
HACL* otherwise, claiming that some functions are not Low*. *)
#set-options "--normalize_pure_terms_for_extraction"
[@@ noextract_to "krml"]
noextract
let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63
[@@ noextract_to "krml"]
noextract
let carry_bv (a b: uint_t 64) =
bvshr (bvxor (int2bv a)
(bvor (bvxor (int2bv a) (int2bv b)) (bvxor (bvsub (int2bv a) (int2bv b)) (int2bv b))))
63
let carry_uint64_ok (a b:uint_t 64)
: squash (int2bv (carry_uint64 a b) == carry_bv a b)
= _ by (T.norm [delta_only [`%carry_uint64]; unascribe];
let open FStar.Tactics.BV in
mapply (`trans);
arith_to_bv_tac ();
arith_to_bv_tac ();
T.norm [delta_only [`%carry_bv]];
trefl())
let fact1 (a b: uint_t 64) = carry_bv a b == int2bv 1
let fact0 (a b: uint_t 64) = carry_bv a b == int2bv 0
let lem_ult_1 (a b: uint_t 64)
: squash (bvult (int2bv a) (int2bv b) ==> fact1 a b)
= assert (bvult (int2bv a) (int2bv b) ==> fact1 a b)
by (T.norm [delta_only [`%fact1;`%carry_bv]];
set_options "--smtencoding.elim_box true --using_facts_from '__Nothing__' --z3smtopt '(set-option :smt.case_split 1)'";
smt()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.BV.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Calc.fsti.checked",
"FStar.BV.fsti.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt128.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.BV",
"short_module": "TBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BV",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.BitVector",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64
-> Prims.squash (Prims.op_Negation (FStar.BV.bvult (FStar.BV.int2bv a) (FStar.BV.int2bv b)) ==>
FStar.UInt128.fact0 a b) | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt.uint_t",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_Negation",
"FStar.BV.bvult",
"FStar.BV.int2bv",
"FStar.UInt128.fact0",
"Prims.unit",
"FStar.Stubs.Tactics.V2.Builtins.set_options",
"FStar.Stubs.Tactics.V2.Builtins.norm",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta_only",
"Prims.string",
"Prims.Nil",
"Prims.squash"
] | [] | false | false | true | false | false | let lem_ult_2 (a b: uint_t 64) : squash (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b) =
| FStar.Tactics.Effect.assert_by_tactic (not (bvult (int2bv a) (int2bv b)) ==> fact0 a b)
(fun _ ->
();
(T.norm [delta_only [`%fact0; `%carry_bv]];
set_options "--smtencoding.elim_box true --using_facts_from '__Nothing__' --z3smtopt '(set-option :smt.case_split 1)'"
)) | false |
FStar.UInt128.fst | FStar.UInt128.fact0 | val fact0 : a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64 -> Prims.logical | let fact0 (a b: uint_t 64) = carry_bv a b == int2bv 0 | {
"file_name": "ulib/FStar.UInt128.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 53,
"end_line": 68,
"start_col": 0,
"start_line": 68
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt128
open FStar.Mul
module UInt = FStar.UInt
module Seq = FStar.Seq
module BV = FStar.BitVector
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
open FStar.BV
open FStar.Tactics.V2
module T = FStar.Tactics.V2
module TBV = FStar.Tactics.BV
#set-options "--max_fuel 0 --max_ifuel 0 --split_queries no"
#set-options "--using_facts_from '*,-FStar.Tactics,-FStar.Reflection'"
(* TODO: explain why exactly this is needed? It leads to failures in
HACL* otherwise, claiming that some functions are not Low*. *)
#set-options "--normalize_pure_terms_for_extraction"
[@@ noextract_to "krml"]
noextract
let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63
[@@ noextract_to "krml"]
noextract
let carry_bv (a b: uint_t 64) =
bvshr (bvxor (int2bv a)
(bvor (bvxor (int2bv a) (int2bv b)) (bvxor (bvsub (int2bv a) (int2bv b)) (int2bv b))))
63
let carry_uint64_ok (a b:uint_t 64)
: squash (int2bv (carry_uint64 a b) == carry_bv a b)
= _ by (T.norm [delta_only [`%carry_uint64]; unascribe];
let open FStar.Tactics.BV in
mapply (`trans);
arith_to_bv_tac ();
arith_to_bv_tac ();
T.norm [delta_only [`%carry_bv]];
trefl()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.BV.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Calc.fsti.checked",
"FStar.BV.fsti.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt128.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.BV",
"short_module": "TBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BV",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.BitVector",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64 -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt.uint_t",
"Prims.eq2",
"FStar.BV.bv_t",
"FStar.UInt128.carry_bv",
"FStar.BV.int2bv",
"Prims.logical"
] | [] | false | false | false | false | true | let fact0 (a b: uint_t 64) =
| carry_bv a b == int2bv 0 | false |
|
FStar.UInt128.fst | FStar.UInt128.lem_ult_1 | val lem_ult_1 (a b: uint_t 64) : squash (bvult (int2bv a) (int2bv b) ==> fact1 a b) | val lem_ult_1 (a b: uint_t 64) : squash (bvult (int2bv a) (int2bv b) ==> fact1 a b) | let lem_ult_1 (a b: uint_t 64)
: squash (bvult (int2bv a) (int2bv b) ==> fact1 a b)
= assert (bvult (int2bv a) (int2bv b) ==> fact1 a b)
by (T.norm [delta_only [`%fact1;`%carry_bv]];
set_options "--smtencoding.elim_box true --using_facts_from '__Nothing__' --z3smtopt '(set-option :smt.case_split 1)'";
smt()) | {
"file_name": "ulib/FStar.UInt128.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 75,
"start_col": 0,
"start_line": 70
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt128
open FStar.Mul
module UInt = FStar.UInt
module Seq = FStar.Seq
module BV = FStar.BitVector
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
open FStar.BV
open FStar.Tactics.V2
module T = FStar.Tactics.V2
module TBV = FStar.Tactics.BV
#set-options "--max_fuel 0 --max_ifuel 0 --split_queries no"
#set-options "--using_facts_from '*,-FStar.Tactics,-FStar.Reflection'"
(* TODO: explain why exactly this is needed? It leads to failures in
HACL* otherwise, claiming that some functions are not Low*. *)
#set-options "--normalize_pure_terms_for_extraction"
[@@ noextract_to "krml"]
noextract
let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63
[@@ noextract_to "krml"]
noextract
let carry_bv (a b: uint_t 64) =
bvshr (bvxor (int2bv a)
(bvor (bvxor (int2bv a) (int2bv b)) (bvxor (bvsub (int2bv a) (int2bv b)) (int2bv b))))
63
let carry_uint64_ok (a b:uint_t 64)
: squash (int2bv (carry_uint64 a b) == carry_bv a b)
= _ by (T.norm [delta_only [`%carry_uint64]; unascribe];
let open FStar.Tactics.BV in
mapply (`trans);
arith_to_bv_tac ();
arith_to_bv_tac ();
T.norm [delta_only [`%carry_bv]];
trefl())
let fact1 (a b: uint_t 64) = carry_bv a b == int2bv 1
let fact0 (a b: uint_t 64) = carry_bv a b == int2bv 0 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.BV.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Calc.fsti.checked",
"FStar.BV.fsti.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt128.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.BV",
"short_module": "TBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BV",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.BitVector",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64
-> Prims.squash (FStar.BV.bvult (FStar.BV.int2bv a) (FStar.BV.int2bv b) ==>
FStar.UInt128.fact1 a b) | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt.uint_t",
"FStar.Tactics.Effect.assert_by_tactic",
"Prims.l_imp",
"Prims.b2t",
"FStar.BV.bvult",
"FStar.BV.int2bv",
"FStar.UInt128.fact1",
"Prims.unit",
"FStar.Tactics.V2.Derived.smt",
"FStar.Stubs.Tactics.V2.Builtins.set_options",
"FStar.Stubs.Tactics.V2.Builtins.norm",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta_only",
"Prims.string",
"Prims.Nil",
"Prims.squash"
] | [] | false | false | true | false | false | let lem_ult_1 (a b: uint_t 64) : squash (bvult (int2bv a) (int2bv b) ==> fact1 a b) =
| FStar.Tactics.Effect.assert_by_tactic (bvult (int2bv a) (int2bv b) ==> fact1 a b)
(fun _ ->
();
(T.norm [delta_only [`%fact1; `%carry_bv]];
set_options "--smtencoding.elim_box true --using_facts_from '__Nothing__' --z3smtopt '(set-option :smt.case_split 1)'"
;
smt ())) | false |
FStar.UInt128.fst | FStar.UInt128.fact1 | val fact1 : a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64 -> Prims.logical | let fact1 (a b: uint_t 64) = carry_bv a b == int2bv 1 | {
"file_name": "ulib/FStar.UInt128.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 53,
"end_line": 67,
"start_col": 0,
"start_line": 67
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt128
open FStar.Mul
module UInt = FStar.UInt
module Seq = FStar.Seq
module BV = FStar.BitVector
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
open FStar.BV
open FStar.Tactics.V2
module T = FStar.Tactics.V2
module TBV = FStar.Tactics.BV
#set-options "--max_fuel 0 --max_ifuel 0 --split_queries no"
#set-options "--using_facts_from '*,-FStar.Tactics,-FStar.Reflection'"
(* TODO: explain why exactly this is needed? It leads to failures in
HACL* otherwise, claiming that some functions are not Low*. *)
#set-options "--normalize_pure_terms_for_extraction"
[@@ noextract_to "krml"]
noextract
let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63
[@@ noextract_to "krml"]
noextract
let carry_bv (a b: uint_t 64) =
bvshr (bvxor (int2bv a)
(bvor (bvxor (int2bv a) (int2bv b)) (bvxor (bvsub (int2bv a) (int2bv b)) (int2bv b))))
63
let carry_uint64_ok (a b:uint_t 64)
: squash (int2bv (carry_uint64 a b) == carry_bv a b)
= _ by (T.norm [delta_only [`%carry_uint64]; unascribe];
let open FStar.Tactics.BV in
mapply (`trans);
arith_to_bv_tac ();
arith_to_bv_tac ();
T.norm [delta_only [`%carry_bv]];
trefl()) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.BV.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Calc.fsti.checked",
"FStar.BV.fsti.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt128.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.BV",
"short_module": "TBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BV",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.BitVector",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64 -> Prims.logical | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt.uint_t",
"Prims.eq2",
"FStar.BV.bv_t",
"FStar.UInt128.carry_bv",
"FStar.BV.int2bv",
"Prims.logical"
] | [] | false | false | false | false | true | let fact1 (a b: uint_t 64) =
| carry_bv a b == int2bv 1 | false |
|
FStar.UInt128.fst | FStar.UInt128.carry_uint64_ok | val carry_uint64_ok (a b: uint_t 64) : squash (int2bv (carry_uint64 a b) == carry_bv a b) | val carry_uint64_ok (a b: uint_t 64) : squash (int2bv (carry_uint64 a b) == carry_bv a b) | let carry_uint64_ok (a b:uint_t 64)
: squash (int2bv (carry_uint64 a b) == carry_bv a b)
= _ by (T.norm [delta_only [`%carry_uint64]; unascribe];
let open FStar.Tactics.BV in
mapply (`trans);
arith_to_bv_tac ();
arith_to_bv_tac ();
T.norm [delta_only [`%carry_bv]];
trefl()) | {
"file_name": "ulib/FStar.UInt128.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 65,
"start_col": 0,
"start_line": 57
} | (*
Copyright 2008-2018 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module FStar.UInt128
open FStar.Mul
module UInt = FStar.UInt
module Seq = FStar.Seq
module BV = FStar.BitVector
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Math = FStar.Math.Lemmas
open FStar.BV
open FStar.Tactics.V2
module T = FStar.Tactics.V2
module TBV = FStar.Tactics.BV
#set-options "--max_fuel 0 --max_ifuel 0 --split_queries no"
#set-options "--using_facts_from '*,-FStar.Tactics,-FStar.Reflection'"
(* TODO: explain why exactly this is needed? It leads to failures in
HACL* otherwise, claiming that some functions are not Low*. *)
#set-options "--normalize_pure_terms_for_extraction"
[@@ noextract_to "krml"]
noextract
let carry_uint64 (a b: uint_t 64) : Tot (uint_t 64) =
let ( ^^ ) = UInt.logxor in
let ( |^ ) = UInt.logor in
let ( -%^ ) = UInt.sub_mod in
let ( >>^ ) = UInt.shift_right in
a ^^ ((a ^^ b) |^ ((a -%^ b) ^^ b)) >>^ 63
[@@ noextract_to "krml"]
noextract
let carry_bv (a b: uint_t 64) =
bvshr (bvxor (int2bv a)
(bvor (bvxor (int2bv a) (int2bv b)) (bvxor (bvsub (int2bv a) (int2bv b)) (int2bv b))))
63 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Effect.fsti.checked",
"FStar.Tactics.BV.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.Int.Cast.fst.checked",
"FStar.Classical.Sugar.fsti.checked",
"FStar.Calc.fsti.checked",
"FStar.BV.fsti.checked",
"FStar.BitVector.fst.checked"
],
"interface_file": true,
"source_file": "FStar.UInt128.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Tactics.BV",
"short_module": "TBV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.BV",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Math.Lemmas",
"short_module": "Math"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.BitVector",
"short_module": "BV"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.UInt",
"short_module": "UInt"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.UInt",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: FStar.UInt.uint_t 64 -> b: FStar.UInt.uint_t 64
-> Prims.squash (FStar.BV.int2bv (FStar.UInt128.carry_uint64 a b) == FStar.UInt128.carry_bv a b) | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt.uint_t",
"Prims.squash",
"Prims.eq2",
"FStar.BV.bv_t",
"FStar.BV.int2bv",
"FStar.UInt128.carry_uint64",
"FStar.UInt128.carry_bv"
] | [] | false | false | true | false | false | let carry_uint64_ok (a b: uint_t 64) : squash (int2bv (carry_uint64 a b) == carry_bv a b) =
| FStar.Tactics.Effect.synth_by_tactic (fun _ ->
(T.norm [delta_only [`%carry_uint64]; unascribe];
let open FStar.Tactics.BV in
mapply (`trans);
arith_to_bv_tac ();
arith_to_bv_tac ();
T.norm [delta_only [`%carry_bv]];
trefl ())) | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.