effect
stringclasses 48
values | original_source_type
stringlengths 0
23k
| opens_and_abbrevs
listlengths 2
92
| isa_cross_project_example
bool 1
class | source_definition
stringlengths 9
57.9k
| partial_definition
stringlengths 7
23.3k
| is_div
bool 2
classes | is_type
null | is_proof
bool 2
classes | completed_definiton
stringlengths 1
250k
| dependencies
dict | effect_flags
sequencelengths 0
2
| ideal_premises
sequencelengths 0
236
| mutual_with
sequencelengths 0
11
| file_context
stringlengths 0
407k
| interleaved
bool 1
class | is_simply_typed
bool 2
classes | file_name
stringlengths 5
48
| vconfig
dict | is_simple_lemma
null | source_type
stringlengths 10
23k
| proof_features
sequencelengths 0
1
| name
stringlengths 8
95
| source
dict | verbose_type
stringlengths 1
7.42k
| source_range
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"] | let full_perm_lid = | false | null | false | ["Steel"; "FractionalPermission"; "full_perm"] | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref" | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val full_perm_lid : Prims.list Prims.string | [] | Pulse.Reflection.Util.full_perm_lid | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | Prims.list Prims.string | {
"end_col": 66,
"end_line": 597,
"start_col": 20,
"start_line": 597
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_pulse_lib_array_core_lid s = pulse_lib_array_core @ [s] | let mk_pulse_lib_array_core_lid s = | false | null | false | pulse_lib_array_core @ [s] | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"Prims.string",
"FStar.List.Tot.Base.op_At",
"Pulse.Reflection.Util.pulse_lib_array_core",
"Prims.Cons",
"Prims.Nil",
"Prims.list"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid)) | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_pulse_lib_array_core_lid : s: Prims.string -> Prims.list Prims.string | [] | Pulse.Reflection.Util.mk_pulse_lib_array_core_lid | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | s: Prims.string -> Prims.list Prims.string | {
"end_col": 62,
"end_line": 617,
"start_col": 36,
"start_line": 617
} |
|
Prims.Tot | val mk_bind_stt (u1 u2: R.universe) (ty1 ty2 pre1 post1 post2 t1 t2: R.term) : R.term | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)] | val mk_bind_stt (u1 u2: R.universe) (ty1 ty2 pre1 post1 post2 t1 t2: R.term) : R.term
let mk_bind_stt (u1 u2: R.universe) (ty1 ty2 pre1 post1 post2 t1 t2: R.term) : R.term = | false | null | false | let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1; u2]) in
R.mk_app (R.mk_app (R.mk_app (R.mk_app (R.mk_app (R.mk_app (R.mk_app head [(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)] | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.Cons",
"FStar.Reflection.V2.Data.argv",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Implicit",
"Prims.Nil",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_UInst",
"FStar.Reflection.V2.Builtins.pack_fv",
"Prims.list",
"Prims.string",
"Pulse.Reflection.Util.mk_pulse_lib_core_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term) | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_bind_stt (u1 u2: R.universe) (ty1 ty2 pre1 post1 post2 t1 t2: R.term) : R.term | [] | Pulse.Reflection.Util.mk_bind_stt | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u1: FStar.Reflection.Types.universe ->
u2: FStar.Reflection.Types.universe ->
ty1: FStar.Reflection.Types.term ->
ty2: FStar.Reflection.Types.term ->
pre1: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term ->
t1: FStar.Reflection.Types.term ->
t2: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 26,
"end_line": 377,
"start_col": 3,
"start_line": 362
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let pulse_lib_array_core = ["Pulse"; "Lib"; "Array"; "Core"] | let pulse_lib_array_core = | false | null | false | ["Pulse"; "Lib"; "Array"; "Core"] | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"Prims.Cons",
"Prims.string",
"Prims.Nil"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid)) | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val pulse_lib_array_core : Prims.list Prims.string | [] | Pulse.Reflection.Util.pulse_lib_array_core | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | Prims.list Prims.string | {
"end_col": 60,
"end_line": 616,
"start_col": 27,
"start_line": 616
} |
|
Prims.Tot | val mk_frame_stt (u: R.universe) (ty pre post frame t: R.term) : R.term | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)] | val mk_frame_stt (u: R.universe) (ty pre post frame t: R.term) : R.term
let mk_frame_stt (u: R.universe) (ty pre post frame t: R.term) : R.term = | false | null | false | let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app (R.mk_app (R.mk_app (R.mk_app (R.mk_app head [(ty, R.Q_Implicit)]) [(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)] | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Derived.mk_app",
"Prims.Cons",
"FStar.Reflection.V2.Data.argv",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Implicit",
"Prims.Nil",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_UInst",
"FStar.Reflection.V2.Builtins.pack_fv",
"FStar.Reflection.Types.fv",
"Prims.list",
"Prims.string",
"Pulse.Reflection.Util.mk_pulse_lib_core_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term) | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_frame_stt (u: R.universe) (ty pre post frame t: R.term) : R.term | [] | Pulse.Reflection.Util.mk_frame_stt | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u203: FStar.Reflection.Types.universe ->
ty: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term ->
frame: FStar.Reflection.Types.term ->
t: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 25,
"end_line": 450,
"start_col": 3,
"start_line": 438
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let array_lid = mk_pulse_lib_array_core_lid "array" | let array_lid = | false | null | false | mk_pulse_lib_array_core_lid "array" | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"Pulse.Reflection.Util.mk_pulse_lib_array_core_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid))
let pulse_lib_array_core = ["Pulse"; "Lib"; "Array"; "Core"]
let mk_pulse_lib_array_core_lid s = pulse_lib_array_core @ [s] | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val array_lid : Prims.list Prims.string | [] | Pulse.Reflection.Util.array_lid | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | Prims.list Prims.string | {
"end_col": 51,
"end_line": 619,
"start_col": 16,
"start_line": 619
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit)) | let stt_vprop_equiv (t1 t2: R.term) = | false | null | false | let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit)) | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_App",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Reflection.Util.stt_vprop_equiv_tm"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv) | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val stt_vprop_equiv : t1: FStar.Reflection.Types.term -> t2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | [] | Pulse.Reflection.Util.stt_vprop_equiv | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | t1: FStar.Reflection.Types.term -> t2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | {
"end_col": 37,
"end_line": 275,
"start_col": 2,
"start_line": 273
} |
|
Prims.Tot | val mk_ref (a: R.term) : R.term | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit)) | val mk_ref (a: R.term) : R.term
let mk_ref (a: R.term) : R.term = | false | null | false | let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit)) | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_App",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Data.Tv_FVar",
"FStar.Reflection.V2.Builtins.pack_fv",
"Pulse.Reflection.Util.ref_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"] | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_ref (a: R.term) : R.term | [] | Pulse.Reflection.Util.mk_ref | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | a: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | {
"end_col": 36,
"end_line": 602,
"start_col": 2,
"start_line": 600
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit)) | let mk_lift_atomic_stt (u: R.universe) (a pre post e: R.term) = | false | null | false | let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit)) | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_App",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Data.Q_Implicit",
"FStar.Reflection.V2.Data.Tv_UInst",
"FStar.Reflection.V2.Builtins.pack_fv",
"Prims.Cons",
"Prims.Nil",
"Prims.list",
"Prims.string",
"Pulse.Reflection.Util.mk_pulse_lib_core_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_lift_atomic_stt : u149: FStar.Reflection.Types.universe ->
a: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term ->
e: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Reflection.Util.mk_lift_atomic_stt | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
u149: FStar.Reflection.Types.universe ->
a: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term ->
e: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 38,
"end_line": 340,
"start_col": 2,
"start_line": 334
} |
|
FStar.Tactics.Effect.Tac | val mk_opaque_let
(g: R.env)
(nm: string)
(tm: Ghost.erased R.term)
(ty: R.typ{RT.typing g tm (T.E_Total, ty)})
: T.Tac (RT.sigelt_for g) | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_opaque_let (g:R.env) (nm:string) (tm:Ghost.erased R.term) (ty:R.typ{RT.typing g tm (T.E_Total, ty)}) : T.Tac (RT.sigelt_for g) =
let fv = R.pack_fv (T.cur_module () @ [nm]) in
let lb = R.pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = ty; lb_def = (`_) }) in
let se = R.pack_sigelt (R.Sg_Let false [lb]) in
let pf : RT.sigelt_typing g se =
RT.ST_Let_Opaque g fv ty ()
in
(true, se, None) | val mk_opaque_let
(g: R.env)
(nm: string)
(tm: Ghost.erased R.term)
(ty: R.typ{RT.typing g tm (T.E_Total, ty)})
: T.Tac (RT.sigelt_for g)
let mk_opaque_let
(g: R.env)
(nm: string)
(tm: Ghost.erased R.term)
(ty: R.typ{RT.typing g tm (T.E_Total, ty)})
: T.Tac (RT.sigelt_for g) = | true | null | false | let fv = R.pack_fv (T.cur_module () @ [nm]) in
let lb = R.pack_lb ({ lb_fv = fv; lb_us = []; lb_typ = ty; lb_def = (`_) }) in
let se = R.pack_sigelt (R.Sg_Let false [lb]) in
let pf:RT.sigelt_typing g se = RT.ST_Let_Opaque g fv ty () in
(true, se, None) | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [] | [
"FStar.Reflection.Types.env",
"Prims.string",
"FStar.Ghost.erased",
"FStar.Reflection.Types.term",
"FStar.Reflection.Types.typ",
"FStar.Reflection.Typing.typing",
"FStar.Ghost.reveal",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Stubs.TypeChecker.Core.tot_or_ghost",
"FStar.Stubs.TypeChecker.Core.E_Total",
"FStar.Pervasives.Native.Mktuple3",
"Prims.bool",
"FStar.Reflection.Types.sigelt",
"FStar.Pervasives.Native.option",
"FStar.Reflection.Typing.blob",
"FStar.Pervasives.Native.None",
"FStar.Reflection.Typing.sigelt_typing",
"FStar.Reflection.Typing.ST_Let_Opaque",
"FStar.Reflection.V2.Builtins.pack_sigelt",
"FStar.Reflection.V2.Data.Sg_Let",
"Prims.Cons",
"FStar.Reflection.Types.letbinding",
"Prims.Nil",
"FStar.Reflection.V2.Builtins.pack_lb",
"FStar.Reflection.V2.Data.Mklb_view",
"FStar.Reflection.Types.univ_name",
"FStar.Reflection.Typing.sigelt_for",
"FStar.Reflection.Types.fv",
"FStar.Reflection.V2.Builtins.pack_fv",
"FStar.Reflection.Types.name",
"FStar.List.Tot.Base.op_At",
"Prims.list",
"FStar.Tactics.V2.Derived.cur_module"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid))
let pulse_lib_array_core = ["Pulse"; "Lib"; "Array"; "Core"]
let mk_pulse_lib_array_core_lid s = pulse_lib_array_core @ [s]
let array_lid = mk_pulse_lib_array_core_lid "array"
let array_pts_to_lid = mk_pulse_lib_array_core_lid "pts_to"
let array_length_lid = mk_pulse_lib_array_core_lid "length"
let array_is_full_lid = mk_pulse_lib_array_core_lid "is_full_array"
let mk_array (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_array_length (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_length_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit))
let mk_array_pts_to (a:R.term) (arr:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (arr, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let mk_array_is_full (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_is_full_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit))
let mk_seq (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (R.pack_fv seq_lid) [u]) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_seq_create (u:R.universe) (a:R.term) (len:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (R.pack_fv seq_create_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (len, Q_Explicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let mk_withlocalarray (ret_u:R.universe) (a init len pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_array_core_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (len, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
let mk_szv (n:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv szv_lid)) in
pack_ln (Tv_App t (n, Q_Explicit)) | false | false | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_opaque_let
(g: R.env)
(nm: string)
(tm: Ghost.erased R.term)
(ty: R.typ{RT.typing g tm (T.E_Total, ty)})
: T.Tac (RT.sigelt_for g) | [] | Pulse.Reflection.Util.mk_opaque_let | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: FStar.Reflection.Types.env ->
nm: Prims.string ->
tm: FStar.Ghost.erased FStar.Reflection.Types.term ->
ty:
FStar.Reflection.Types.typ
{ FStar.Reflection.Typing.typing g
(FStar.Ghost.reveal tm)
(FStar.Stubs.TypeChecker.Core.E_Total, ty) }
-> FStar.Tactics.Effect.Tac (FStar.Reflection.Typing.sigelt_for g) | {
"end_col": 18,
"end_line": 685,
"start_col": 135,
"start_line": 678
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let array_pts_to_lid = mk_pulse_lib_array_core_lid "pts_to" | let array_pts_to_lid = | false | null | false | mk_pulse_lib_array_core_lid "pts_to" | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"Pulse.Reflection.Util.mk_pulse_lib_array_core_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid))
let pulse_lib_array_core = ["Pulse"; "Lib"; "Array"; "Core"]
let mk_pulse_lib_array_core_lid s = pulse_lib_array_core @ [s] | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val array_pts_to_lid : Prims.list Prims.string | [] | Pulse.Reflection.Util.array_pts_to_lid | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | Prims.list Prims.string | {
"end_col": 59,
"end_line": 620,
"start_col": 23,
"start_line": 620
} |
|
Prims.Tot | val mk_array_length (a arr: R.term) : R.term | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_array_length (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_length_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit)) | val mk_array_length (a arr: R.term) : R.term
let mk_array_length (a arr: R.term) : R.term = | false | null | false | let open R in
let t = pack_ln (Tv_FVar (pack_fv array_length_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit)) | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_App",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Data.Q_Implicit",
"FStar.Reflection.V2.Data.Tv_FVar",
"FStar.Reflection.V2.Builtins.pack_fv",
"Pulse.Reflection.Util.array_length_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid))
let pulse_lib_array_core = ["Pulse"; "Lib"; "Array"; "Core"]
let mk_pulse_lib_array_core_lid s = pulse_lib_array_core @ [s]
let array_lid = mk_pulse_lib_array_core_lid "array"
let array_pts_to_lid = mk_pulse_lib_array_core_lid "pts_to"
let array_length_lid = mk_pulse_lib_array_core_lid "length"
let array_is_full_lid = mk_pulse_lib_array_core_lid "is_full_array"
let mk_array (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_lid)) in
pack_ln (Tv_App t (a, Q_Explicit)) | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_array_length (a arr: R.term) : R.term | [] | Pulse.Reflection.Util.mk_array_length | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | a: FStar.Reflection.Types.term -> arr: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | {
"end_col": 38,
"end_line": 633,
"start_col": 2,
"start_line": 630
} |
Prims.Tot | val mk_array_is_full (a arr: R.term) : R.term | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_array_is_full (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_is_full_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit)) | val mk_array_is_full (a arr: R.term) : R.term
let mk_array_is_full (a arr: R.term) : R.term = | false | null | false | let open R in
let t = pack_ln (Tv_FVar (pack_fv array_is_full_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit)) | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_App",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Data.Q_Implicit",
"FStar.Reflection.V2.Data.Tv_FVar",
"FStar.Reflection.V2.Builtins.pack_fv",
"Pulse.Reflection.Util.array_is_full_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid))
let pulse_lib_array_core = ["Pulse"; "Lib"; "Array"; "Core"]
let mk_pulse_lib_array_core_lid s = pulse_lib_array_core @ [s]
let array_lid = mk_pulse_lib_array_core_lid "array"
let array_pts_to_lid = mk_pulse_lib_array_core_lid "pts_to"
let array_length_lid = mk_pulse_lib_array_core_lid "length"
let array_is_full_lid = mk_pulse_lib_array_core_lid "is_full_array"
let mk_array (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_array_length (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_length_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit))
let mk_array_pts_to (a:R.term) (arr:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (arr, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit)) | false | false | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_array_is_full (a arr: R.term) : R.term | [] | Pulse.Reflection.Util.mk_array_is_full | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | a: FStar.Reflection.Types.term -> arr: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | {
"end_col": 38,
"end_line": 647,
"start_col": 2,
"start_line": 644
} |
Prims.Tot | val mk_array_pts_to (a arr perm v: R.term) : R.term | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_array_pts_to (a:R.term) (arr:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (arr, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit)) | val mk_array_pts_to (a arr perm v: R.term) : R.term
let mk_array_pts_to (a arr perm v: R.term) : R.term = | false | null | false | let open R in
let t = pack_ln (Tv_FVar (pack_fv array_pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (arr, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit)) | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_App",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Data.Q_Implicit",
"FStar.Reflection.V2.Data.Tv_FVar",
"FStar.Reflection.V2.Builtins.pack_fv",
"Pulse.Reflection.Util.array_pts_to_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid))
let pulse_lib_array_core = ["Pulse"; "Lib"; "Array"; "Core"]
let mk_pulse_lib_array_core_lid s = pulse_lib_array_core @ [s]
let array_lid = mk_pulse_lib_array_core_lid "array"
let array_pts_to_lid = mk_pulse_lib_array_core_lid "pts_to"
let array_length_lid = mk_pulse_lib_array_core_lid "length"
let array_is_full_lid = mk_pulse_lib_array_core_lid "is_full_array"
let mk_array (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_array_length (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_length_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit)) | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_array_pts_to (a arr perm v: R.term) : R.term | [] | Pulse.Reflection.Util.mk_array_pts_to | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
a: FStar.Reflection.Types.term ->
arr: FStar.Reflection.Types.term ->
perm: FStar.Reflection.Types.term ->
v: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 36,
"end_line": 641,
"start_col": 2,
"start_line": 636
} |
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_withlocalarray (ret_u:R.universe) (a init len pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_array_core_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (len, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit)) | let mk_withlocalarray (ret_u: R.universe) (a init len pre ret_t post body: R.term) = | false | null | false | let open R in
let lid = mk_pulse_lib_array_core_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (len, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit)) | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_App",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Data.Q_Implicit",
"FStar.Reflection.V2.Data.Tv_UInst",
"FStar.Reflection.V2.Builtins.pack_fv",
"Prims.Cons",
"Prims.Nil",
"Prims.list",
"Prims.string",
"Pulse.Reflection.Util.mk_pulse_lib_array_core_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid))
let pulse_lib_array_core = ["Pulse"; "Lib"; "Array"; "Core"]
let mk_pulse_lib_array_core_lid s = pulse_lib_array_core @ [s]
let array_lid = mk_pulse_lib_array_core_lid "array"
let array_pts_to_lid = mk_pulse_lib_array_core_lid "pts_to"
let array_length_lid = mk_pulse_lib_array_core_lid "length"
let array_is_full_lid = mk_pulse_lib_array_core_lid "is_full_array"
let mk_array (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_array_length (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_length_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit))
let mk_array_pts_to (a:R.term) (arr:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (arr, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let mk_array_is_full (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_is_full_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit))
let mk_seq (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (R.pack_fv seq_lid) [u]) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_seq_create (u:R.universe) (a:R.term) (len:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (R.pack_fv seq_create_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (len, Q_Explicit)) in
pack_ln (Tv_App t (v, Q_Explicit)) | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_withlocalarray : ret_u: FStar.Reflection.Types.universe ->
a: FStar.Reflection.Types.term ->
init: FStar.Reflection.Types.term ->
len: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
ret_t: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term ->
body: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | [] | Pulse.Reflection.Util.mk_withlocalarray | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
ret_u: FStar.Reflection.Types.universe ->
a: FStar.Reflection.Types.term ->
init: FStar.Reflection.Types.term ->
len: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
ret_t: FStar.Reflection.Types.term ->
post: FStar.Reflection.Types.term ->
body: FStar.Reflection.Types.term
-> FStar.Reflection.Types.term | {
"end_col": 39,
"end_line": 671,
"start_col": 2,
"start_line": 662
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_szv (n:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv szv_lid)) in
pack_ln (Tv_App t (n, Q_Explicit)) | let mk_szv (n: R.term) = | false | null | false | let open R in
let t = pack_ln (Tv_FVar (pack_fv szv_lid)) in
pack_ln (Tv_App t (n, Q_Explicit)) | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.term",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_App",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.V2.Data.Tv_FVar",
"FStar.Reflection.V2.Builtins.pack_fv",
"Pulse.Reflection.Util.szv_lid"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv
let mk_total t = R.C_Total t
let mk_ghost t = R.C_GTotal t
let binder_of_t_q t q = RT.binder_of_t_q t q
let binder_of_t_q_s (t:R.term) (q:R.aqualv) (s:RT.pp_name_t) = RT.mk_binder s t q
let bound_var i : R.term = RT.bound_var i
let mk_name i : R.term = R.pack_ln (R.Tv_Var (R.pack_namedv (RT.make_namedv i)))
let arrow_dom = (R.term & R.aqualv)
let mk_arrow (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q ty q) (R.pack_comp (mk_total out)))
let mk_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_total out)))
let mk_ghost_arrow_with_name (s:RT.pp_name_t) (f:arrow_dom) (out:R.term) : R.term =
let ty, q = f in
R.pack_ln (R.Tv_Arrow (binder_of_t_q_s ty q s) (R.pack_comp (mk_ghost out)))
let mk_abs ty qual t : R.term = RT.mk_abs ty qual t
let mk_abs_with_name s ty qual t : R.term = R.pack_ln (R.Tv_Abs (binder_of_t_q_s ty qual s) t)
let mk_abs_with_name_and_range s r ty qual t : R.term =
let b = (binder_of_t_q_s ty qual s) in
let b = RU.binder_set_range b r in
R.pack_ln (R.Tv_Abs b t)
let mk_erased (u:R.universe) (t:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv erased_lid) [u]) in
R.pack_ln (R.Tv_App hd (t, R.Q_Explicit))
let mk_reveal (u:R.universe) (t:R.term) (e:R.term) : R.term =
let hd = R.pack_ln (R.Tv_UInst (R.pack_fv reveal_lid) [u]) in
let hd = R.pack_ln (R.Tv_App hd (t, R.Q_Implicit)) in
R.pack_ln (R.Tv_App hd (e, R.Q_Explicit))
let elim_exists_lid = mk_pulse_lib_core_lid "elim_exists"
let intro_exists_lid = mk_pulse_lib_core_lid "intro_exists"
let intro_exists_erased_lid = mk_pulse_lib_core_lid "intro_exists_erased"
let mk_exists (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_forall (u:R.universe) (a p:R.term) =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv forall_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_elim_exists (u:R.universe) (a p:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
R.pack_ln (R.Tv_App t (p, R.Q_Explicit))
let mk_intro_exists (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let mk_intro_exists_erased (u:R.universe) (a p:R.term) (e:R.term) : R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv intro_exists_erased_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (p, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (e, R.Q_Explicit))
let while_lid = mk_pulse_lib_core_lid "while_loop"
let mk_while (inv cond body:R.term) : R.term =
let t = R.pack_ln (R.Tv_FVar (R.pack_fv while_lid)) in
let t = R.pack_ln (R.Tv_App t (inv, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (cond, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (body, R.Q_Explicit))
let vprop_eq_tm t1 t2 =
let open R in
let u2 =
pack_universe (Uv_Succ (pack_universe (Uv_Succ (pack_universe Uv_Zero)))) in
let t = pack_ln (Tv_UInst (pack_fv eq2_qn) [u2]) in
let t = pack_ln (Tv_App t (pack_ln (Tv_FVar (pack_fv vprop_lid)), Q_Implicit)) in
let t = pack_ln (Tv_App t (t1, Q_Explicit)) in
let t = pack_ln (Tv_App t (t2, Q_Explicit)) in
t
let emp_inames_tm : R.term = R.pack_ln (R.Tv_FVar (R.pack_fv emp_inames_lid))
let non_informative_witness_lid = mk_pulse_lib_core_lid "non_informative_witness"
let non_informative_witness_rt (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv non_informative_witness_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Explicit)) in
t
let stt_vprop_equiv_fv =
R.pack_fv (mk_pulse_lib_core_lid "vprop_equiv")
let stt_vprop_equiv_tm =
R.pack_ln (R.Tv_FVar stt_vprop_equiv_fv)
let stt_vprop_equiv (t1 t2:R.term) =
let open R in
let t = pack_ln (Tv_App stt_vprop_equiv_tm (t1, Q_Explicit)) in
pack_ln (Tv_App t (t2, Q_Explicit))
let return_stt_lid = mk_pulse_lib_core_lid "return_stt"
let return_stt_noeq_lid = mk_pulse_lib_core_lid "return"
let return_stt_atomic_lid = mk_pulse_lib_core_lid "return_stt_atomic"
let return_stt_atomic_noeq_lid = mk_pulse_lib_core_lid "return_stt_atomic_noeq"
let return_stt_ghost_lid = mk_pulse_lib_core_lid "return_stt_ghost"
let return_stt_ghost_noeq_lid = mk_pulse_lib_core_lid "return_stt_ghost_noeq"
let mk_stt_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_atomic_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_atomic_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_return_noeq (u:R.universe) (ty:R.term) (t:R.term) (post:R.term)
: R.term =
let t = R.pack_ln (R.Tv_UInst (R.pack_fv return_stt_ghost_noeq_lid) [u]) in
let t = R.pack_ln (R.Tv_App t (ty, R.Q_Implicit)) in
let t = R.pack_ln (R.Tv_App t (t, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
// Wrapper.lift_stt_atomic<u> #a #pre #post e
let mk_lift_atomic_stt (u:R.universe) (a pre post e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.lift_stt_ghost<u> #a #opened #pre #post e reveal_a
let mk_lift_ghost_atomic (u:R.universe) (a opened pre post e reveal_a:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "lift_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt<u1, u2> #a #b #pre1 #post1 #post2 e1 e2
let mk_bind_stt
(u1 u2:R.universe)
(ty1 ty2:R.term)
(pre1 post1: R.term)
(post2: R.term)
(t1 t2:R.term)
: R.term
= let bind_lid = mk_pulse_lib_core_lid "bind_stt" in
let head = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head
[(ty1, R.Q_Implicit)])
[(ty2, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Implicit)])
[(t1, R.Q_Explicit)])
[(t2, R.Q_Explicit)]
// Wrapper.bind_sttg<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2
let mk_bind_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_sttg" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
pack_ln (R.Tv_App t (e2, Q_Explicit))
// Wrapper.bind_stt_ghost_atomic<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_a
let mk_bind_ghost_atomic
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_a:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_ghost_atomic" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_a, Q_Explicit))
// Wrapper.bind_stt_atomic_ghost<u1, u2> #a #b #opened #pre1 #post1 #post2 e1 e2 reveal_b
let mk_bind_atomic_ghost
(u1 u2:R.universe)
(a b opened pre1 post1 post2 e1 e2 reveal_b:R.term) =
let open R in
let bind_lid = mk_pulse_lib_core_lid "bind_stt_atomic_ghost" in
let t = R.pack_ln (R.Tv_UInst (R.pack_fv bind_lid) [u1;u2]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (b, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (e1, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (e2, Q_Explicit)) in
pack_ln (R.Tv_App t (reveal_b, Q_Explicit))
// Wrapper.frame_stt<u> #ty #pre #post frame t
let mk_frame_stt
(u:R.universe)
(ty:R.term)
(pre: R.term)
(post: R.term)
(frame: R.term)
(t:R.term)
: R.term
= let frame_lid = mk_pulse_lib_core_lid "frame_stt" in
let frame_fv = R.pack_fv frame_lid in
let frame_univ_inst u = R.pack_ln (R.Tv_UInst (R.pack_fv frame_lid) [u]) in
let head = frame_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre, R.Q_Implicit)])
[(post, R.Q_Implicit)])
[(frame, R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.frame_stt_atomic<u> #a #opened #pre #post frame e
let mk_frame_stt_atomic (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.frame_stt_ghost<u> #a #opened #pre #post frame e
let mk_frame_stt_ghost (u:R.universe) (a opened pre post frame e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "frame_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (frame, Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt<u> #ty #pre1 pre2 #post1 post2 () () e
let mk_sub_stt
(u:R.universe)
(ty:R.term)
(pre1 pre2: R.term)
(post1 post2: R.term)
(t:R.term)
: R.term
= let subsumption_lid = mk_pulse_lib_core_lid "sub_stt" in
let subsumption_fv = R.pack_fv subsumption_lid in
let subsumption_univ_inst u = R.pack_ln (R.Tv_UInst subsumption_fv [u]) in
let head = subsumption_univ_inst u in
R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app
(R.mk_app head [(ty, R.Q_Implicit)])
[(pre1, R.Q_Implicit)])
[(pre2, R.Q_Explicit)])
[(post1, R.Q_Implicit)])
[(post2, R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(`(), R.Q_Explicit)])
[(t, R.Q_Explicit)]
// Wrapper.sub_stt_atomic<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_atomic (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_atomic" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
// Wrapper.sub_stt_ghost<u> #a #opened #pre1 pre2 #post1 post2 () () e
let mk_sub_stt_ghost (u:R.universe) (a opened pre1 pre2 post1 post2 e:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "sub_stt_ghost" in
let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (opened, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in
let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in
pack_ln (R.Tv_App t (e, Q_Explicit))
let mk_par (u:R.universe) (aL aR preL postL preR postR eL eR:R.term) =
let open R in
let lid = mk_pulse_lib_core_lid "stt_par" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [u]) in
let t = pack_ln (Tv_App t (aL, Q_Implicit)) in
let t = pack_ln (Tv_App t (aR, Q_Implicit)) in
let t = pack_ln (Tv_App t (preL, Q_Implicit)) in
let t = pack_ln (Tv_App t (postL, Q_Implicit)) in
let t = pack_ln (Tv_App t (preR, Q_Implicit)) in
let t = pack_ln (Tv_App t (postR, Q_Implicit)) in
let t = pack_ln (Tv_App t (eL, Q_Explicit)) in
pack_ln (Tv_App t (eR, Q_Explicit))
let mk_rewrite (p q:R.term) =
let open R in
let t = pack_ln (Tv_FVar (pack_fv (mk_pulse_lib_core_lid "rewrite"))) in
let t = pack_ln (Tv_App t (p, Q_Explicit)) in
let t = pack_ln (Tv_App t (q, Q_Explicit)) in
pack_ln (Tv_App t (`(), Q_Explicit))
let mk_withlocal (ret_u:R.universe) (a init pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_reference_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit))
///// Utils to derive equiv for common constructs /////
let mk_star_equiv (g:R.env) (t1 t2 t3 t4:R.term)
(eq1:RT.equiv g t1 t3)
(eq2:RT.equiv g t2 t4)
: RT.equiv g (mk_star t1 t2) (mk_star t3 t4) =
admit ()
let mk_stt_comp_equiv (g:R.env) (u:R.universe) (res1 pre1 post1 res2 pre2 post2:R.term)
(res_eq: RT.equiv g res1 res2)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_comp u res1 pre1 post1)
(mk_stt_comp u res2 pre2 post2)
= admit ()
let mk_stt_atomic_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_atomic_comp u res inames pre1 post1)
(mk_stt_atomic_comp u res inames pre2 post2)
= admit ()
let mk_stt_ghost_comp_equiv (g:R.env) (u:R.universe) (res inames pre1 post1 pre2 post2:R.term)
(pre_eq:RT.equiv g pre1 pre2)
(post_eq:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u res inames pre1 post1)
(mk_stt_ghost_comp u res inames pre2 post2)
= admit ()
let ref_lid = mk_pulse_lib_reference_lid "ref"
let pts_to_lid = mk_pulse_lib_reference_lid "pts_to"
let full_perm_lid = ["Steel"; "FractionalPermission"; "full_perm"]
let mk_ref (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_pts_to (a:R.term) (r:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (r, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let full_perm_tm : R.term =
let open R in
pack_ln (Tv_FVar (pack_fv full_perm_lid))
let pulse_lib_array_core = ["Pulse"; "Lib"; "Array"; "Core"]
let mk_pulse_lib_array_core_lid s = pulse_lib_array_core @ [s]
let array_lid = mk_pulse_lib_array_core_lid "array"
let array_pts_to_lid = mk_pulse_lib_array_core_lid "pts_to"
let array_length_lid = mk_pulse_lib_array_core_lid "length"
let array_is_full_lid = mk_pulse_lib_array_core_lid "is_full_array"
let mk_array (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_lid)) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_array_length (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_length_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit))
let mk_array_pts_to (a:R.term) (arr:R.term) (perm:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_pts_to_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (arr, Q_Explicit)) in
let t = pack_ln (Tv_App t (perm, Q_Implicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let mk_array_is_full (a:R.term) (arr:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv array_is_full_lid)) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
pack_ln (Tv_App t (arr, Q_Explicit))
let mk_seq (u:R.universe) (a:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (R.pack_fv seq_lid) [u]) in
pack_ln (Tv_App t (a, Q_Explicit))
let mk_seq_create (u:R.universe) (a:R.term) (len:R.term) (v:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (R.pack_fv seq_create_lid) [u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (len, Q_Explicit)) in
pack_ln (Tv_App t (v, Q_Explicit))
let mk_withlocalarray (ret_u:R.universe) (a init len pre ret_t post body:R.term) =
let open R in
let lid = mk_pulse_lib_array_core_lid "with_local" in
let t = pack_ln (Tv_UInst (R.pack_fv lid) [ret_u]) in
let t = pack_ln (Tv_App t (a, Q_Implicit)) in
let t = pack_ln (Tv_App t (init, Q_Explicit)) in
let t = pack_ln (Tv_App t (len, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Implicit)) in
let t = pack_ln (Tv_App t (ret_t, Q_Implicit)) in
let t = pack_ln (Tv_App t (post, Q_Implicit)) in
pack_ln (Tv_App t (body, Q_Explicit)) | false | true | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_szv : n: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | [] | Pulse.Reflection.Util.mk_szv | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | n: FStar.Reflection.Types.term -> FStar.Reflection.Types.term | {
"end_col": 36,
"end_line": 676,
"start_col": 2,
"start_line": 674
} |
|
Prims.Tot | val mk_stt_ghost_comp_post_equiv
(g: R.env)
(u: R.universe)
(a inames pre post1 post2: R.term)
(posts_equiv: RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1) (mk_stt_ghost_comp u a inames pre post2) | [
{
"abbrev": false,
"full_module": "FStar.List.Tot",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection",
"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
}
] | false | let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1)
(mk_stt_ghost_comp u a inames pre post2) =
let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2
(Ctxt_app_arg t Q_Explicit Ctxt_hole)
posts_equiv | val mk_stt_ghost_comp_post_equiv
(g: R.env)
(u: R.universe)
(a inames pre post1 post2: R.term)
(posts_equiv: RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1) (mk_stt_ghost_comp u a inames pre post2)
let mk_stt_ghost_comp_post_equiv
(g: R.env)
(u: R.universe)
(a inames pre post1 post2: R.term)
(posts_equiv: RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1) (mk_stt_ghost_comp u a inames pre post2) = | false | null | false | let open R in
let open RT in
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
Rel_ctxt g post1 post2 (Ctxt_app_arg t Q_Explicit Ctxt_hole) posts_equiv | {
"checked_file": "Pulse.Reflection.Util.fst.checked",
"dependencies": [
"Pulse.RuntimeUtils.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Pulse.Reflection.Util.fst"
} | [
"total"
] | [
"FStar.Reflection.Types.env",
"FStar.Reflection.Types.universe",
"FStar.Reflection.Types.term",
"FStar.Reflection.Typing.equiv",
"FStar.Reflection.Typing.Rel_ctxt",
"FStar.Reflection.Typing.Ctxt_app_arg",
"FStar.Reflection.V2.Data.Q_Explicit",
"FStar.Reflection.Typing.Ctxt_hole",
"FStar.Reflection.V2.Builtins.pack_ln",
"FStar.Reflection.V2.Data.Tv_App",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Reflection.V2.Data.aqualv",
"FStar.Reflection.V2.Data.Tv_UInst",
"Pulse.Reflection.Util.stt_ghost_fv",
"Prims.Cons",
"Prims.Nil",
"Pulse.Reflection.Util.mk_stt_ghost_comp"
] | [] | module Pulse.Reflection.Util
module R = FStar.Reflection.V2
module T = FStar.Tactics.V2
module RT = FStar.Reflection.Typing
module RU = Pulse.RuntimeUtils
open FStar.List.Tot
let pulse_lib_core = ["Pulse"; "Lib"; "Core"]
let mk_pulse_lib_core_lid s = pulse_lib_core@[s]
let tun = R.pack_ln R.Tv_Unknown
let unit_lid = R.unit_lid
let bool_lid = R.bool_lid
let int_lid = R.int_lid
let erased_lid = ["FStar"; "Ghost"; "erased"]
let hide_lid = ["FStar"; "Ghost"; "hide"]
let reveal_lid = ["FStar"; "Ghost"; "reveal"]
let vprop_lid = mk_pulse_lib_core_lid "vprop"
let vprop_fv = R.pack_fv vprop_lid
let vprop_tm = R.pack_ln (R.Tv_FVar vprop_fv)
let unit_fv = R.pack_fv unit_lid
let unit_tm = R.pack_ln (R.Tv_FVar unit_fv)
let bool_fv = R.pack_fv bool_lid
let bool_tm = R.pack_ln (R.Tv_FVar bool_fv)
let nat_lid = ["Prims"; "nat"]
let nat_fv = R.pack_fv nat_lid
let nat_tm = R.pack_ln (R.Tv_FVar nat_fv)
let szt_lid = ["FStar"; "SizeT"; "t"]
let szt_fv = R.pack_fv szt_lid
let szt_tm = R.pack_ln (R.Tv_FVar szt_fv)
let szv_lid = ["FStar"; "SizeT"; "v"]
let szv_fv = R.pack_fv szv_lid
let szv_tm = R.pack_ln (R.Tv_FVar szv_fv)
let seq_lid = ["FStar"; "Seq"; "Base"; "seq"]
let seq_create_lid = ["FStar"; "Seq"; "Base"; "create"]
let tuple2_lid = ["FStar"; "Pervasives"; "Native"; "tuple2"]
let fst_lid = ["FStar"; "Pervasives"; "Native"; "fst"]
let snd_lid = ["FStar"; "Pervasives"; "Native"; "snd"]
let mk_tuple2 (u1 u2:R.universe) (a1 a2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv tuple2_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Explicit)) in
pack_ln (Tv_App t (a2, Q_Explicit))
let mk_fst (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv fst_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let mk_snd (u1 u2:R.universe) (a1 a2 e:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv snd_lid) [u1; u2]) in
let t = pack_ln (Tv_App t (a1, Q_Implicit)) in
let t = pack_ln (Tv_App t (a2, Q_Implicit)) in
pack_ln (Tv_App t (e, Q_Explicit))
let true_tm = R.pack_ln (R.Tv_Const (R.C_True))
let false_tm = R.pack_ln (R.Tv_Const (R.C_False))
let emp_lid = mk_pulse_lib_core_lid "emp"
let inames_lid = mk_pulse_lib_core_lid "inames"
let star_lid = mk_pulse_lib_core_lid "op_Star_Star"
let mk_star (l r:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv star_lid)) in
let t = pack_ln (Tv_App t (l, Q_Explicit)) in
pack_ln (Tv_App t (r, Q_Explicit))
let pure_lid = mk_pulse_lib_core_lid "pure"
let exists_lid = mk_pulse_lib_core_lid "exists_"
let forall_lid = mk_pulse_lib_core_lid "forall_"
let args_of (tms:list R.term) =
List.Tot.map (fun x -> x, R.Q_Explicit) tms
let mk_pure (p:R.term) : R.term =
let open R in
let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in
pack_ln (Tv_App t (p, Q_Explicit))
let uzero = R.pack_universe (R.Uv_Zero)
let pulse_lib_reference = ["Pulse"; "Lib"; "Reference"]
let mk_pulse_lib_reference_lid s = pulse_lib_reference@[s]
let mk_squash (u:R.universe) (ty:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.squash_qn) [u]) in
pack_ln (Tv_App t (ty, Q_Explicit))
let mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in
let t = pack_ln (Tv_App t (ty, Q_Implicit)) in
let t = pack_ln (Tv_App t (e1, Q_Explicit)) in
pack_ln (Tv_App t (e2, Q_Explicit))
let stt_admit_lid = mk_pulse_lib_core_lid "stt_admit"
let mk_stt_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_atomic_admit_lid = mk_pulse_lib_core_lid "stt_atomic_admit"
let mk_stt_atomic_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_atomic_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let stt_ghost_admit_lid = mk_pulse_lib_core_lid "stt_ghost_admit"
let mk_stt_ghost_admit (u:R.universe) (t pre post:R.term) : R.term =
let open R in
let t = pack_ln (Tv_UInst (pack_fv stt_ghost_admit_lid) [u]) in
let t = pack_ln (Tv_App t (t, Q_Explicit)) in
let t = pack_ln (Tv_App t (pre, Q_Explicit)) in
pack_ln (Tv_App t (post, Q_Explicit))
let emp_inames_lid = mk_pulse_lib_core_lid "emp_inames"
let elim_pure_lid = mk_pulse_lib_core_lid "elim_pure"
//the thunked, value-type counterpart of the effect STT
let stt_lid = mk_pulse_lib_core_lid "stt"
let stt_fv = R.pack_fv stt_lid
let stt_tm = R.pack_ln (R.Tv_FVar stt_fv)
let mk_stt_comp (u:R.universe) (res pre post:R.term) : Tot R.term =
let t = R.pack_ln (R.Tv_UInst stt_fv [u]) in
let t = R.pack_ln (R.Tv_App t (res, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_atomic_lid = mk_pulse_lib_core_lid "stt_atomic"
let stt_atomic_fv = R.pack_fv stt_atomic_lid
let stt_atomic_tm = R.pack_ln (R.Tv_FVar stt_atomic_fv)
let mk_stt_atomic_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_atomic_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let stt_ghost_lid = mk_pulse_lib_core_lid "stt_ghost"
let stt_ghost_fv = R.pack_fv stt_ghost_lid
let stt_ghost_tm = R.pack_ln (R.Tv_FVar stt_ghost_fv)
let mk_stt_ghost_comp (u:R.universe) (a inames pre post:R.term) =
let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in
let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (inames, R.Q_Explicit)) in
let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in
R.pack_ln (R.Tv_App t (post, R.Q_Explicit))
let mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a inames pre post1 post2:R.term)
(posts_equiv:RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1) | false | false | Pulse.Reflection.Util.fst | {
"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"
} | null | val mk_stt_ghost_comp_post_equiv
(g: R.env)
(u: R.universe)
(a inames pre post1 post2: R.term)
(posts_equiv: RT.equiv g post1 post2)
: RT.equiv g (mk_stt_ghost_comp u a inames pre post1) (mk_stt_ghost_comp u a inames pre post2) | [] | Pulse.Reflection.Util.mk_stt_ghost_comp_post_equiv | {
"file_name": "lib/steel/pulse/Pulse.Reflection.Util.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: FStar.Reflection.Types.env ->
u61: FStar.Reflection.Types.universe ->
a: FStar.Reflection.Types.term ->
inames: FStar.Reflection.Types.term ->
pre: FStar.Reflection.Types.term ->
post1: FStar.Reflection.Types.term ->
post2: FStar.Reflection.Types.term ->
posts_equiv: FStar.Reflection.Typing.equiv g post1 post2
-> FStar.Reflection.Typing.equiv g
(Pulse.Reflection.Util.mk_stt_ghost_comp u61 a inames pre post1)
(Pulse.Reflection.Util.mk_stt_ghost_comp u61 a inames pre post2) | {
"end_col": 15,
"end_line": 174,
"start_col": 2,
"start_line": 166
} |
Prims.Tot | val eq_ind : #a:Type -> x:a -> p:(a -> Type) -> f:p x -> y:a -> e:ceq x y -> Tot (p y) | [
{
"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
}
] | false | let eq_ind #a x p f y _ = f | val eq_ind : #a:Type -> x:a -> p:(a -> Type) -> f:p x -> y:a -> e:ceq x y -> Tot (p y)
let eq_ind #a x p f y _ = | false | null | false | f | {
"checked_file": "FStar.Constructive.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Constructive.fst"
} | [
"total"
] | [
"FStar.Constructive.ceq"
] | [] | (*
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.Constructive
type cand p1 p2 =
| Conj : h1:p1 -> h2:p2 -> cand p1 p2
type cor p1 p2 =
| IntroL : h:p1 -> cor p1 p2
| IntroR : h:p2 -> cor p1 p2
type cimp a b = a -> Tot b
type ciff a b = cand (cimp a b) (cimp b a)
noeq type cexists (#a:Type) (p:a -> Type) =
| ExIntro : x:a -> h:p x -> cexists p
// val ex_intro_x : #a:Type -> #p:(a -> Type) -> projectee:cexists p -> Tot a
// let ex_intro_x #a #p = function
// | ExIntro x _ -> x
type ceq (#a:Type) x : a -> Type =
| Refl : ceq #a x x
type ceq_type (a:Type) : Type -> Type =
| ReflType : ceq_type a a | false | false | FStar.Constructive.fst | {
"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"
} | null | val eq_ind : #a:Type -> x:a -> p:(a -> Type) -> f:p x -> y:a -> e:ceq x y -> Tot (p y) | [] | FStar.Constructive.eq_ind | {
"file_name": "ulib/legacy/FStar.Constructive.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: a -> p: (_: a -> Type) -> f: p x -> y: a -> e: FStar.Constructive.ceq x y -> p y | {
"end_col": 27,
"end_line": 42,
"start_col": 26,
"start_line": 42
} |
Prims.Tot | val ceq_symm : #a:Type -> #x:a -> #y:a -> ceq x y -> Tot (ceq y x) | [
{
"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
}
] | false | let ceq_symm #a #x #y h = Refl | val ceq_symm : #a:Type -> #x:a -> #y:a -> ceq x y -> Tot (ceq y x)
let ceq_symm #a #x #y h = | false | null | false | Refl | {
"checked_file": "FStar.Constructive.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Constructive.fst"
} | [
"total"
] | [
"FStar.Constructive.ceq",
"FStar.Constructive.Refl"
] | [] | (*
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.Constructive
type cand p1 p2 =
| Conj : h1:p1 -> h2:p2 -> cand p1 p2
type cor p1 p2 =
| IntroL : h:p1 -> cor p1 p2
| IntroR : h:p2 -> cor p1 p2
type cimp a b = a -> Tot b
type ciff a b = cand (cimp a b) (cimp b a)
noeq type cexists (#a:Type) (p:a -> Type) =
| ExIntro : x:a -> h:p x -> cexists p
// val ex_intro_x : #a:Type -> #p:(a -> Type) -> projectee:cexists p -> Tot a
// let ex_intro_x #a #p = function
// | ExIntro x _ -> x
type ceq (#a:Type) x : a -> Type =
| Refl : ceq #a x x
type ceq_type (a:Type) : Type -> Type =
| ReflType : ceq_type a a
val eq_ind : #a:Type -> x:a -> p:(a -> Type) -> f:p x -> y:a -> e:ceq x y -> Tot (p y)
let eq_ind #a x p f y _ = f
val ceq_eq : #a:Type{hasEq a} -> #x:a -> #y:a -> h:(ceq x y) -> Lemma (x = y)
let ceq_eq #a #x #y h = ()
val ceq_congruence : #a:Type -> #b:Type -> #x:a -> #y:a -> ceq x y ->
f:(a -> GTot b) -> GTot (ceq (f x) (f y))
let ceq_congruence #a #b #x #y h f = Refl #_ #(f x) //refuse to infer terms with non-Tot effect | false | false | FStar.Constructive.fst | {
"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"
} | null | val ceq_symm : #a:Type -> #x:a -> #y:a -> ceq x y -> Tot (ceq y x) | [] | FStar.Constructive.ceq_symm | {
"file_name": "ulib/legacy/FStar.Constructive.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | h: FStar.Constructive.ceq x y -> FStar.Constructive.ceq y x | {
"end_col": 30,
"end_line": 52,
"start_col": 26,
"start_line": 52
} |
Prims.Tot | val false_elim2 : #a:Type -> cfalse -> Tot a | [
{
"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
}
] | false | let false_elim2 #a x = false_elim () | val false_elim2 : #a:Type -> cfalse -> Tot a
let false_elim2 #a x = | false | null | false | false_elim () | {
"checked_file": "FStar.Constructive.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Constructive.fst"
} | [
"total"
] | [
"FStar.Constructive.cfalse",
"FStar.Pervasives.false_elim"
] | [] | (*
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.Constructive
type cand p1 p2 =
| Conj : h1:p1 -> h2:p2 -> cand p1 p2
type cor p1 p2 =
| IntroL : h:p1 -> cor p1 p2
| IntroR : h:p2 -> cor p1 p2
type cimp a b = a -> Tot b
type ciff a b = cand (cimp a b) (cimp b a)
noeq type cexists (#a:Type) (p:a -> Type) =
| ExIntro : x:a -> h:p x -> cexists p
// val ex_intro_x : #a:Type -> #p:(a -> Type) -> projectee:cexists p -> Tot a
// let ex_intro_x #a #p = function
// | ExIntro x _ -> x
type ceq (#a:Type) x : a -> Type =
| Refl : ceq #a x x
type ceq_type (a:Type) : Type -> Type =
| ReflType : ceq_type a a
val eq_ind : #a:Type -> x:a -> p:(a -> Type) -> f:p x -> y:a -> e:ceq x y -> Tot (p y)
let eq_ind #a x p f y _ = f
val ceq_eq : #a:Type{hasEq a} -> #x:a -> #y:a -> h:(ceq x y) -> Lemma (x = y)
let ceq_eq #a #x #y h = ()
val ceq_congruence : #a:Type -> #b:Type -> #x:a -> #y:a -> ceq x y ->
f:(a -> GTot b) -> GTot (ceq (f x) (f y))
let ceq_congruence #a #b #x #y h f = Refl #_ #(f x) //refuse to infer terms with non-Tot effect
val ceq_symm : #a:Type -> #x:a -> #y:a -> ceq x y -> Tot (ceq y x)
let ceq_symm #a #x #y h = Refl
val ceq_trans : #a:Type -> #x:a -> #y:a -> #z:a -> ceq x y -> ceq y z -> Tot (ceq x z)
let ceq_trans #a #x #y #z hxy hyz = Refl
type ctrue =
| I : ctrue
(* hopefully this is an empty type *)
type cfalse : Type =
val cfalse_elim : #a:Type -> cfalse -> Tot a
let cfalse_elim #a f = match f with | false | false | FStar.Constructive.fst | {
"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"
} | null | val false_elim2 : #a:Type -> cfalse -> Tot a | [] | FStar.Constructive.false_elim2 | {
"file_name": "ulib/legacy/FStar.Constructive.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | x: FStar.Constructive.cfalse -> a | {
"end_col": 36,
"end_line": 67,
"start_col": 23,
"start_line": 67
} |
Prims.Tot | val ceq_trans : #a:Type -> #x:a -> #y:a -> #z:a -> ceq x y -> ceq y z -> Tot (ceq x z) | [
{
"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
}
] | false | let ceq_trans #a #x #y #z hxy hyz = Refl | val ceq_trans : #a:Type -> #x:a -> #y:a -> #z:a -> ceq x y -> ceq y z -> Tot (ceq x z)
let ceq_trans #a #x #y #z hxy hyz = | false | null | false | Refl | {
"checked_file": "FStar.Constructive.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Constructive.fst"
} | [
"total"
] | [
"FStar.Constructive.ceq",
"FStar.Constructive.Refl"
] | [] | (*
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.Constructive
type cand p1 p2 =
| Conj : h1:p1 -> h2:p2 -> cand p1 p2
type cor p1 p2 =
| IntroL : h:p1 -> cor p1 p2
| IntroR : h:p2 -> cor p1 p2
type cimp a b = a -> Tot b
type ciff a b = cand (cimp a b) (cimp b a)
noeq type cexists (#a:Type) (p:a -> Type) =
| ExIntro : x:a -> h:p x -> cexists p
// val ex_intro_x : #a:Type -> #p:(a -> Type) -> projectee:cexists p -> Tot a
// let ex_intro_x #a #p = function
// | ExIntro x _ -> x
type ceq (#a:Type) x : a -> Type =
| Refl : ceq #a x x
type ceq_type (a:Type) : Type -> Type =
| ReflType : ceq_type a a
val eq_ind : #a:Type -> x:a -> p:(a -> Type) -> f:p x -> y:a -> e:ceq x y -> Tot (p y)
let eq_ind #a x p f y _ = f
val ceq_eq : #a:Type{hasEq a} -> #x:a -> #y:a -> h:(ceq x y) -> Lemma (x = y)
let ceq_eq #a #x #y h = ()
val ceq_congruence : #a:Type -> #b:Type -> #x:a -> #y:a -> ceq x y ->
f:(a -> GTot b) -> GTot (ceq (f x) (f y))
let ceq_congruence #a #b #x #y h f = Refl #_ #(f x) //refuse to infer terms with non-Tot effect
val ceq_symm : #a:Type -> #x:a -> #y:a -> ceq x y -> Tot (ceq y x)
let ceq_symm #a #x #y h = Refl | false | false | FStar.Constructive.fst | {
"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"
} | null | val ceq_trans : #a:Type -> #x:a -> #y:a -> #z:a -> ceq x y -> ceq y z -> Tot (ceq x z) | [] | FStar.Constructive.ceq_trans | {
"file_name": "ulib/legacy/FStar.Constructive.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | hxy: FStar.Constructive.ceq x y -> hyz: FStar.Constructive.ceq y z -> FStar.Constructive.ceq x z | {
"end_col": 40,
"end_line": 55,
"start_col": 36,
"start_line": 55
} |
Prims.Tot | val false_elim : #a:Type -> u:unit{false} -> Tot a | [
{
"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
}
] | false | let false_elim #a u = false_elim () | val false_elim : #a:Type -> u:unit{false} -> Tot a
let false_elim #a u = | false | null | false | false_elim () | {
"checked_file": "FStar.Constructive.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Constructive.fst"
} | [
"total"
] | [
"Prims.unit",
"Prims.b2t",
"FStar.Pervasives.false_elim"
] | [] | (*
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.Constructive
type cand p1 p2 =
| Conj : h1:p1 -> h2:p2 -> cand p1 p2
type cor p1 p2 =
| IntroL : h:p1 -> cor p1 p2
| IntroR : h:p2 -> cor p1 p2
type cimp a b = a -> Tot b
type ciff a b = cand (cimp a b) (cimp b a)
noeq type cexists (#a:Type) (p:a -> Type) =
| ExIntro : x:a -> h:p x -> cexists p
// val ex_intro_x : #a:Type -> #p:(a -> Type) -> projectee:cexists p -> Tot a
// let ex_intro_x #a #p = function
// | ExIntro x _ -> x
type ceq (#a:Type) x : a -> Type =
| Refl : ceq #a x x
type ceq_type (a:Type) : Type -> Type =
| ReflType : ceq_type a a
val eq_ind : #a:Type -> x:a -> p:(a -> Type) -> f:p x -> y:a -> e:ceq x y -> Tot (p y)
let eq_ind #a x p f y _ = f
val ceq_eq : #a:Type{hasEq a} -> #x:a -> #y:a -> h:(ceq x y) -> Lemma (x = y)
let ceq_eq #a #x #y h = ()
val ceq_congruence : #a:Type -> #b:Type -> #x:a -> #y:a -> ceq x y ->
f:(a -> GTot b) -> GTot (ceq (f x) (f y))
let ceq_congruence #a #b #x #y h f = Refl #_ #(f x) //refuse to infer terms with non-Tot effect
val ceq_symm : #a:Type -> #x:a -> #y:a -> ceq x y -> Tot (ceq y x)
let ceq_symm #a #x #y h = Refl
val ceq_trans : #a:Type -> #x:a -> #y:a -> #z:a -> ceq x y -> ceq y z -> Tot (ceq x z)
let ceq_trans #a #x #y #z hxy hyz = Refl
type ctrue =
| I : ctrue
(* hopefully this is an empty type *)
type cfalse : Type =
val cfalse_elim : #a:Type -> cfalse -> Tot a
let cfalse_elim #a f = match f with
val false_elim2 : #a:Type -> cfalse -> Tot a
let false_elim2 #a x = false_elim () | false | false | FStar.Constructive.fst | {
"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"
} | null | val false_elim : #a:Type -> u:unit{false} -> Tot a | [] | FStar.Constructive.false_elim | {
"file_name": "ulib/legacy/FStar.Constructive.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | u92: u93: Prims.unit{false} -> a | {
"end_col": 35,
"end_line": 70,
"start_col": 22,
"start_line": 70
} |
Prims.GTot | val ceq_congruence : #a:Type -> #b:Type -> #x:a -> #y:a -> ceq x y ->
f:(a -> GTot b) -> GTot (ceq (f x) (f y)) | [
{
"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
}
] | false | let ceq_congruence #a #b #x #y h f = Refl #_ #(f x) | val ceq_congruence : #a:Type -> #b:Type -> #x:a -> #y:a -> ceq x y ->
f:(a -> GTot b) -> GTot (ceq (f x) (f y))
let ceq_congruence #a #b #x #y h f = | false | null | false | Refl #_ #(f x) | {
"checked_file": "FStar.Constructive.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Constructive.fst"
} | [
"sometrivial"
] | [
"FStar.Constructive.ceq",
"FStar.Constructive.Refl"
] | [] | (*
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.Constructive
type cand p1 p2 =
| Conj : h1:p1 -> h2:p2 -> cand p1 p2
type cor p1 p2 =
| IntroL : h:p1 -> cor p1 p2
| IntroR : h:p2 -> cor p1 p2
type cimp a b = a -> Tot b
type ciff a b = cand (cimp a b) (cimp b a)
noeq type cexists (#a:Type) (p:a -> Type) =
| ExIntro : x:a -> h:p x -> cexists p
// val ex_intro_x : #a:Type -> #p:(a -> Type) -> projectee:cexists p -> Tot a
// let ex_intro_x #a #p = function
// | ExIntro x _ -> x
type ceq (#a:Type) x : a -> Type =
| Refl : ceq #a x x
type ceq_type (a:Type) : Type -> Type =
| ReflType : ceq_type a a
val eq_ind : #a:Type -> x:a -> p:(a -> Type) -> f:p x -> y:a -> e:ceq x y -> Tot (p y)
let eq_ind #a x p f y _ = f
val ceq_eq : #a:Type{hasEq a} -> #x:a -> #y:a -> h:(ceq x y) -> Lemma (x = y)
let ceq_eq #a #x #y h = ()
val ceq_congruence : #a:Type -> #b:Type -> #x:a -> #y:a -> ceq x y -> | false | false | FStar.Constructive.fst | {
"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"
} | null | val ceq_congruence : #a:Type -> #b:Type -> #x:a -> #y:a -> ceq x y ->
f:(a -> GTot b) -> GTot (ceq (f x) (f y)) | [] | FStar.Constructive.ceq_congruence | {
"file_name": "ulib/legacy/FStar.Constructive.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | h: FStar.Constructive.ceq x y -> f: (_: a -> Prims.GTot b)
-> Prims.GTot (FStar.Constructive.ceq (f x) (f y)) | {
"end_col": 51,
"end_line": 49,
"start_col": 37,
"start_line": 49
} |
Prims.Tot | val cfalse_elim : #a:Type -> cfalse -> Tot a | [
{
"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
}
] | false | let cfalse_elim #a f = match f with | val cfalse_elim : #a:Type -> cfalse -> Tot a
let cfalse_elim #a f = | false | null | false | match f with | {
"checked_file": "FStar.Constructive.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Constructive.fst"
} | [
"total"
] | [
"FStar.Constructive.cfalse"
] | [] | (*
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.Constructive
type cand p1 p2 =
| Conj : h1:p1 -> h2:p2 -> cand p1 p2
type cor p1 p2 =
| IntroL : h:p1 -> cor p1 p2
| IntroR : h:p2 -> cor p1 p2
type cimp a b = a -> Tot b
type ciff a b = cand (cimp a b) (cimp b a)
noeq type cexists (#a:Type) (p:a -> Type) =
| ExIntro : x:a -> h:p x -> cexists p
// val ex_intro_x : #a:Type -> #p:(a -> Type) -> projectee:cexists p -> Tot a
// let ex_intro_x #a #p = function
// | ExIntro x _ -> x
type ceq (#a:Type) x : a -> Type =
| Refl : ceq #a x x
type ceq_type (a:Type) : Type -> Type =
| ReflType : ceq_type a a
val eq_ind : #a:Type -> x:a -> p:(a -> Type) -> f:p x -> y:a -> e:ceq x y -> Tot (p y)
let eq_ind #a x p f y _ = f
val ceq_eq : #a:Type{hasEq a} -> #x:a -> #y:a -> h:(ceq x y) -> Lemma (x = y)
let ceq_eq #a #x #y h = ()
val ceq_congruence : #a:Type -> #b:Type -> #x:a -> #y:a -> ceq x y ->
f:(a -> GTot b) -> GTot (ceq (f x) (f y))
let ceq_congruence #a #b #x #y h f = Refl #_ #(f x) //refuse to infer terms with non-Tot effect
val ceq_symm : #a:Type -> #x:a -> #y:a -> ceq x y -> Tot (ceq y x)
let ceq_symm #a #x #y h = Refl
val ceq_trans : #a:Type -> #x:a -> #y:a -> #z:a -> ceq x y -> ceq y z -> Tot (ceq x z)
let ceq_trans #a #x #y #z hxy hyz = Refl
type ctrue =
| I : ctrue
(* hopefully this is an empty type *)
type cfalse : Type = | false | false | FStar.Constructive.fst | {
"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"
} | null | val cfalse_elim : #a:Type -> cfalse -> Tot a | [] | FStar.Constructive.cfalse_elim | {
"file_name": "ulib/legacy/FStar.Constructive.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | f: FStar.Constructive.cfalse -> a | {
"end_col": 35,
"end_line": 64,
"start_col": 23,
"start_line": 64
} |
Prims.GTot | val stc_soundness
(#g:stt_env)
(#st:st_comp)
(d_st:st_comp_typing g st)
: GTot (RT.tot_typing ( elab_env g)
(elab_term st.res)
(RT.tm_type st.u) &
RT.tot_typing (elab_env g)
(elab_term st.pre)
vprop_tm &
RT.tot_typing (elab_env g)
(mk_abs (elab_term st.res) R.Q_Explicit
(elab_term st.post))
(post1_type_bind (elab_term st.res))) | [
{
"abbrev": true,
"full_module": "Pulse.Soundness.STT",
"short_module": "STT"
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness.Common",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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
}
] | false | let stc_soundness
(#g:stt_env)
(#st:st_comp)
(d_st:st_comp_typing g st)
: GTot (RT.tot_typing (elab_env g)
(elab_term st.res)
(RT.tm_type st.u) &
RT.tot_typing (elab_env g)
(elab_term st.pre)
vprop_tm &
RT.tot_typing (elab_env g)
(mk_abs (elab_term st.res) R.Q_Explicit
(elab_term st.post))
(post1_type_bind (elab_term st.res))) =
let STC _ st x dres dpre dpost = d_st in
let res_typing = tot_typing_soundness dres in
let pre_typing = tot_typing_soundness dpre in
calc (==) {
RT.close_term (elab_term (open_term st.post x)) x;
(==) { elab_open_commute st.post x }
RT.close_term (RT.open_term (elab_term st.post) x) x;
(==) {
elab_freevars st.post;
RT.close_open_inverse (elab_term st.post) x
}
elab_term st.post;
};
let post_typing = mk_t_abs_tot g ppname_default dres dpost in
res_typing, pre_typing, post_typing | val stc_soundness
(#g:stt_env)
(#st:st_comp)
(d_st:st_comp_typing g st)
: GTot (RT.tot_typing ( elab_env g)
(elab_term st.res)
(RT.tm_type st.u) &
RT.tot_typing (elab_env g)
(elab_term st.pre)
vprop_tm &
RT.tot_typing (elab_env g)
(mk_abs (elab_term st.res) R.Q_Explicit
(elab_term st.post))
(post1_type_bind (elab_term st.res)))
let stc_soundness (#g: stt_env) (#st: st_comp) (d_st: st_comp_typing g st)
: GTot
(RT.tot_typing (elab_env g) (elab_term st.res) (RT.tm_type st.u) &
RT.tot_typing (elab_env g) (elab_term st.pre) vprop_tm &
RT.tot_typing (elab_env g)
(mk_abs (elab_term st.res) R.Q_Explicit (elab_term st.post))
(post1_type_bind (elab_term st.res))) = | false | null | false | let STC _ st x dres dpre dpost = d_st in
let res_typing = tot_typing_soundness dres in
let pre_typing = tot_typing_soundness dpre in
calc ( == ) {
RT.close_term (elab_term (open_term st.post x)) x;
( == ) { elab_open_commute st.post x }
RT.close_term (RT.open_term (elab_term st.post) x) x;
( == ) { (elab_freevars st.post;
RT.close_open_inverse (elab_term st.post) x) }
elab_term st.post;
};
let post_typing = mk_t_abs_tot g ppname_default dres dpost in
res_typing, pre_typing, post_typing | {
"checked_file": "Pulse.Soundness.Comp.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Soundness.STT.fsti.checked",
"Pulse.Soundness.Common.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Core.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Soundness.Comp.fst"
} | [
"sometrivial"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.st_comp",
"Pulse.Typing.st_comp_typing",
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.var",
"Prims.l_and",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_None",
"Pulse.Syntax.Base.typ",
"Pulse.Typing.Env.lookup",
"Prims.l_not",
"FStar.Set.mem",
"Pulse.Syntax.Naming.freevars",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__post",
"Pulse.Typing.universe_of",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__res",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__u",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__pre",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Typing.Env.push_binding",
"Pulse.Syntax.Base.ppname_default",
"Pulse.Syntax.Naming.open_term",
"FStar.Pervasives.Native.Mktuple3",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_term",
"FStar.Reflection.Typing.tm_type",
"Pulse.Reflection.Util.vprop_tm",
"Pulse.Reflection.Util.mk_abs",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Soundness.Common.post1_type_bind",
"Pulse.Reflection.Util.mk_abs_with_name",
"Pulse.Syntax.Base.__proj__Mkppname__item__name",
"Pulse.Elaborate.Pure.elab_qual",
"FStar.Pervasives.Native.None",
"Pulse.Syntax.Base.qualifier",
"Pulse.Syntax.Pure.tm_arrow",
"Pulse.Syntax.Base.Mkbinder",
"Pulse.Syntax.Naming.close_comp",
"Pulse.Syntax.Base.C_Tot",
"Pulse.Soundness.Common.mk_t_abs_tot",
"Prims.unit",
"FStar.Calc.calc_finish",
"FStar.Reflection.Types.term",
"Prims.eq2",
"FStar.Reflection.Typing.close_term",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"FStar.Calc.calc_step",
"FStar.Reflection.Typing.open_term",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Pulse.Elaborate.elab_open_commute",
"Prims.squash",
"FStar.Reflection.Typing.close_open_inverse",
"Pulse.Elaborate.elab_freevars",
"Pulse.Soundness.Common.tot_typing_soundness",
"Pulse.Syntax.Pure.tm_type",
"FStar.Pervasives.Native.tuple3"
] | [] | module Pulse.Soundness.Comp
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate.Core
open Pulse.Elaborate
open Pulse.Soundness.Common
module STT = Pulse.Soundness.STT
let stc_soundness
(#g:stt_env)
(#st:st_comp)
(d_st:st_comp_typing g st)
: GTot (RT.tot_typing (elab_env g)
(elab_term st.res)
(RT.tm_type st.u) &
RT.tot_typing (elab_env g)
(elab_term st.pre)
vprop_tm &
RT.tot_typing (elab_env g)
(mk_abs (elab_term st.res) R.Q_Explicit | false | false | Pulse.Soundness.Comp.fst | {
"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"
} | null | val stc_soundness
(#g:stt_env)
(#st:st_comp)
(d_st:st_comp_typing g st)
: GTot (RT.tot_typing ( elab_env g)
(elab_term st.res)
(RT.tm_type st.u) &
RT.tot_typing (elab_env g)
(elab_term st.pre)
vprop_tm &
RT.tot_typing (elab_env g)
(mk_abs (elab_term st.res) R.Q_Explicit
(elab_term st.post))
(post1_type_bind (elab_term st.res))) | [] | Pulse.Soundness.Comp.stc_soundness | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Comp.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | d_st: Pulse.Typing.st_comp_typing g st
-> Prims.GTot
((FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Pure.elab_term (Mkst_comp?.res st))
(FStar.Reflection.Typing.tm_type (Mkst_comp?.u st)) *
FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Pure.elab_term (Mkst_comp?.pre st))
Pulse.Reflection.Util.vprop_tm) *
FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Reflection.Util.mk_abs (Pulse.Elaborate.Pure.elab_term (Mkst_comp?.res st))
FStar.Reflection.V2.Data.Q_Explicit
(Pulse.Elaborate.Pure.elab_term (Mkst_comp?.post st)))
(Pulse.Soundness.Common.post1_type_bind (Pulse.Elaborate.Pure.elab_term (Mkst_comp?.res st))
)) | {
"end_col": 37,
"end_line": 42,
"start_col": 63,
"start_line": 26
} |
Prims.GTot | val comp_typing_soundness (g:stt_env)
(c:comp)
(uc:universe)
(d:comp_typing g c uc)
: GTot (RT.tot_typing (elab_env g) (elab_comp c) (RT.tm_type uc)) | [
{
"abbrev": true,
"full_module": "Pulse.Soundness.STT",
"short_module": "STT"
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Reflection.Typing",
"short_module": "RT"
},
{
"abbrev": true,
"full_module": "FStar.Reflection.V2",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Pulse.Soundness.Common",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Reflection.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Soundness",
"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
}
] | false | let comp_typing_soundness (g:stt_env)
(c:comp)
(uc:universe)
(d:comp_typing g c uc)
: GTot (RT.tot_typing (elab_env g)
(elab_comp c)
(RT.tm_type uc))
(decreases d)
= match d with
| CT_Tot _ t _ dt ->
tot_typing_soundness dt
| CT_ST _ st d_st ->
let res_typing, pre_typing, post_typing = stc_soundness d_st in
STT.stt_typing res_typing pre_typing post_typing
| CT_STAtomic _ i st d_i d_st ->
let i_typing = tot_typing_soundness d_i in
let res_typing, pre_typing, post_typing = stc_soundness d_st in
STT.stt_atomic_typing res_typing i_typing pre_typing post_typing
| CT_STGhost _ i st d_i d_st ->
let i_typing = tot_typing_soundness d_i in
let res_typing, pre_typing, post_typing = stc_soundness d_st in
STT.stt_ghost_typing res_typing i_typing pre_typing post_typing | val comp_typing_soundness (g:stt_env)
(c:comp)
(uc:universe)
(d:comp_typing g c uc)
: GTot (RT.tot_typing (elab_env g) (elab_comp c) (RT.tm_type uc))
let comp_typing_soundness (g: stt_env) (c: comp) (uc: universe) (d: comp_typing g c uc)
: GTot (RT.tot_typing (elab_env g) (elab_comp c) (RT.tm_type uc)) (decreases d) = | false | null | false | match d with
| CT_Tot _ t _ dt -> tot_typing_soundness dt
| CT_ST _ st d_st ->
let res_typing, pre_typing, post_typing = stc_soundness d_st in
STT.stt_typing res_typing pre_typing post_typing
| CT_STAtomic _ i st d_i d_st ->
let i_typing = tot_typing_soundness d_i in
let res_typing, pre_typing, post_typing = stc_soundness d_st in
STT.stt_atomic_typing res_typing i_typing pre_typing post_typing
| CT_STGhost _ i st d_i d_st ->
let i_typing = tot_typing_soundness d_i in
let res_typing, pre_typing, post_typing = stc_soundness d_st in
STT.stt_ghost_typing res_typing i_typing pre_typing post_typing | {
"checked_file": "Pulse.Soundness.Comp.fst.checked",
"dependencies": [
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.Soundness.STT.fsti.checked",
"Pulse.Soundness.Common.fst.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Elaborate.Core.fst.checked",
"Pulse.Elaborate.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Soundness.Comp.fst"
} | [
"sometrivial"
] | [
"Pulse.Soundness.Common.stt_env",
"Pulse.Syntax.Base.comp",
"Pulse.Syntax.Base.universe",
"Pulse.Typing.comp_typing",
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Pulse.Typing.universe_of",
"Pulse.Soundness.Common.tot_typing_soundness",
"Pulse.Syntax.Pure.tm_type",
"Pulse.Syntax.Base.st_comp",
"Pulse.Typing.st_comp_typing",
"FStar.Reflection.Typing.tot_typing",
"Pulse.Typing.elab_env",
"Pulse.Elaborate.Pure.elab_term",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__res",
"FStar.Reflection.Typing.tm_type",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__u",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__pre",
"Pulse.Reflection.Util.vprop_tm",
"Pulse.Reflection.Util.mk_abs",
"FStar.Reflection.V2.Data.Q_Explicit",
"Pulse.Syntax.Base.__proj__Mkst_comp__item__post",
"Pulse.Soundness.Common.post1_type_bind",
"Pulse.Soundness.STT.stt_typing",
"Pulse.Elaborate.Pure.elab_comp",
"FStar.Pervasives.Native.tuple3",
"Pulse.Soundness.Comp.stc_soundness",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_inames",
"Pulse.Soundness.STT.stt_atomic_typing",
"Pulse.Soundness.STT.stt_ghost_typing"
] | [] | module Pulse.Soundness.Comp
open Pulse.Syntax
open Pulse.Reflection.Util
open Pulse.Typing
open Pulse.Elaborate.Core
open Pulse.Elaborate
open Pulse.Soundness.Common
module STT = Pulse.Soundness.STT
let stc_soundness
(#g:stt_env)
(#st:st_comp)
(d_st:st_comp_typing g st)
: GTot (RT.tot_typing (elab_env g)
(elab_term st.res)
(RT.tm_type st.u) &
RT.tot_typing (elab_env g)
(elab_term st.pre)
vprop_tm &
RT.tot_typing (elab_env g)
(mk_abs (elab_term st.res) R.Q_Explicit
(elab_term st.post))
(post1_type_bind (elab_term st.res))) =
let STC _ st x dres dpre dpost = d_st in
let res_typing = tot_typing_soundness dres in
let pre_typing = tot_typing_soundness dpre in
calc (==) {
RT.close_term (elab_term (open_term st.post x)) x;
(==) { elab_open_commute st.post x }
RT.close_term (RT.open_term (elab_term st.post) x) x;
(==) {
elab_freevars st.post;
RT.close_open_inverse (elab_term st.post) x
}
elab_term st.post;
};
let post_typing = mk_t_abs_tot g ppname_default dres dpost in
res_typing, pre_typing, post_typing
#push-options "--query_stats --fuel 2 --ifuel 2 --z3rlimit_factor 2"
let comp_typing_soundness (g:stt_env)
(c:comp)
(uc:universe)
(d:comp_typing g c uc)
: GTot (RT.tot_typing (elab_env g)
(elab_comp c)
(RT.tm_type uc)) | false | false | Pulse.Soundness.Comp.fst | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 2,
"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": 2,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val comp_typing_soundness (g:stt_env)
(c:comp)
(uc:universe)
(d:comp_typing g c uc)
: GTot (RT.tot_typing (elab_env g) (elab_comp c) (RT.tm_type uc)) | [] | Pulse.Soundness.Comp.comp_typing_soundness | {
"file_name": "lib/steel/pulse/Pulse.Soundness.Comp.fst",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} |
g: Pulse.Soundness.Common.stt_env ->
c: Pulse.Syntax.Base.comp ->
uc: Pulse.Syntax.Base.universe ->
d: Pulse.Typing.comp_typing g c uc
-> Prims.GTot
(FStar.Reflection.Typing.tot_typing (Pulse.Typing.elab_env g)
(Pulse.Elaborate.Pure.elab_comp c)
(FStar.Reflection.Typing.tm_type uc)) | {
"end_col": 69,
"end_line": 69,
"start_col": 4,
"start_line": 53
} |
Prims.Tot | val get_vale_heap (vhi: vale_full_heap) : vale_heap | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap | val get_vale_heap (vhi: vale_full_heap) : vale_heap
let get_vale_heap (vhi: vale_full_heap) : vale_heap = | false | null | false | vhi.vf_heap | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.vale_full_heap",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heap",
"Vale.X64.Memory.vale_heap"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val get_vale_heap (vhi: vale_full_heap) : vale_heap | [] | Vale.X64.Memory.get_vale_heap | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | vhi: Vale.X64.Memory.vale_full_heap -> Vale.X64.Memory.vale_heap | {
"end_col": 64,
"end_line": 14,
"start_col": 53,
"start_line": 14
} |
Prims.Tot | val scale_by (scale index: int) : int | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let scale_by (scale index:int) : int = scale * index | val scale_by (scale index: int) : int
let scale_by (scale index: int) : int = | false | null | false | scale * index | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Prims.int",
"FStar.Mul.op_Star"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val scale_by (scale index: int) : int | [] | Vale.X64.Memory.scale_by | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | scale: Prims.int -> index: Prims.int -> Prims.int | {
"end_col": 52,
"end_line": 41,
"start_col": 39,
"start_line": 41
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let vuint128 = TUInt128 | let vuint128 = | false | null | false | TUInt128 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.TUInt128"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val vuint128 : Vale.Arch.HeapTypes_s.base_typ | [] | Vale.X64.Memory.vuint128 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Arch.HeapTypes_s.base_typ | {
"end_col": 30,
"end_line": 71,
"start_col": 22,
"start_line": 71
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let buffer16 = buffer vuint16 | let buffer16 = | false | null | false | buffer vuint16 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer",
"Vale.X64.Memory.vuint16"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val buffer16 : Type0 | [] | Vale.X64.Memory.buffer16 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 29,
"end_line": 74,
"start_col": 15,
"start_line": 74
} |
|
Prims.Tot | val scale4 (index: int) : int | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let scale4 (index:int) : int = scale_by 4 index | val scale4 (index: int) : int
let scale4 (index: int) : int = | false | null | false | scale_by 4 index | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Prims.int",
"Vale.X64.Memory.scale_by"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val scale4 (index: int) : int | [] | Vale.X64.Memory.scale4 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | index: Prims.int -> Prims.int | {
"end_col": 54,
"end_line": 43,
"start_col": 38,
"start_line": 43
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let nat8 = Vale.Def.Words_s.nat8 | let nat8 = | false | null | false | Vale.Def.Words_s.nat8 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Def.Words_s.nat8"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val nat8 : Type0 | [] | Vale.X64.Memory.nat8 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 39,
"end_line": 27,
"start_col": 18,
"start_line": 27
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let vuint64 = TUInt64 | let vuint64 = | false | null | false | TUInt64 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.TUInt64"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val vuint64 : Vale.Arch.HeapTypes_s.base_typ | [] | Vale.X64.Memory.vuint64 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Arch.HeapTypes_s.base_typ | {
"end_col": 28,
"end_line": 70,
"start_col": 21,
"start_line": 70
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let vuint32 = TUInt32 | let vuint32 = | false | null | false | TUInt32 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.TUInt32"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val vuint32 : Vale.Arch.HeapTypes_s.base_typ | [] | Vale.X64.Memory.vuint32 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Arch.HeapTypes_s.base_typ | {
"end_col": 28,
"end_line": 69,
"start_col": 21,
"start_line": 69
} |
|
Prims.Tot | val valid_buffer_write (#t: base_typ) (h: vale_heap) (b: buffer t) (i: int) : prop0 | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b | val valid_buffer_write (#t: base_typ) (h: vale_heap) (b: buffer t) (i: int) : prop0
let valid_buffer_write (#t: base_typ) (h: vale_heap) (b: buffer t) (i: int) : prop0 = | false | null | false | valid_buffer_read h b i /\ buffer_writeable b | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.X64.Memory.vale_heap",
"Vale.X64.Memory.buffer",
"Prims.int",
"Prims.l_and",
"Vale.X64.Memory.valid_buffer_read",
"Vale.X64.Memory.buffer_writeable",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b | false | false | Vale.X64.Memory.fsti | {
"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"
} | null | val valid_buffer_write (#t: base_typ) (h: vale_heap) (b: buffer t) (i: int) : prop0 | [] | Vale.X64.Memory.valid_buffer_write | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | h: Vale.X64.Memory.vale_heap -> b: Vale.X64.Memory.buffer t -> i: Prims.int -> Vale.Def.Prop_s.prop0 | {
"end_col": 47,
"end_line": 64,
"start_col": 2,
"start_line": 64
} |
Prims.Tot | val buffer (t: base_typ) : Type0 | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t | val buffer (t: base_typ) : Type0
let buffer (t: base_typ) : Type0 = | false | null | false | Vale.Arch.HeapImpl.buffer t | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.Arch.HeapImpl.buffer"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val buffer (t: base_typ) : Type0 | [] | Vale.X64.Memory.buffer | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Vale.Arch.HeapTypes_s.base_typ -> Type0 | {
"end_col": 68,
"end_line": 47,
"start_col": 41,
"start_line": 47
} |
Prims.Tot | val valid_buffer_read (#t: base_typ) (h: vale_heap) (b: buffer t) (i: int) : prop0 | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b | val valid_buffer_read (#t: base_typ) (h: vale_heap) (b: buffer t) (i: int) : prop0
let valid_buffer_read (#t: base_typ) (h: vale_heap) (b: buffer t) (i: int) : prop0 = | false | null | false | 0 <= i /\ i < buffer_length b /\ buffer_readable h b | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.X64.Memory.vale_heap",
"Vale.X64.Memory.buffer",
"Prims.int",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Vale.X64.Memory.buffer_length",
"Vale.X64.Memory.buffer_readable",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0 | false | false | Vale.X64.Memory.fsti | {
"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"
} | null | val valid_buffer_read (#t: base_typ) (h: vale_heap) (b: buffer t) (i: int) : prop0 | [] | Vale.X64.Memory.valid_buffer_read | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | h: Vale.X64.Memory.vale_heap -> b: Vale.X64.Memory.buffer t -> i: Prims.int -> Vale.Def.Prop_s.prop0 | {
"end_col": 54,
"end_line": 61,
"start_col": 2,
"start_line": 61
} |
Prims.Tot | val scale16 (index: int) : int | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let scale16 (index:int) : int = scale_by 16 index | val scale16 (index: int) : int
let scale16 (index: int) : int = | false | null | false | scale_by 16 index | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Prims.int",
"Vale.X64.Memory.scale_by"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val scale16 (index: int) : int | [] | Vale.X64.Memory.scale16 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | index: Prims.int -> Prims.int | {
"end_col": 56,
"end_line": 45,
"start_col": 39,
"start_line": 45
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let heaplet_id = heaplet_id | let heaplet_id = | false | null | false | heaplet_id | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapImpl.heaplet_id"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val heaplet_id : Type0 | [] | Vale.X64.Memory.heaplet_id | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 34,
"end_line": 11,
"start_col": 24,
"start_line": 11
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let buffer128 = buffer vuint128 | let buffer128 = | false | null | false | buffer vuint128 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer",
"Vale.X64.Memory.vuint128"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16
let buffer32 = buffer vuint32 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val buffer128 : Type0 | [] | Vale.X64.Memory.buffer128 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 31,
"end_line": 77,
"start_col": 16,
"start_line": 77
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let buffer8 = buffer vuint8 | let buffer8 = | false | null | false | buffer vuint8 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer",
"Vale.X64.Memory.vuint8"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val buffer8 : Type0 | [] | Vale.X64.Memory.buffer8 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 27,
"end_line": 73,
"start_col": 14,
"start_line": 73
} |
|
Prims.Tot | val scale8 (index: int) : int | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let scale8 (index:int) : int = scale_by 8 index | val scale8 (index: int) : int
let scale8 (index: int) : int = | false | null | false | scale_by 8 index | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Prims.int",
"Vale.X64.Memory.scale_by"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val scale8 (index: int) : int | [] | Vale.X64.Memory.scale8 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | index: Prims.int -> Prims.int | {
"end_col": 54,
"end_line": 44,
"start_col": 38,
"start_line": 44
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let vale_full_heap = vale_full_heap | let vale_full_heap = | false | null | false | vale_full_heap | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapImpl.vale_full_heap"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val vale_full_heap : Type | [] | Vale.X64.Memory.vale_full_heap | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type | {
"end_col": 42,
"end_line": 10,
"start_col": 28,
"start_line": 10
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let nat32 = Vale.Def.Words_s.nat32 | let nat32 = | false | null | false | Vale.Def.Words_s.nat32 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Def.Words_s.nat32"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val nat32 : Type0 | [] | Vale.X64.Memory.nat32 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 41,
"end_line": 29,
"start_col": 19,
"start_line": 29
} |
|
Prims.Tot | val set_vale_heap (vfh: vale_full_heap) (vh: vale_heap) : vale_full_heap | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh} | val set_vale_heap (vfh: vale_full_heap) (vh: vale_heap) : vale_full_heap
let set_vale_heap (vfh: vale_full_heap) (vh: vale_heap) : vale_full_heap = | false | null | false | { vfh with vf_heap = vh } | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.vale_full_heap",
"Vale.X64.Memory.vale_heap",
"Vale.Arch.HeapImpl.Mkvale_full_heap",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr] | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val set_vale_heap (vfh: vale_full_heap) (vh: vale_heap) : vale_full_heap | [] | Vale.X64.Memory.set_vale_heap | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | vfh: Vale.X64.Memory.vale_full_heap -> vh: Vale.X64.Memory.vale_heap
-> Vale.X64.Memory.vale_full_heap | {
"end_col": 24,
"end_line": 18,
"start_col": 3,
"start_line": 18
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets | let vale_full_heap_equal (h1 h2: vale_full_heap) = | false | null | false | h1.vf_layout == h2.vf_layout /\ h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.vale_full_heap",
"Prims.l_and",
"Prims.eq2",
"Vale.Arch.HeapImpl.vale_heap_layout",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_layout",
"Vale.Arch.HeapImpl.vale_heap",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heap",
"Vale.Lib.Map16.equal",
"Vale.Arch.HeapImpl.__proj__Mkvale_full_heap__item__vf_heaplets",
"Prims.logical"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh} | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val vale_full_heap_equal : h1: Vale.X64.Memory.vale_full_heap -> h2: Vale.X64.Memory.vale_full_heap -> Prims.logical | [] | Vale.X64.Memory.vale_full_heap_equal | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | h1: Vale.X64.Memory.vale_full_heap -> h2: Vale.X64.Memory.vale_full_heap -> Prims.logical | {
"end_col": 43,
"end_line": 23,
"start_col": 2,
"start_line": 21
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let quad32 = Vale.Def.Types_s.quad32 | let quad32 = | false | null | false | Vale.Def.Types_s.quad32 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Def.Types_s.quad32"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val quad32 : Prims.eqtype | [] | Vale.X64.Memory.quad32 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Prims.eqtype | {
"end_col": 43,
"end_line": 31,
"start_col": 20,
"start_line": 31
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let nat16 = Vale.Def.Words_s.nat16 | let nat16 = | false | null | false | Vale.Def.Words_s.nat16 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Def.Words_s.nat16"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val nat16 : Type0 | [] | Vale.X64.Memory.nat16 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 41,
"end_line": 28,
"start_col": 19,
"start_line": 28
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let vale_heap = vale_heap | let vale_heap = | false | null | false | vale_heap | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapImpl.vale_heap"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val vale_heap : Type | [] | Vale.X64.Memory.vale_heap | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type | {
"end_col": 32,
"end_line": 9,
"start_col": 23,
"start_line": 9
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let buffer64 = buffer vuint64 | let buffer64 = | false | null | false | buffer vuint64 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer",
"Vale.X64.Memory.vuint64"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val buffer64 : Type0 | [] | Vale.X64.Memory.buffer64 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 29,
"end_line": 76,
"start_col": 15,
"start_line": 76
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let nat64 = Vale.Def.Words_s.nat64 | let nat64 = | false | null | false | Vale.Def.Words_s.nat64 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Def.Words_s.nat64"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val nat64 : Type0 | [] | Vale.X64.Memory.nat64 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 41,
"end_line": 30,
"start_col": 19,
"start_line": 30
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let buffer32 = buffer vuint32 | let buffer32 = | false | null | false | buffer vuint32 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.buffer",
"Vale.X64.Memory.vuint32"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val buffer32 : Type0 | [] | Vale.X64.Memory.buffer32 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Type0 | {
"end_col": 29,
"end_line": 75,
"start_col": 15,
"start_line": 75
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let vuint8 = TUInt8 | let vuint8 = | false | null | false | TUInt8 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.TUInt8"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val vuint8 : Vale.Arch.HeapTypes_s.base_typ | [] | Vale.X64.Memory.vuint8 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Arch.HeapTypes_s.base_typ | {
"end_col": 26,
"end_line": 67,
"start_col": 20,
"start_line": 67
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let valid_layout_buffer (#t:base_typ) (b:buffer t) (layout:vale_heap_layout) (h:vale_heap) (write:bool) =
valid_layout_buffer_id t b layout (get_heaplet_id h) false /\
valid_layout_buffer_id t b layout (get_heaplet_id h) write | let valid_layout_buffer
(#t: base_typ)
(b: buffer t)
(layout: vale_heap_layout)
(h: vale_heap)
(write: bool)
= | false | null | false | valid_layout_buffer_id t b layout (get_heaplet_id h) false /\
valid_layout_buffer_id t b layout (get_heaplet_id h) write | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.X64.Memory.buffer",
"Vale.Arch.HeapImpl.vale_heap_layout",
"Vale.X64.Memory.vale_heap",
"Prims.bool",
"Prims.l_and",
"Vale.X64.Memory.valid_layout_buffer_id",
"Vale.X64.Memory.get_heaplet_id",
"Prims.logical"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16
let buffer32 = buffer vuint32
let buffer64 = buffer vuint64
let buffer128 = buffer vuint128
val buffer_addr (#t:base_typ) (b:buffer t) (h:vale_heap) : GTot int
unfold
let locs_disjoint (ls:list loc) : prop0 =
BigOps.normal (BigOps.pairwise_and' (fun x y -> loc_disjoint x y /\ loc_disjoint y x) ls)
// equivalent to modifies; used to prove modifies clauses via modifies_goal_directed_trans
val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0
val lemma_modifies_goal_directed (s:loc) (h1 h2:vale_heap) : Lemma
(modifies s h1 h2 == modifies_goal_directed s h1 h2)
val buffer_length_buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : Lemma
(requires True)
(ensures (Seq.length (buffer_as_seq h b) == buffer_length b))
[SMTPat (Seq.length (buffer_as_seq h b))]
val modifies_buffer_elim (#t1:base_typ) (b:buffer t1) (p:loc) (h h':vale_heap) : Lemma
(requires
loc_disjoint (loc_buffer b) p /\
buffer_readable h b /\
modifies p h h'
)
(ensures
buffer_readable h b /\
buffer_readable h' b /\
buffer_as_seq h b == buffer_as_seq h' b
)
[SMTPatOr [
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)];
[SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b)];
]]
val modifies_buffer_addr (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h'
)
(ensures buffer_addr b h == buffer_addr b h')
[SMTPat (modifies p h h'); SMTPat (buffer_addr b h')]
val modifies_buffer_readable (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h' /\
buffer_readable h b
)
(ensures buffer_readable h' b)
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)]
val loc_disjoint_none_r (s:loc) : Lemma
(ensures (loc_disjoint s loc_none))
[SMTPat (loc_disjoint s loc_none)]
val loc_disjoint_union_r (s s1 s2:loc) : Lemma
(requires (loc_disjoint s s1 /\ loc_disjoint s s2))
(ensures (loc_disjoint s (loc_union s1 s2)))
[SMTPat (loc_disjoint s (loc_union s1 s2))]
val loc_includes_refl (s:loc) : Lemma
(loc_includes s s)
[SMTPat (loc_includes s s)]
val loc_includes_trans (s1 s2 s3:loc) : Lemma
(requires (loc_includes s1 s2 /\ loc_includes s2 s3))
(ensures (loc_includes s1 s3))
val loc_includes_union_r (s s1 s2:loc) : Lemma
(requires (loc_includes s s1 /\ loc_includes s s2))
(ensures (loc_includes s (loc_union s1 s2)))
[SMTPat (loc_includes s (loc_union s1 s2))]
val loc_includes_union_l (s1 s2 s:loc) : Lemma
(requires (loc_includes s1 s \/ loc_includes s2 s))
(ensures (loc_includes (loc_union s1 s2) s))
// for efficiency, no SMT pattern
val loc_includes_union_l_buffer (#t:base_typ) (s1 s2:loc) (b:buffer t) : Lemma
(requires (loc_includes s1 (loc_buffer b) \/ loc_includes s2 (loc_buffer b)))
(ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))
[SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]
val loc_includes_none (s:loc) : Lemma
(loc_includes s loc_none)
[SMTPat (loc_includes s loc_none)]
val modifies_refl (s:loc) (h:vale_heap) : Lemma
(modifies s h h)
[SMTPat (modifies s h h)]
val modifies_goal_directed_refl (s:loc) (h:vale_heap) : Lemma
(modifies_goal_directed s h h)
[SMTPat (modifies_goal_directed s h h)]
val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma
(requires (modifies s2 h h' /\ loc_includes s1 s2))
(ensures (modifies s1 h h'))
// for efficiency, no SMT pattern
val modifies_trans (s12:loc) (h1 h2:vale_heap) (s23:loc) (h3:vale_heap) : Lemma
(requires (modifies s12 h1 h2 /\ modifies s23 h2 h3))
(ensures (modifies (loc_union s12 s23) h1 h3))
// for efficiency, no SMT pattern
// Prove (modifies s13 h1 h3).
// To avoid unnecessary matches, don't introduce any other modifies terms.
// Introduce modifies_goal_directed instead.
val modifies_goal_directed_trans (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies s13 h1 h3)]
val modifies_goal_directed_trans2 (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies_goal_directed s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies_goal_directed s13 h1 h3)]
val buffer_read (#t:base_typ) (b:buffer t) (i:int) (h:vale_heap) : Ghost (base_typ_as_vale_type t)
(requires True)
(ensures (fun v ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
v == Seq.index (buffer_as_seq h b) i
))
val buffer_write (#t:base_typ) (b:buffer t) (i:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires buffer_readable h b /\ buffer_writeable b)
(ensures (fun h' ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
modifies (loc_buffer b) h h' /\
get_heaplet_id h' == get_heaplet_id h /\
buffer_readable h' b /\
buffer_as_seq h' b == Seq.upd (buffer_as_seq h b) i v
))
val valid_mem64 (ptr:int) (h:vale_heap) : GTot bool // is there a 64-bit word at address ptr?
val writeable_mem64 (ptr:int) (h:vale_heap) : GTot bool // can we write a 64-bit word at address ptr?
val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64 // the 64-bit word at ptr (if valid_mem64 holds)
val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap
val valid_mem128 (ptr:int) (h:vale_heap) : GTot bool
val writeable_mem128 (ptr:int) (h:vale_heap) : GTot bool
val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32
val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap
val lemma_valid_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_writeable_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_load_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem64 (buffer_addr b h + scale8 i) h == buffer_read b i h
)
val lemma_store_mem64 (b:buffer64) (i:nat) (v:nat64) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem64 (buffer_addr b h + scale8 i) v h == buffer_write b i v h
)
val lemma_valid_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_writeable_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_load_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem128 (buffer_addr b h + scale16 i) h == buffer_read b i h
)
val lemma_store_mem128 (b:buffer128) (i:nat) (v:quad32) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem128 (buffer_addr b h + scale16 i) v h == buffer_write b i v h
)
//Memtaint related functions
type memtaint = memTaint_t
val valid_taint_buf (#t:base_typ) (b:buffer t) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0
let valid_taint_buf64 (b:buffer64) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
let valid_taint_buf128 (b:buffer128) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
val lemma_valid_taint64
(b:buffer64)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf64 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale8 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 8 ==> Map.sel memTaint i' == t))
val lemma_valid_taint128
(b:buffer128)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf128 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale16 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 16 ==> Map.sel memTaint i' == t))
val same_memTaint64
(b:buffer64)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val same_memTaint128
(b:buffer128)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val modifies_valid_taint (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) (mt:memtaint) (tn:taint) : Lemma
(requires modifies p h h')
(ensures valid_taint_buf b h mt tn <==> valid_taint_buf b h' mt tn)
[SMTPat (modifies p h h'); SMTPat (valid_taint_buf b h' mt tn)]
val modifies_same_heaplet_id (l:loc) (h1 h2:vale_heap) : Lemma
(requires modifies l h1 h2)
(ensures get_heaplet_id h1 == get_heaplet_id h2)
[SMTPat (modifies l h1 h2); SMTPat (get_heaplet_id h2)]
// Buffers in different heaplets are disjoint
let buffer_info_disjoint (bi1 bi2:buffer_info) =
bi1.bi_typ =!= bi2.bi_typ \/ bi1.bi_heaplet =!= bi2.bi_heaplet ==>
loc_disjoint (loc_buffer bi1.bi_buffer) (loc_buffer bi2.bi_buffer)
// Requirements for enabling heaplets
let init_heaplets_req (h:vale_heap) (bs:Seq.seq buffer_info) =
(forall (i:nat).{:pattern (Seq.index bs i)} i < Seq.length bs ==>
buffer_readable h (Seq.index bs i).bi_buffer) /\
(forall (i1 i2:nat).{:pattern (Seq.index bs i1); (Seq.index bs i2)}
i1 < Seq.length bs /\ i2 < Seq.length bs ==> buffer_info_disjoint (Seq.index bs i1) (Seq.index bs i2))
// Location containing all mutable buffers
let rec loc_mutable_buffers (buffers:list buffer_info) : GTot loc =
match buffers with
| [] -> loc_none
| [{bi_mutable = Mutable; bi_buffer = b}] -> loc_buffer b
| ({bi_mutable = Immutable})::t -> loc_mutable_buffers t
| ({bi_mutable = Mutable; bi_buffer = b})::t -> loc_union (loc_buffer b) (loc_mutable_buffers t)
// Buffer b belongs to heaplet h
val valid_layout_buffer_id (t:base_typ) (b:buffer t) (layout:vale_heap_layout) (h_id:option heaplet_id) (write:bool) : prop0 | false | false | Vale.X64.Memory.fsti | {
"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"
} | null | val valid_layout_buffer : b: Vale.X64.Memory.buffer t ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
h: Vale.X64.Memory.vale_heap ->
write: Prims.bool
-> Prims.logical | [] | Vale.X64.Memory.valid_layout_buffer | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
b: Vale.X64.Memory.buffer t ->
layout: Vale.Arch.HeapImpl.vale_heap_layout ->
h: Vale.X64.Memory.vale_heap ->
write: Prims.bool
-> Prims.logical | {
"end_col": 60,
"end_line": 395,
"start_col": 2,
"start_line": 394
} |
|
Prims.GTot | val valid_taint_buf64 (b: buffer64) (h: vale_heap) (mt: memtaint) (tn: taint) : GTot prop0 | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let valid_taint_buf64 (b:buffer64) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn | val valid_taint_buf64 (b: buffer64) (h: vale_heap) (mt: memtaint) (tn: taint) : GTot prop0
let valid_taint_buf64 (b: buffer64) (h: vale_heap) (mt: memtaint) (tn: taint) : GTot prop0 = | false | null | false | valid_taint_buf b h mt tn | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"sometrivial"
] | [
"Vale.X64.Memory.buffer64",
"Vale.X64.Memory.vale_heap",
"Vale.X64.Memory.memtaint",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Memory.valid_taint_buf",
"Vale.X64.Memory.vuint64",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16
let buffer32 = buffer vuint32
let buffer64 = buffer vuint64
let buffer128 = buffer vuint128
val buffer_addr (#t:base_typ) (b:buffer t) (h:vale_heap) : GTot int
unfold
let locs_disjoint (ls:list loc) : prop0 =
BigOps.normal (BigOps.pairwise_and' (fun x y -> loc_disjoint x y /\ loc_disjoint y x) ls)
// equivalent to modifies; used to prove modifies clauses via modifies_goal_directed_trans
val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0
val lemma_modifies_goal_directed (s:loc) (h1 h2:vale_heap) : Lemma
(modifies s h1 h2 == modifies_goal_directed s h1 h2)
val buffer_length_buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : Lemma
(requires True)
(ensures (Seq.length (buffer_as_seq h b) == buffer_length b))
[SMTPat (Seq.length (buffer_as_seq h b))]
val modifies_buffer_elim (#t1:base_typ) (b:buffer t1) (p:loc) (h h':vale_heap) : Lemma
(requires
loc_disjoint (loc_buffer b) p /\
buffer_readable h b /\
modifies p h h'
)
(ensures
buffer_readable h b /\
buffer_readable h' b /\
buffer_as_seq h b == buffer_as_seq h' b
)
[SMTPatOr [
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)];
[SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b)];
]]
val modifies_buffer_addr (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h'
)
(ensures buffer_addr b h == buffer_addr b h')
[SMTPat (modifies p h h'); SMTPat (buffer_addr b h')]
val modifies_buffer_readable (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h' /\
buffer_readable h b
)
(ensures buffer_readable h' b)
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)]
val loc_disjoint_none_r (s:loc) : Lemma
(ensures (loc_disjoint s loc_none))
[SMTPat (loc_disjoint s loc_none)]
val loc_disjoint_union_r (s s1 s2:loc) : Lemma
(requires (loc_disjoint s s1 /\ loc_disjoint s s2))
(ensures (loc_disjoint s (loc_union s1 s2)))
[SMTPat (loc_disjoint s (loc_union s1 s2))]
val loc_includes_refl (s:loc) : Lemma
(loc_includes s s)
[SMTPat (loc_includes s s)]
val loc_includes_trans (s1 s2 s3:loc) : Lemma
(requires (loc_includes s1 s2 /\ loc_includes s2 s3))
(ensures (loc_includes s1 s3))
val loc_includes_union_r (s s1 s2:loc) : Lemma
(requires (loc_includes s s1 /\ loc_includes s s2))
(ensures (loc_includes s (loc_union s1 s2)))
[SMTPat (loc_includes s (loc_union s1 s2))]
val loc_includes_union_l (s1 s2 s:loc) : Lemma
(requires (loc_includes s1 s \/ loc_includes s2 s))
(ensures (loc_includes (loc_union s1 s2) s))
// for efficiency, no SMT pattern
val loc_includes_union_l_buffer (#t:base_typ) (s1 s2:loc) (b:buffer t) : Lemma
(requires (loc_includes s1 (loc_buffer b) \/ loc_includes s2 (loc_buffer b)))
(ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))
[SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]
val loc_includes_none (s:loc) : Lemma
(loc_includes s loc_none)
[SMTPat (loc_includes s loc_none)]
val modifies_refl (s:loc) (h:vale_heap) : Lemma
(modifies s h h)
[SMTPat (modifies s h h)]
val modifies_goal_directed_refl (s:loc) (h:vale_heap) : Lemma
(modifies_goal_directed s h h)
[SMTPat (modifies_goal_directed s h h)]
val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma
(requires (modifies s2 h h' /\ loc_includes s1 s2))
(ensures (modifies s1 h h'))
// for efficiency, no SMT pattern
val modifies_trans (s12:loc) (h1 h2:vale_heap) (s23:loc) (h3:vale_heap) : Lemma
(requires (modifies s12 h1 h2 /\ modifies s23 h2 h3))
(ensures (modifies (loc_union s12 s23) h1 h3))
// for efficiency, no SMT pattern
// Prove (modifies s13 h1 h3).
// To avoid unnecessary matches, don't introduce any other modifies terms.
// Introduce modifies_goal_directed instead.
val modifies_goal_directed_trans (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies s13 h1 h3)]
val modifies_goal_directed_trans2 (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies_goal_directed s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies_goal_directed s13 h1 h3)]
val buffer_read (#t:base_typ) (b:buffer t) (i:int) (h:vale_heap) : Ghost (base_typ_as_vale_type t)
(requires True)
(ensures (fun v ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
v == Seq.index (buffer_as_seq h b) i
))
val buffer_write (#t:base_typ) (b:buffer t) (i:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires buffer_readable h b /\ buffer_writeable b)
(ensures (fun h' ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
modifies (loc_buffer b) h h' /\
get_heaplet_id h' == get_heaplet_id h /\
buffer_readable h' b /\
buffer_as_seq h' b == Seq.upd (buffer_as_seq h b) i v
))
val valid_mem64 (ptr:int) (h:vale_heap) : GTot bool // is there a 64-bit word at address ptr?
val writeable_mem64 (ptr:int) (h:vale_heap) : GTot bool // can we write a 64-bit word at address ptr?
val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64 // the 64-bit word at ptr (if valid_mem64 holds)
val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap
val valid_mem128 (ptr:int) (h:vale_heap) : GTot bool
val writeable_mem128 (ptr:int) (h:vale_heap) : GTot bool
val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32
val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap
val lemma_valid_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_writeable_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_load_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem64 (buffer_addr b h + scale8 i) h == buffer_read b i h
)
val lemma_store_mem64 (b:buffer64) (i:nat) (v:nat64) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem64 (buffer_addr b h + scale8 i) v h == buffer_write b i v h
)
val lemma_valid_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_writeable_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_load_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem128 (buffer_addr b h + scale16 i) h == buffer_read b i h
)
val lemma_store_mem128 (b:buffer128) (i:nat) (v:quad32) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem128 (buffer_addr b h + scale16 i) v h == buffer_write b i v h
)
//Memtaint related functions
type memtaint = memTaint_t
val valid_taint_buf (#t:base_typ) (b:buffer t) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 | false | false | Vale.X64.Memory.fsti | {
"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"
} | null | val valid_taint_buf64 (b: buffer64) (h: vale_heap) (mt: memtaint) (tn: taint) : GTot prop0 | [] | Vale.X64.Memory.valid_taint_buf64 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
b: Vale.X64.Memory.buffer64 ->
h: Vale.X64.Memory.vale_heap ->
mt: Vale.X64.Memory.memtaint ->
tn: Vale.Arch.HeapTypes_s.taint
-> Prims.GTot Vale.Def.Prop_s.prop0 | {
"end_col": 27,
"end_line": 311,
"start_col": 2,
"start_line": 311
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let vuint16 = TUInt16 | let vuint16 = | false | null | false | TUInt16 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.TUInt16"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system: | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val vuint16 : Vale.Arch.HeapTypes_s.base_typ | [] | Vale.X64.Memory.vuint16 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Vale.Arch.HeapTypes_s.base_typ | {
"end_col": 28,
"end_line": 68,
"start_col": 21,
"start_line": 68
} |
|
Prims.Tot | val locs_disjoint (ls: list loc) : prop0 | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let locs_disjoint (ls:list loc) : prop0 =
BigOps.normal (BigOps.pairwise_and' (fun x y -> loc_disjoint x y /\ loc_disjoint y x) ls) | val locs_disjoint (ls: list loc) : prop0
let locs_disjoint (ls: list loc) : prop0 = | false | null | false | BigOps.normal (BigOps.pairwise_and' (fun x y -> loc_disjoint x y /\ loc_disjoint y x) ls) | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Prims.list",
"Vale.X64.Memory.loc",
"FStar.BigOps.normal",
"FStar.BigOps.pairwise_and'",
"Prims.l_and",
"Vale.X64.Memory.loc_disjoint",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16
let buffer32 = buffer vuint32
let buffer64 = buffer vuint64
let buffer128 = buffer vuint128
val buffer_addr (#t:base_typ) (b:buffer t) (h:vale_heap) : GTot int
unfold | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val locs_disjoint (ls: list loc) : prop0 | [] | Vale.X64.Memory.locs_disjoint | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | ls: Prims.list Vale.X64.Memory.loc -> Vale.Def.Prop_s.prop0 | {
"end_col": 91,
"end_line": 83,
"start_col": 2,
"start_line": 83
} |
Prims.GTot | val valid_taint_buf128 (b: buffer128) (h: vale_heap) (mt: memtaint) (tn: taint) : GTot prop0 | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let valid_taint_buf128 (b:buffer128) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn | val valid_taint_buf128 (b: buffer128) (h: vale_heap) (mt: memtaint) (tn: taint) : GTot prop0
let valid_taint_buf128 (b: buffer128) (h: vale_heap) (mt: memtaint) (tn: taint) : GTot prop0 = | false | null | false | valid_taint_buf b h mt tn | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"sometrivial"
] | [
"Vale.X64.Memory.buffer128",
"Vale.X64.Memory.vale_heap",
"Vale.X64.Memory.memtaint",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Memory.valid_taint_buf",
"Vale.X64.Memory.vuint128",
"Vale.Def.Prop_s.prop0"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16
let buffer32 = buffer vuint32
let buffer64 = buffer vuint64
let buffer128 = buffer vuint128
val buffer_addr (#t:base_typ) (b:buffer t) (h:vale_heap) : GTot int
unfold
let locs_disjoint (ls:list loc) : prop0 =
BigOps.normal (BigOps.pairwise_and' (fun x y -> loc_disjoint x y /\ loc_disjoint y x) ls)
// equivalent to modifies; used to prove modifies clauses via modifies_goal_directed_trans
val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0
val lemma_modifies_goal_directed (s:loc) (h1 h2:vale_heap) : Lemma
(modifies s h1 h2 == modifies_goal_directed s h1 h2)
val buffer_length_buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : Lemma
(requires True)
(ensures (Seq.length (buffer_as_seq h b) == buffer_length b))
[SMTPat (Seq.length (buffer_as_seq h b))]
val modifies_buffer_elim (#t1:base_typ) (b:buffer t1) (p:loc) (h h':vale_heap) : Lemma
(requires
loc_disjoint (loc_buffer b) p /\
buffer_readable h b /\
modifies p h h'
)
(ensures
buffer_readable h b /\
buffer_readable h' b /\
buffer_as_seq h b == buffer_as_seq h' b
)
[SMTPatOr [
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)];
[SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b)];
]]
val modifies_buffer_addr (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h'
)
(ensures buffer_addr b h == buffer_addr b h')
[SMTPat (modifies p h h'); SMTPat (buffer_addr b h')]
val modifies_buffer_readable (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h' /\
buffer_readable h b
)
(ensures buffer_readable h' b)
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)]
val loc_disjoint_none_r (s:loc) : Lemma
(ensures (loc_disjoint s loc_none))
[SMTPat (loc_disjoint s loc_none)]
val loc_disjoint_union_r (s s1 s2:loc) : Lemma
(requires (loc_disjoint s s1 /\ loc_disjoint s s2))
(ensures (loc_disjoint s (loc_union s1 s2)))
[SMTPat (loc_disjoint s (loc_union s1 s2))]
val loc_includes_refl (s:loc) : Lemma
(loc_includes s s)
[SMTPat (loc_includes s s)]
val loc_includes_trans (s1 s2 s3:loc) : Lemma
(requires (loc_includes s1 s2 /\ loc_includes s2 s3))
(ensures (loc_includes s1 s3))
val loc_includes_union_r (s s1 s2:loc) : Lemma
(requires (loc_includes s s1 /\ loc_includes s s2))
(ensures (loc_includes s (loc_union s1 s2)))
[SMTPat (loc_includes s (loc_union s1 s2))]
val loc_includes_union_l (s1 s2 s:loc) : Lemma
(requires (loc_includes s1 s \/ loc_includes s2 s))
(ensures (loc_includes (loc_union s1 s2) s))
// for efficiency, no SMT pattern
val loc_includes_union_l_buffer (#t:base_typ) (s1 s2:loc) (b:buffer t) : Lemma
(requires (loc_includes s1 (loc_buffer b) \/ loc_includes s2 (loc_buffer b)))
(ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))
[SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]
val loc_includes_none (s:loc) : Lemma
(loc_includes s loc_none)
[SMTPat (loc_includes s loc_none)]
val modifies_refl (s:loc) (h:vale_heap) : Lemma
(modifies s h h)
[SMTPat (modifies s h h)]
val modifies_goal_directed_refl (s:loc) (h:vale_heap) : Lemma
(modifies_goal_directed s h h)
[SMTPat (modifies_goal_directed s h h)]
val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma
(requires (modifies s2 h h' /\ loc_includes s1 s2))
(ensures (modifies s1 h h'))
// for efficiency, no SMT pattern
val modifies_trans (s12:loc) (h1 h2:vale_heap) (s23:loc) (h3:vale_heap) : Lemma
(requires (modifies s12 h1 h2 /\ modifies s23 h2 h3))
(ensures (modifies (loc_union s12 s23) h1 h3))
// for efficiency, no SMT pattern
// Prove (modifies s13 h1 h3).
// To avoid unnecessary matches, don't introduce any other modifies terms.
// Introduce modifies_goal_directed instead.
val modifies_goal_directed_trans (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies s13 h1 h3)]
val modifies_goal_directed_trans2 (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies_goal_directed s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies_goal_directed s13 h1 h3)]
val buffer_read (#t:base_typ) (b:buffer t) (i:int) (h:vale_heap) : Ghost (base_typ_as_vale_type t)
(requires True)
(ensures (fun v ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
v == Seq.index (buffer_as_seq h b) i
))
val buffer_write (#t:base_typ) (b:buffer t) (i:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires buffer_readable h b /\ buffer_writeable b)
(ensures (fun h' ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
modifies (loc_buffer b) h h' /\
get_heaplet_id h' == get_heaplet_id h /\
buffer_readable h' b /\
buffer_as_seq h' b == Seq.upd (buffer_as_seq h b) i v
))
val valid_mem64 (ptr:int) (h:vale_heap) : GTot bool // is there a 64-bit word at address ptr?
val writeable_mem64 (ptr:int) (h:vale_heap) : GTot bool // can we write a 64-bit word at address ptr?
val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64 // the 64-bit word at ptr (if valid_mem64 holds)
val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap
val valid_mem128 (ptr:int) (h:vale_heap) : GTot bool
val writeable_mem128 (ptr:int) (h:vale_heap) : GTot bool
val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32
val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap
val lemma_valid_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_writeable_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_load_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem64 (buffer_addr b h + scale8 i) h == buffer_read b i h
)
val lemma_store_mem64 (b:buffer64) (i:nat) (v:nat64) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem64 (buffer_addr b h + scale8 i) v h == buffer_write b i v h
)
val lemma_valid_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_writeable_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_load_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem128 (buffer_addr b h + scale16 i) h == buffer_read b i h
)
val lemma_store_mem128 (b:buffer128) (i:nat) (v:quad32) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem128 (buffer_addr b h + scale16 i) v h == buffer_write b i v h
)
//Memtaint related functions
type memtaint = memTaint_t
val valid_taint_buf (#t:base_typ) (b:buffer t) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0
let valid_taint_buf64 (b:buffer64) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn | false | false | Vale.X64.Memory.fsti | {
"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"
} | null | val valid_taint_buf128 (b: buffer128) (h: vale_heap) (mt: memtaint) (tn: taint) : GTot prop0 | [] | Vale.X64.Memory.valid_taint_buf128 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
b: Vale.X64.Memory.buffer128 ->
h: Vale.X64.Memory.vale_heap ->
mt: Vale.X64.Memory.memtaint ->
tn: Vale.Arch.HeapTypes_s.taint
-> Prims.GTot Vale.Def.Prop_s.prop0 | {
"end_col": 27,
"end_line": 313,
"start_col": 2,
"start_line": 313
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let buffer_info_has_id (bs:Seq.seq buffer_info) (i:nat) (id:heaplet_id) =
i < Seq.length bs /\ (Seq.index bs i).bi_heaplet == id | let buffer_info_has_id (bs: Seq.seq buffer_info) (i: nat) (id: heaplet_id) = | false | null | false | i < Seq.length bs /\ (Seq.index bs i).bi_heaplet == id | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"FStar.Seq.Base.seq",
"Vale.Arch.HeapImpl.buffer_info",
"Prims.nat",
"Vale.X64.Memory.heaplet_id",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Prims.eq2",
"Vale.Arch.HeapImpl.heaplet_id",
"Vale.Arch.HeapImpl.__proj__Mkbuffer_info__item__bi_heaplet",
"FStar.Seq.Base.index",
"Prims.logical"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16
let buffer32 = buffer vuint32
let buffer64 = buffer vuint64
let buffer128 = buffer vuint128
val buffer_addr (#t:base_typ) (b:buffer t) (h:vale_heap) : GTot int
unfold
let locs_disjoint (ls:list loc) : prop0 =
BigOps.normal (BigOps.pairwise_and' (fun x y -> loc_disjoint x y /\ loc_disjoint y x) ls)
// equivalent to modifies; used to prove modifies clauses via modifies_goal_directed_trans
val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0
val lemma_modifies_goal_directed (s:loc) (h1 h2:vale_heap) : Lemma
(modifies s h1 h2 == modifies_goal_directed s h1 h2)
val buffer_length_buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : Lemma
(requires True)
(ensures (Seq.length (buffer_as_seq h b) == buffer_length b))
[SMTPat (Seq.length (buffer_as_seq h b))]
val modifies_buffer_elim (#t1:base_typ) (b:buffer t1) (p:loc) (h h':vale_heap) : Lemma
(requires
loc_disjoint (loc_buffer b) p /\
buffer_readable h b /\
modifies p h h'
)
(ensures
buffer_readable h b /\
buffer_readable h' b /\
buffer_as_seq h b == buffer_as_seq h' b
)
[SMTPatOr [
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)];
[SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b)];
]]
val modifies_buffer_addr (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h'
)
(ensures buffer_addr b h == buffer_addr b h')
[SMTPat (modifies p h h'); SMTPat (buffer_addr b h')]
val modifies_buffer_readable (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h' /\
buffer_readable h b
)
(ensures buffer_readable h' b)
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)]
val loc_disjoint_none_r (s:loc) : Lemma
(ensures (loc_disjoint s loc_none))
[SMTPat (loc_disjoint s loc_none)]
val loc_disjoint_union_r (s s1 s2:loc) : Lemma
(requires (loc_disjoint s s1 /\ loc_disjoint s s2))
(ensures (loc_disjoint s (loc_union s1 s2)))
[SMTPat (loc_disjoint s (loc_union s1 s2))]
val loc_includes_refl (s:loc) : Lemma
(loc_includes s s)
[SMTPat (loc_includes s s)]
val loc_includes_trans (s1 s2 s3:loc) : Lemma
(requires (loc_includes s1 s2 /\ loc_includes s2 s3))
(ensures (loc_includes s1 s3))
val loc_includes_union_r (s s1 s2:loc) : Lemma
(requires (loc_includes s s1 /\ loc_includes s s2))
(ensures (loc_includes s (loc_union s1 s2)))
[SMTPat (loc_includes s (loc_union s1 s2))]
val loc_includes_union_l (s1 s2 s:loc) : Lemma
(requires (loc_includes s1 s \/ loc_includes s2 s))
(ensures (loc_includes (loc_union s1 s2) s))
// for efficiency, no SMT pattern
val loc_includes_union_l_buffer (#t:base_typ) (s1 s2:loc) (b:buffer t) : Lemma
(requires (loc_includes s1 (loc_buffer b) \/ loc_includes s2 (loc_buffer b)))
(ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))
[SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]
val loc_includes_none (s:loc) : Lemma
(loc_includes s loc_none)
[SMTPat (loc_includes s loc_none)]
val modifies_refl (s:loc) (h:vale_heap) : Lemma
(modifies s h h)
[SMTPat (modifies s h h)]
val modifies_goal_directed_refl (s:loc) (h:vale_heap) : Lemma
(modifies_goal_directed s h h)
[SMTPat (modifies_goal_directed s h h)]
val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma
(requires (modifies s2 h h' /\ loc_includes s1 s2))
(ensures (modifies s1 h h'))
// for efficiency, no SMT pattern
val modifies_trans (s12:loc) (h1 h2:vale_heap) (s23:loc) (h3:vale_heap) : Lemma
(requires (modifies s12 h1 h2 /\ modifies s23 h2 h3))
(ensures (modifies (loc_union s12 s23) h1 h3))
// for efficiency, no SMT pattern
// Prove (modifies s13 h1 h3).
// To avoid unnecessary matches, don't introduce any other modifies terms.
// Introduce modifies_goal_directed instead.
val modifies_goal_directed_trans (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies s13 h1 h3)]
val modifies_goal_directed_trans2 (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies_goal_directed s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies_goal_directed s13 h1 h3)]
val buffer_read (#t:base_typ) (b:buffer t) (i:int) (h:vale_heap) : Ghost (base_typ_as_vale_type t)
(requires True)
(ensures (fun v ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
v == Seq.index (buffer_as_seq h b) i
))
val buffer_write (#t:base_typ) (b:buffer t) (i:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires buffer_readable h b /\ buffer_writeable b)
(ensures (fun h' ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
modifies (loc_buffer b) h h' /\
get_heaplet_id h' == get_heaplet_id h /\
buffer_readable h' b /\
buffer_as_seq h' b == Seq.upd (buffer_as_seq h b) i v
))
val valid_mem64 (ptr:int) (h:vale_heap) : GTot bool // is there a 64-bit word at address ptr?
val writeable_mem64 (ptr:int) (h:vale_heap) : GTot bool // can we write a 64-bit word at address ptr?
val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64 // the 64-bit word at ptr (if valid_mem64 holds)
val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap
val valid_mem128 (ptr:int) (h:vale_heap) : GTot bool
val writeable_mem128 (ptr:int) (h:vale_heap) : GTot bool
val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32
val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap
val lemma_valid_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_writeable_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_load_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem64 (buffer_addr b h + scale8 i) h == buffer_read b i h
)
val lemma_store_mem64 (b:buffer64) (i:nat) (v:nat64) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem64 (buffer_addr b h + scale8 i) v h == buffer_write b i v h
)
val lemma_valid_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_writeable_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_load_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem128 (buffer_addr b h + scale16 i) h == buffer_read b i h
)
val lemma_store_mem128 (b:buffer128) (i:nat) (v:quad32) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem128 (buffer_addr b h + scale16 i) v h == buffer_write b i v h
)
//Memtaint related functions
type memtaint = memTaint_t
val valid_taint_buf (#t:base_typ) (b:buffer t) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0
let valid_taint_buf64 (b:buffer64) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
let valid_taint_buf128 (b:buffer128) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
val lemma_valid_taint64
(b:buffer64)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf64 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale8 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 8 ==> Map.sel memTaint i' == t))
val lemma_valid_taint128
(b:buffer128)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf128 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale16 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 16 ==> Map.sel memTaint i' == t))
val same_memTaint64
(b:buffer64)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val same_memTaint128
(b:buffer128)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val modifies_valid_taint (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) (mt:memtaint) (tn:taint) : Lemma
(requires modifies p h h')
(ensures valid_taint_buf b h mt tn <==> valid_taint_buf b h' mt tn)
[SMTPat (modifies p h h'); SMTPat (valid_taint_buf b h' mt tn)]
val modifies_same_heaplet_id (l:loc) (h1 h2:vale_heap) : Lemma
(requires modifies l h1 h2)
(ensures get_heaplet_id h1 == get_heaplet_id h2)
[SMTPat (modifies l h1 h2); SMTPat (get_heaplet_id h2)]
// Buffers in different heaplets are disjoint
let buffer_info_disjoint (bi1 bi2:buffer_info) =
bi1.bi_typ =!= bi2.bi_typ \/ bi1.bi_heaplet =!= bi2.bi_heaplet ==>
loc_disjoint (loc_buffer bi1.bi_buffer) (loc_buffer bi2.bi_buffer)
// Requirements for enabling heaplets
let init_heaplets_req (h:vale_heap) (bs:Seq.seq buffer_info) =
(forall (i:nat).{:pattern (Seq.index bs i)} i < Seq.length bs ==>
buffer_readable h (Seq.index bs i).bi_buffer) /\
(forall (i1 i2:nat).{:pattern (Seq.index bs i1); (Seq.index bs i2)}
i1 < Seq.length bs /\ i2 < Seq.length bs ==> buffer_info_disjoint (Seq.index bs i1) (Seq.index bs i2))
// Location containing all mutable buffers
let rec loc_mutable_buffers (buffers:list buffer_info) : GTot loc =
match buffers with
| [] -> loc_none
| [{bi_mutable = Mutable; bi_buffer = b}] -> loc_buffer b
| ({bi_mutable = Immutable})::t -> loc_mutable_buffers t
| ({bi_mutable = Mutable; bi_buffer = b})::t -> loc_union (loc_buffer b) (loc_mutable_buffers t)
// Buffer b belongs to heaplet h
val valid_layout_buffer_id (t:base_typ) (b:buffer t) (layout:vale_heap_layout) (h_id:option heaplet_id) (write:bool) : prop0
let valid_layout_buffer (#t:base_typ) (b:buffer t) (layout:vale_heap_layout) (h:vale_heap) (write:bool) =
valid_layout_buffer_id t b layout (get_heaplet_id h) false /\
valid_layout_buffer_id t b layout (get_heaplet_id h) write
// Initial memory state
val is_initial_heap (layout:vale_heap_layout) (h:vale_heap) : prop0
// Invariant that is always true in Vale procedures
val mem_inv (h:vale_full_heap) : prop0
// Layout data
val layout_heaplets_initialized (layout:vale_heap_layout_inner) : bool
val layout_old_heap (layout:vale_heap_layout_inner) : vale_heap
val layout_modifies_loc (layout:vale_heap_layout_inner) : loc
val layout_buffers (layout:vale_heap_layout_inner) : Seq.seq buffer_info | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val buffer_info_has_id : bs: FStar.Seq.Base.seq Vale.Arch.HeapImpl.buffer_info ->
i: Prims.nat ->
id: Vale.X64.Memory.heaplet_id
-> Prims.logical | [] | Vale.X64.Memory.buffer_info_has_id | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
bs: FStar.Seq.Base.seq Vale.Arch.HeapImpl.buffer_info ->
i: Prims.nat ->
id: Vale.X64.Memory.heaplet_id
-> Prims.logical | {
"end_col": 56,
"end_line": 410,
"start_col": 2,
"start_line": 410
} |
|
Prims.Tot | val scale2 (index: int) : int | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let scale2 (index:int) : int = scale_by 2 index | val scale2 (index: int) : int
let scale2 (index: int) : int = | false | null | false | scale_by 2 index | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Prims.int",
"Vale.X64.Memory.scale_by"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val scale2 (index: int) : int | [] | Vale.X64.Memory.scale2 | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | index: Prims.int -> Prims.int | {
"end_col": 54,
"end_line": 42,
"start_col": 38,
"start_line": 42
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let buffer_info_disjoint (bi1 bi2:buffer_info) =
bi1.bi_typ =!= bi2.bi_typ \/ bi1.bi_heaplet =!= bi2.bi_heaplet ==>
loc_disjoint (loc_buffer bi1.bi_buffer) (loc_buffer bi2.bi_buffer) | let buffer_info_disjoint (bi1 bi2: buffer_info) = | false | null | false | bi1.bi_typ =!= bi2.bi_typ \/ bi1.bi_heaplet =!= bi2.bi_heaplet ==>
loc_disjoint (loc_buffer bi1.bi_buffer) (loc_buffer bi2.bi_buffer) | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapImpl.buffer_info",
"Prims.l_imp",
"Prims.l_or",
"Prims.l_not",
"Prims.eq2",
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.Arch.HeapImpl.__proj__Mkbuffer_info__item__bi_typ",
"Vale.Arch.HeapImpl.heaplet_id",
"Vale.Arch.HeapImpl.__proj__Mkbuffer_info__item__bi_heaplet",
"Vale.X64.Memory.loc_disjoint",
"Vale.X64.Memory.loc_buffer",
"Vale.Arch.HeapImpl.__proj__Mkbuffer_info__item__bi_buffer",
"Prims.logical"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16
let buffer32 = buffer vuint32
let buffer64 = buffer vuint64
let buffer128 = buffer vuint128
val buffer_addr (#t:base_typ) (b:buffer t) (h:vale_heap) : GTot int
unfold
let locs_disjoint (ls:list loc) : prop0 =
BigOps.normal (BigOps.pairwise_and' (fun x y -> loc_disjoint x y /\ loc_disjoint y x) ls)
// equivalent to modifies; used to prove modifies clauses via modifies_goal_directed_trans
val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0
val lemma_modifies_goal_directed (s:loc) (h1 h2:vale_heap) : Lemma
(modifies s h1 h2 == modifies_goal_directed s h1 h2)
val buffer_length_buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : Lemma
(requires True)
(ensures (Seq.length (buffer_as_seq h b) == buffer_length b))
[SMTPat (Seq.length (buffer_as_seq h b))]
val modifies_buffer_elim (#t1:base_typ) (b:buffer t1) (p:loc) (h h':vale_heap) : Lemma
(requires
loc_disjoint (loc_buffer b) p /\
buffer_readable h b /\
modifies p h h'
)
(ensures
buffer_readable h b /\
buffer_readable h' b /\
buffer_as_seq h b == buffer_as_seq h' b
)
[SMTPatOr [
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)];
[SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b)];
]]
val modifies_buffer_addr (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h'
)
(ensures buffer_addr b h == buffer_addr b h')
[SMTPat (modifies p h h'); SMTPat (buffer_addr b h')]
val modifies_buffer_readable (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h' /\
buffer_readable h b
)
(ensures buffer_readable h' b)
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)]
val loc_disjoint_none_r (s:loc) : Lemma
(ensures (loc_disjoint s loc_none))
[SMTPat (loc_disjoint s loc_none)]
val loc_disjoint_union_r (s s1 s2:loc) : Lemma
(requires (loc_disjoint s s1 /\ loc_disjoint s s2))
(ensures (loc_disjoint s (loc_union s1 s2)))
[SMTPat (loc_disjoint s (loc_union s1 s2))]
val loc_includes_refl (s:loc) : Lemma
(loc_includes s s)
[SMTPat (loc_includes s s)]
val loc_includes_trans (s1 s2 s3:loc) : Lemma
(requires (loc_includes s1 s2 /\ loc_includes s2 s3))
(ensures (loc_includes s1 s3))
val loc_includes_union_r (s s1 s2:loc) : Lemma
(requires (loc_includes s s1 /\ loc_includes s s2))
(ensures (loc_includes s (loc_union s1 s2)))
[SMTPat (loc_includes s (loc_union s1 s2))]
val loc_includes_union_l (s1 s2 s:loc) : Lemma
(requires (loc_includes s1 s \/ loc_includes s2 s))
(ensures (loc_includes (loc_union s1 s2) s))
// for efficiency, no SMT pattern
val loc_includes_union_l_buffer (#t:base_typ) (s1 s2:loc) (b:buffer t) : Lemma
(requires (loc_includes s1 (loc_buffer b) \/ loc_includes s2 (loc_buffer b)))
(ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))
[SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]
val loc_includes_none (s:loc) : Lemma
(loc_includes s loc_none)
[SMTPat (loc_includes s loc_none)]
val modifies_refl (s:loc) (h:vale_heap) : Lemma
(modifies s h h)
[SMTPat (modifies s h h)]
val modifies_goal_directed_refl (s:loc) (h:vale_heap) : Lemma
(modifies_goal_directed s h h)
[SMTPat (modifies_goal_directed s h h)]
val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma
(requires (modifies s2 h h' /\ loc_includes s1 s2))
(ensures (modifies s1 h h'))
// for efficiency, no SMT pattern
val modifies_trans (s12:loc) (h1 h2:vale_heap) (s23:loc) (h3:vale_heap) : Lemma
(requires (modifies s12 h1 h2 /\ modifies s23 h2 h3))
(ensures (modifies (loc_union s12 s23) h1 h3))
// for efficiency, no SMT pattern
// Prove (modifies s13 h1 h3).
// To avoid unnecessary matches, don't introduce any other modifies terms.
// Introduce modifies_goal_directed instead.
val modifies_goal_directed_trans (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies s13 h1 h3)]
val modifies_goal_directed_trans2 (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies_goal_directed s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies_goal_directed s13 h1 h3)]
val buffer_read (#t:base_typ) (b:buffer t) (i:int) (h:vale_heap) : Ghost (base_typ_as_vale_type t)
(requires True)
(ensures (fun v ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
v == Seq.index (buffer_as_seq h b) i
))
val buffer_write (#t:base_typ) (b:buffer t) (i:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires buffer_readable h b /\ buffer_writeable b)
(ensures (fun h' ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
modifies (loc_buffer b) h h' /\
get_heaplet_id h' == get_heaplet_id h /\
buffer_readable h' b /\
buffer_as_seq h' b == Seq.upd (buffer_as_seq h b) i v
))
val valid_mem64 (ptr:int) (h:vale_heap) : GTot bool // is there a 64-bit word at address ptr?
val writeable_mem64 (ptr:int) (h:vale_heap) : GTot bool // can we write a 64-bit word at address ptr?
val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64 // the 64-bit word at ptr (if valid_mem64 holds)
val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap
val valid_mem128 (ptr:int) (h:vale_heap) : GTot bool
val writeable_mem128 (ptr:int) (h:vale_heap) : GTot bool
val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32
val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap
val lemma_valid_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_writeable_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_load_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem64 (buffer_addr b h + scale8 i) h == buffer_read b i h
)
val lemma_store_mem64 (b:buffer64) (i:nat) (v:nat64) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem64 (buffer_addr b h + scale8 i) v h == buffer_write b i v h
)
val lemma_valid_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_writeable_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_load_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem128 (buffer_addr b h + scale16 i) h == buffer_read b i h
)
val lemma_store_mem128 (b:buffer128) (i:nat) (v:quad32) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem128 (buffer_addr b h + scale16 i) v h == buffer_write b i v h
)
//Memtaint related functions
type memtaint = memTaint_t
val valid_taint_buf (#t:base_typ) (b:buffer t) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0
let valid_taint_buf64 (b:buffer64) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
let valid_taint_buf128 (b:buffer128) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
val lemma_valid_taint64
(b:buffer64)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf64 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale8 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 8 ==> Map.sel memTaint i' == t))
val lemma_valid_taint128
(b:buffer128)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf128 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale16 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 16 ==> Map.sel memTaint i' == t))
val same_memTaint64
(b:buffer64)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val same_memTaint128
(b:buffer128)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val modifies_valid_taint (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) (mt:memtaint) (tn:taint) : Lemma
(requires modifies p h h')
(ensures valid_taint_buf b h mt tn <==> valid_taint_buf b h' mt tn)
[SMTPat (modifies p h h'); SMTPat (valid_taint_buf b h' mt tn)]
val modifies_same_heaplet_id (l:loc) (h1 h2:vale_heap) : Lemma
(requires modifies l h1 h2)
(ensures get_heaplet_id h1 == get_heaplet_id h2)
[SMTPat (modifies l h1 h2); SMTPat (get_heaplet_id h2)]
// Buffers in different heaplets are disjoint | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val buffer_info_disjoint : bi1: Vale.Arch.HeapImpl.buffer_info -> bi2: Vale.Arch.HeapImpl.buffer_info -> Prims.logical | [] | Vale.X64.Memory.buffer_info_disjoint | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | bi1: Vale.Arch.HeapImpl.buffer_info -> bi2: Vale.Arch.HeapImpl.buffer_info -> Prims.logical | {
"end_col": 68,
"end_line": 374,
"start_col": 2,
"start_line": 373
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let init_heaplets_req (h:vale_heap) (bs:Seq.seq buffer_info) =
(forall (i:nat).{:pattern (Seq.index bs i)} i < Seq.length bs ==>
buffer_readable h (Seq.index bs i).bi_buffer) /\
(forall (i1 i2:nat).{:pattern (Seq.index bs i1); (Seq.index bs i2)}
i1 < Seq.length bs /\ i2 < Seq.length bs ==> buffer_info_disjoint (Seq.index bs i1) (Seq.index bs i2)) | let init_heaplets_req (h: vale_heap) (bs: Seq.seq buffer_info) = | false | null | false | (forall (i: nat). {:pattern (Seq.index bs i)}
i < Seq.length bs ==> buffer_readable h (Seq.index bs i).bi_buffer) /\
(forall (i1: nat) (i2: nat). {:pattern (Seq.index bs i1); (Seq.index bs i2)}
i1 < Seq.length bs /\ i2 < Seq.length bs ==>
buffer_info_disjoint (Seq.index bs i1) (Seq.index bs i2)) | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.X64.Memory.vale_heap",
"FStar.Seq.Base.seq",
"Vale.Arch.HeapImpl.buffer_info",
"Prims.l_and",
"Prims.l_Forall",
"Prims.nat",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.Seq.Base.length",
"Vale.X64.Memory.buffer_readable",
"Vale.Arch.HeapImpl.__proj__Mkbuffer_info__item__bi_typ",
"FStar.Seq.Base.index",
"Vale.Arch.HeapImpl.__proj__Mkbuffer_info__item__bi_buffer",
"Vale.X64.Memory.buffer_info_disjoint",
"Prims.logical"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16
let buffer32 = buffer vuint32
let buffer64 = buffer vuint64
let buffer128 = buffer vuint128
val buffer_addr (#t:base_typ) (b:buffer t) (h:vale_heap) : GTot int
unfold
let locs_disjoint (ls:list loc) : prop0 =
BigOps.normal (BigOps.pairwise_and' (fun x y -> loc_disjoint x y /\ loc_disjoint y x) ls)
// equivalent to modifies; used to prove modifies clauses via modifies_goal_directed_trans
val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0
val lemma_modifies_goal_directed (s:loc) (h1 h2:vale_heap) : Lemma
(modifies s h1 h2 == modifies_goal_directed s h1 h2)
val buffer_length_buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : Lemma
(requires True)
(ensures (Seq.length (buffer_as_seq h b) == buffer_length b))
[SMTPat (Seq.length (buffer_as_seq h b))]
val modifies_buffer_elim (#t1:base_typ) (b:buffer t1) (p:loc) (h h':vale_heap) : Lemma
(requires
loc_disjoint (loc_buffer b) p /\
buffer_readable h b /\
modifies p h h'
)
(ensures
buffer_readable h b /\
buffer_readable h' b /\
buffer_as_seq h b == buffer_as_seq h' b
)
[SMTPatOr [
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)];
[SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b)];
]]
val modifies_buffer_addr (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h'
)
(ensures buffer_addr b h == buffer_addr b h')
[SMTPat (modifies p h h'); SMTPat (buffer_addr b h')]
val modifies_buffer_readable (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h' /\
buffer_readable h b
)
(ensures buffer_readable h' b)
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)]
val loc_disjoint_none_r (s:loc) : Lemma
(ensures (loc_disjoint s loc_none))
[SMTPat (loc_disjoint s loc_none)]
val loc_disjoint_union_r (s s1 s2:loc) : Lemma
(requires (loc_disjoint s s1 /\ loc_disjoint s s2))
(ensures (loc_disjoint s (loc_union s1 s2)))
[SMTPat (loc_disjoint s (loc_union s1 s2))]
val loc_includes_refl (s:loc) : Lemma
(loc_includes s s)
[SMTPat (loc_includes s s)]
val loc_includes_trans (s1 s2 s3:loc) : Lemma
(requires (loc_includes s1 s2 /\ loc_includes s2 s3))
(ensures (loc_includes s1 s3))
val loc_includes_union_r (s s1 s2:loc) : Lemma
(requires (loc_includes s s1 /\ loc_includes s s2))
(ensures (loc_includes s (loc_union s1 s2)))
[SMTPat (loc_includes s (loc_union s1 s2))]
val loc_includes_union_l (s1 s2 s:loc) : Lemma
(requires (loc_includes s1 s \/ loc_includes s2 s))
(ensures (loc_includes (loc_union s1 s2) s))
// for efficiency, no SMT pattern
val loc_includes_union_l_buffer (#t:base_typ) (s1 s2:loc) (b:buffer t) : Lemma
(requires (loc_includes s1 (loc_buffer b) \/ loc_includes s2 (loc_buffer b)))
(ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))
[SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]
val loc_includes_none (s:loc) : Lemma
(loc_includes s loc_none)
[SMTPat (loc_includes s loc_none)]
val modifies_refl (s:loc) (h:vale_heap) : Lemma
(modifies s h h)
[SMTPat (modifies s h h)]
val modifies_goal_directed_refl (s:loc) (h:vale_heap) : Lemma
(modifies_goal_directed s h h)
[SMTPat (modifies_goal_directed s h h)]
val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma
(requires (modifies s2 h h' /\ loc_includes s1 s2))
(ensures (modifies s1 h h'))
// for efficiency, no SMT pattern
val modifies_trans (s12:loc) (h1 h2:vale_heap) (s23:loc) (h3:vale_heap) : Lemma
(requires (modifies s12 h1 h2 /\ modifies s23 h2 h3))
(ensures (modifies (loc_union s12 s23) h1 h3))
// for efficiency, no SMT pattern
// Prove (modifies s13 h1 h3).
// To avoid unnecessary matches, don't introduce any other modifies terms.
// Introduce modifies_goal_directed instead.
val modifies_goal_directed_trans (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies s13 h1 h3)]
val modifies_goal_directed_trans2 (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies_goal_directed s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies_goal_directed s13 h1 h3)]
val buffer_read (#t:base_typ) (b:buffer t) (i:int) (h:vale_heap) : Ghost (base_typ_as_vale_type t)
(requires True)
(ensures (fun v ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
v == Seq.index (buffer_as_seq h b) i
))
val buffer_write (#t:base_typ) (b:buffer t) (i:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires buffer_readable h b /\ buffer_writeable b)
(ensures (fun h' ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
modifies (loc_buffer b) h h' /\
get_heaplet_id h' == get_heaplet_id h /\
buffer_readable h' b /\
buffer_as_seq h' b == Seq.upd (buffer_as_seq h b) i v
))
val valid_mem64 (ptr:int) (h:vale_heap) : GTot bool // is there a 64-bit word at address ptr?
val writeable_mem64 (ptr:int) (h:vale_heap) : GTot bool // can we write a 64-bit word at address ptr?
val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64 // the 64-bit word at ptr (if valid_mem64 holds)
val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap
val valid_mem128 (ptr:int) (h:vale_heap) : GTot bool
val writeable_mem128 (ptr:int) (h:vale_heap) : GTot bool
val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32
val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap
val lemma_valid_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_writeable_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_load_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem64 (buffer_addr b h + scale8 i) h == buffer_read b i h
)
val lemma_store_mem64 (b:buffer64) (i:nat) (v:nat64) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem64 (buffer_addr b h + scale8 i) v h == buffer_write b i v h
)
val lemma_valid_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_writeable_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_load_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem128 (buffer_addr b h + scale16 i) h == buffer_read b i h
)
val lemma_store_mem128 (b:buffer128) (i:nat) (v:quad32) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem128 (buffer_addr b h + scale16 i) v h == buffer_write b i v h
)
//Memtaint related functions
type memtaint = memTaint_t
val valid_taint_buf (#t:base_typ) (b:buffer t) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0
let valid_taint_buf64 (b:buffer64) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
let valid_taint_buf128 (b:buffer128) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
val lemma_valid_taint64
(b:buffer64)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf64 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale8 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 8 ==> Map.sel memTaint i' == t))
val lemma_valid_taint128
(b:buffer128)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf128 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale16 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 16 ==> Map.sel memTaint i' == t))
val same_memTaint64
(b:buffer64)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val same_memTaint128
(b:buffer128)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val modifies_valid_taint (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) (mt:memtaint) (tn:taint) : Lemma
(requires modifies p h h')
(ensures valid_taint_buf b h mt tn <==> valid_taint_buf b h' mt tn)
[SMTPat (modifies p h h'); SMTPat (valid_taint_buf b h' mt tn)]
val modifies_same_heaplet_id (l:loc) (h1 h2:vale_heap) : Lemma
(requires modifies l h1 h2)
(ensures get_heaplet_id h1 == get_heaplet_id h2)
[SMTPat (modifies l h1 h2); SMTPat (get_heaplet_id h2)]
// Buffers in different heaplets are disjoint
let buffer_info_disjoint (bi1 bi2:buffer_info) =
bi1.bi_typ =!= bi2.bi_typ \/ bi1.bi_heaplet =!= bi2.bi_heaplet ==>
loc_disjoint (loc_buffer bi1.bi_buffer) (loc_buffer bi2.bi_buffer)
// Requirements for enabling heaplets | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val init_heaplets_req : h: Vale.X64.Memory.vale_heap -> bs: FStar.Seq.Base.seq Vale.Arch.HeapImpl.buffer_info
-> Prims.logical | [] | Vale.X64.Memory.init_heaplets_req | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | h: Vale.X64.Memory.vale_heap -> bs: FStar.Seq.Base.seq Vale.Arch.HeapImpl.buffer_info
-> Prims.logical | {
"end_col": 106,
"end_line": 381,
"start_col": 2,
"start_line": 378
} |
|
Prims.Tot | val base_typ_as_vale_type (t: base_typ) : Tot eqtype | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32 | val base_typ_as_vale_type (t: base_typ) : Tot eqtype
let base_typ_as_vale_type (t: base_typ) : Tot eqtype = | false | null | false | match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32 | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"total"
] | [
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.X64.Memory.nat8",
"Vale.X64.Memory.nat16",
"Vale.X64.Memory.nat32",
"Vale.X64.Memory.nat64",
"Vale.X64.Memory.quad32",
"Prims.eqtype"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32 | false | true | Vale.X64.Memory.fsti | {
"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"
} | null | val base_typ_as_vale_type (t: base_typ) : Tot eqtype | [] | Vale.X64.Memory.base_typ_as_vale_type | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | t: Vale.Arch.HeapTypes_s.base_typ -> Prims.eqtype | {
"end_col": 22,
"end_line": 39,
"start_col": 2,
"start_line": 34
} |
Prims.GTot | val loc_mutable_buffers (buffers: list buffer_info) : GTot loc | [
{
"abbrev": true,
"full_module": "Vale.Lib.Map16",
"short_module": "Map16"
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Prop_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_s",
"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
}
] | false | let rec loc_mutable_buffers (buffers:list buffer_info) : GTot loc =
match buffers with
| [] -> loc_none
| [{bi_mutable = Mutable; bi_buffer = b}] -> loc_buffer b
| ({bi_mutable = Immutable})::t -> loc_mutable_buffers t
| ({bi_mutable = Mutable; bi_buffer = b})::t -> loc_union (loc_buffer b) (loc_mutable_buffers t) | val loc_mutable_buffers (buffers: list buffer_info) : GTot loc
let rec loc_mutable_buffers (buffers: list buffer_info) : GTot loc = | false | null | false | match buffers with
| [] -> loc_none
| [{ bi_mutable = Mutable ; bi_buffer = b }] -> loc_buffer b
| { bi_mutable = Immutable } :: t -> loc_mutable_buffers t
| { bi_mutable = Mutable ; bi_buffer = b } :: t -> loc_union (loc_buffer b) (loc_mutable_buffers t) | {
"checked_file": "Vale.X64.Memory.fsti.checked",
"dependencies": [
"Vale.X64.Machine_s.fst.checked",
"Vale.Lib.Map16.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Prop_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"prims.fst.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.BigOps.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Memory.fsti"
} | [
"sometrivial"
] | [
"Prims.list",
"Vale.Arch.HeapImpl.buffer_info",
"Vale.X64.Memory.loc_none",
"Vale.Arch.HeapTypes_s.base_typ",
"Vale.Arch.HeapImpl.buffer",
"Vale.Arch.HeapImpl.heaplet_id",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Memory.loc_buffer",
"Vale.X64.Memory.loc_mutable_buffers",
"Vale.X64.Memory.loc_union",
"Vale.X64.Memory.loc"
] | [] | module Vale.X64.Memory
include Vale.Arch.HeapTypes_s
open FStar.Mul
open Vale.Def.Prop_s
open Vale.X64.Machine_s
open Vale.Arch.HeapImpl
module Map16 = Vale.Lib.Map16
unfold let vale_heap = vale_heap
unfold let vale_full_heap = vale_full_heap
unfold let heaplet_id = heaplet_id
[@va_qattr]
let get_vale_heap (vhi:vale_full_heap) : vale_heap = vhi.vf_heap
[@va_qattr]
let set_vale_heap (vfh:vale_full_heap) (vh:vale_heap) : vale_full_heap =
{vfh with vf_heap = vh}
let vale_full_heap_equal (h1 h2:vale_full_heap) =
h1.vf_layout == h2.vf_layout /\
h1.vf_heap == h2.vf_heap /\
Map16.equal h1.vf_heaplets h2.vf_heaplets
val get_heaplet_id (h:vale_heap) : option heaplet_id
unfold let nat8 = Vale.Def.Words_s.nat8
unfold let nat16 = Vale.Def.Words_s.nat16
unfold let nat32 = Vale.Def.Words_s.nat32
unfold let nat64 = Vale.Def.Words_s.nat64
unfold let quad32 = Vale.Def.Types_s.quad32
let base_typ_as_vale_type (t:base_typ) : Tot eqtype =
match t with
| TUInt8 -> nat8
| TUInt16 -> nat16
| TUInt32 -> nat32
| TUInt64 -> nat64
| TUInt128 -> quad32
let scale_by (scale index:int) : int = scale * index
unfold let scale2 (index:int) : int = scale_by 2 index
unfold let scale4 (index:int) : int = scale_by 4 index
unfold let scale8 (index:int) : int = scale_by 8 index
unfold let scale16 (index:int) : int = scale_by 16 index
unfold let buffer (t:base_typ) : Type0 = Vale.Arch.HeapImpl.buffer t
val buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot (Seq.seq (base_typ_as_vale_type t))
val buffer_readable (#t:base_typ) (h:vale_heap) (b:buffer t) : GTot prop0
val buffer_writeable (#t:base_typ) (b:buffer t) : GTot prop0
val buffer_length (#t:base_typ) (b:buffer t) : GTot nat
val loc : Type u#0
val loc_none : loc
val loc_union (s1 s2:loc) : GTot loc
val loc_buffer (#t:base_typ) (b:buffer t) : GTot loc
val loc_disjoint (s1 s2:loc) : GTot prop0
val loc_includes (s1 s2:loc) : GTot prop0
val modifies (s:loc) (h1 h2:vale_heap) : GTot prop0
let valid_buffer_read (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
0 <= i /\ i < buffer_length b /\ buffer_readable h b
let valid_buffer_write (#t:base_typ) (h:vale_heap) (b:buffer t) (i:int) : prop0 =
valid_buffer_read h b i /\ buffer_writeable b
// Named abbreviations for Vale type system:
unfold let vuint8 = TUInt8
unfold let vuint16 = TUInt16
unfold let vuint32 = TUInt32
unfold let vuint64 = TUInt64
unfold let vuint128 = TUInt128
let buffer8 = buffer vuint8
let buffer16 = buffer vuint16
let buffer32 = buffer vuint32
let buffer64 = buffer vuint64
let buffer128 = buffer vuint128
val buffer_addr (#t:base_typ) (b:buffer t) (h:vale_heap) : GTot int
unfold
let locs_disjoint (ls:list loc) : prop0 =
BigOps.normal (BigOps.pairwise_and' (fun x y -> loc_disjoint x y /\ loc_disjoint y x) ls)
// equivalent to modifies; used to prove modifies clauses via modifies_goal_directed_trans
val modifies_goal_directed (s:loc) (h1 h2:vale_heap) : GTot prop0
val lemma_modifies_goal_directed (s:loc) (h1 h2:vale_heap) : Lemma
(modifies s h1 h2 == modifies_goal_directed s h1 h2)
val buffer_length_buffer_as_seq (#t:base_typ) (h:vale_heap) (b:buffer t) : Lemma
(requires True)
(ensures (Seq.length (buffer_as_seq h b) == buffer_length b))
[SMTPat (Seq.length (buffer_as_seq h b))]
val modifies_buffer_elim (#t1:base_typ) (b:buffer t1) (p:loc) (h h':vale_heap) : Lemma
(requires
loc_disjoint (loc_buffer b) p /\
buffer_readable h b /\
modifies p h h'
)
(ensures
buffer_readable h b /\
buffer_readable h' b /\
buffer_as_seq h b == buffer_as_seq h' b
)
[SMTPatOr [
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)];
[SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b)];
]]
val modifies_buffer_addr (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h'
)
(ensures buffer_addr b h == buffer_addr b h')
[SMTPat (modifies p h h'); SMTPat (buffer_addr b h')]
val modifies_buffer_readable (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) : Lemma
(requires
modifies p h h' /\
buffer_readable h b
)
(ensures buffer_readable h' b)
[SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)]
val loc_disjoint_none_r (s:loc) : Lemma
(ensures (loc_disjoint s loc_none))
[SMTPat (loc_disjoint s loc_none)]
val loc_disjoint_union_r (s s1 s2:loc) : Lemma
(requires (loc_disjoint s s1 /\ loc_disjoint s s2))
(ensures (loc_disjoint s (loc_union s1 s2)))
[SMTPat (loc_disjoint s (loc_union s1 s2))]
val loc_includes_refl (s:loc) : Lemma
(loc_includes s s)
[SMTPat (loc_includes s s)]
val loc_includes_trans (s1 s2 s3:loc) : Lemma
(requires (loc_includes s1 s2 /\ loc_includes s2 s3))
(ensures (loc_includes s1 s3))
val loc_includes_union_r (s s1 s2:loc) : Lemma
(requires (loc_includes s s1 /\ loc_includes s s2))
(ensures (loc_includes s (loc_union s1 s2)))
[SMTPat (loc_includes s (loc_union s1 s2))]
val loc_includes_union_l (s1 s2 s:loc) : Lemma
(requires (loc_includes s1 s \/ loc_includes s2 s))
(ensures (loc_includes (loc_union s1 s2) s))
// for efficiency, no SMT pattern
val loc_includes_union_l_buffer (#t:base_typ) (s1 s2:loc) (b:buffer t) : Lemma
(requires (loc_includes s1 (loc_buffer b) \/ loc_includes s2 (loc_buffer b)))
(ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))
[SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]
val loc_includes_none (s:loc) : Lemma
(loc_includes s loc_none)
[SMTPat (loc_includes s loc_none)]
val modifies_refl (s:loc) (h:vale_heap) : Lemma
(modifies s h h)
[SMTPat (modifies s h h)]
val modifies_goal_directed_refl (s:loc) (h:vale_heap) : Lemma
(modifies_goal_directed s h h)
[SMTPat (modifies_goal_directed s h h)]
val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma
(requires (modifies s2 h h' /\ loc_includes s1 s2))
(ensures (modifies s1 h h'))
// for efficiency, no SMT pattern
val modifies_trans (s12:loc) (h1 h2:vale_heap) (s23:loc) (h3:vale_heap) : Lemma
(requires (modifies s12 h1 h2 /\ modifies s23 h2 h3))
(ensures (modifies (loc_union s12 s23) h1 h3))
// for efficiency, no SMT pattern
// Prove (modifies s13 h1 h3).
// To avoid unnecessary matches, don't introduce any other modifies terms.
// Introduce modifies_goal_directed instead.
val modifies_goal_directed_trans (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies s13 h1 h3)]
val modifies_goal_directed_trans2 (s12:loc) (h1 h2:vale_heap) (s13:loc) (h3:vale_heap) : Lemma
(requires
modifies s12 h1 h2 /\
modifies_goal_directed s13 h2 h3 /\
loc_includes s13 s12
)
(ensures (modifies_goal_directed s13 h1 h3))
[SMTPat (modifies s12 h1 h2); SMTPat (modifies_goal_directed s13 h1 h3)]
val buffer_read (#t:base_typ) (b:buffer t) (i:int) (h:vale_heap) : Ghost (base_typ_as_vale_type t)
(requires True)
(ensures (fun v ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
v == Seq.index (buffer_as_seq h b) i
))
val buffer_write (#t:base_typ) (b:buffer t) (i:int) (v:base_typ_as_vale_type t) (h:vale_heap) : Ghost vale_heap
(requires buffer_readable h b /\ buffer_writeable b)
(ensures (fun h' ->
0 <= i /\ i < buffer_length b /\ buffer_readable h b ==>
modifies (loc_buffer b) h h' /\
get_heaplet_id h' == get_heaplet_id h /\
buffer_readable h' b /\
buffer_as_seq h' b == Seq.upd (buffer_as_seq h b) i v
))
val valid_mem64 (ptr:int) (h:vale_heap) : GTot bool // is there a 64-bit word at address ptr?
val writeable_mem64 (ptr:int) (h:vale_heap) : GTot bool // can we write a 64-bit word at address ptr?
val load_mem64 (ptr:int) (h:vale_heap) : GTot nat64 // the 64-bit word at ptr (if valid_mem64 holds)
val store_mem64 (ptr:int) (v:nat64) (h:vale_heap) : GTot vale_heap
val valid_mem128 (ptr:int) (h:vale_heap) : GTot bool
val writeable_mem128 (ptr:int) (h:vale_heap) : GTot bool
val load_mem128 (ptr:int) (h:vale_heap) : GTot quad32
val store_mem128 (ptr:int) (v:quad32) (h:vale_heap) : GTot vale_heap
val lemma_valid_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_writeable_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem64 (buffer_addr b h + scale8 i) h
)
val lemma_load_mem64 (b:buffer64) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem64 (buffer_addr b h + scale8 i) h == buffer_read b i h
)
val lemma_store_mem64 (b:buffer64) (i:nat) (v:nat64) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem64 (buffer_addr b h + scale8 i) v h == buffer_write b i v h
)
val lemma_valid_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
valid_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_writeable_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
writeable_mem128 (buffer_addr b h + scale16 i) h
)
val lemma_load_mem128 (b:buffer128) (i:nat) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b
)
(ensures
load_mem128 (buffer_addr b h + scale16 i) h == buffer_read b i h
)
val lemma_store_mem128 (b:buffer128) (i:nat) (v:quad32) (h:vale_heap) : Lemma
(requires
i < Seq.length (buffer_as_seq h b) /\
buffer_readable h b /\
buffer_writeable b
)
(ensures
store_mem128 (buffer_addr b h + scale16 i) v h == buffer_write b i v h
)
//Memtaint related functions
type memtaint = memTaint_t
val valid_taint_buf (#t:base_typ) (b:buffer t) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0
let valid_taint_buf64 (b:buffer64) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
let valid_taint_buf128 (b:buffer128) (h:vale_heap) (mt:memtaint) (tn:taint) : GTot prop0 =
valid_taint_buf b h mt tn
val lemma_valid_taint64
(b:buffer64)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf64 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale8 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 8 ==> Map.sel memTaint i' == t))
val lemma_valid_taint128
(b:buffer128)
(memTaint:memtaint)
(vale_heap:vale_heap)
(i:nat{i < buffer_length b})
(t:taint)
: Lemma
(requires valid_taint_buf128 b vale_heap memTaint t /\ buffer_readable vale_heap b)
(ensures (
let ptr = buffer_addr b vale_heap + scale16 i in
forall i'.{:pattern Map.sel memTaint i'} i' >= ptr /\ i' < ptr + 16 ==> Map.sel memTaint i' == t))
val same_memTaint64
(b:buffer64)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val same_memTaint128
(b:buffer128)
(mem0:vale_heap)
(mem1:vale_heap)
(memtaint0:memtaint)
(memtaint1:memtaint)
: Lemma
(requires (modifies (loc_buffer b) mem0 mem1 /\
(forall p.{:pattern Map.sel memtaint0 p \/ Map.sel memtaint1 p} Map.sel memtaint0 p == Map.sel memtaint1 p)))
(ensures memtaint0 == memtaint1)
val modifies_valid_taint (#t:base_typ) (b:buffer t) (p:loc) (h h':vale_heap) (mt:memtaint) (tn:taint) : Lemma
(requires modifies p h h')
(ensures valid_taint_buf b h mt tn <==> valid_taint_buf b h' mt tn)
[SMTPat (modifies p h h'); SMTPat (valid_taint_buf b h' mt tn)]
val modifies_same_heaplet_id (l:loc) (h1 h2:vale_heap) : Lemma
(requires modifies l h1 h2)
(ensures get_heaplet_id h1 == get_heaplet_id h2)
[SMTPat (modifies l h1 h2); SMTPat (get_heaplet_id h2)]
// Buffers in different heaplets are disjoint
let buffer_info_disjoint (bi1 bi2:buffer_info) =
bi1.bi_typ =!= bi2.bi_typ \/ bi1.bi_heaplet =!= bi2.bi_heaplet ==>
loc_disjoint (loc_buffer bi1.bi_buffer) (loc_buffer bi2.bi_buffer)
// Requirements for enabling heaplets
let init_heaplets_req (h:vale_heap) (bs:Seq.seq buffer_info) =
(forall (i:nat).{:pattern (Seq.index bs i)} i < Seq.length bs ==>
buffer_readable h (Seq.index bs i).bi_buffer) /\
(forall (i1 i2:nat).{:pattern (Seq.index bs i1); (Seq.index bs i2)}
i1 < Seq.length bs /\ i2 < Seq.length bs ==> buffer_info_disjoint (Seq.index bs i1) (Seq.index bs i2))
// Location containing all mutable buffers | false | false | Vale.X64.Memory.fsti | {
"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"
} | null | val loc_mutable_buffers (buffers: list buffer_info) : GTot loc | [
"recursion"
] | Vale.X64.Memory.loc_mutable_buffers | {
"file_name": "vale/code/arch/x64/Vale.X64.Memory.fsti",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | buffers: Prims.list Vale.Arch.HeapImpl.buffer_info -> Prims.GTot Vale.X64.Memory.loc | {
"end_col": 98,
"end_line": 389,
"start_col": 2,
"start_line": 385
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x | let publicMemValuesAreSame (s1 s2: machine_state) = | false | null | false | forall x.
{:pattern
(heap_taint s1.ms_heap).[ x ]\/(heap_taint s2.ms_heap).[ x ]\/(heap_get s1.ms_heap).[ x ]\/(heap_get
s2.ms_heap).[ x ]}
publicMemValueIsSame (heap_get s1.ms_heap)
(heap_get s2.ms_heap)
(heap_taint s1.ms_heap)
(heap_taint s2.ms_heap)
x | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_Forall",
"Prims.int",
"Vale.X64.Leakage_s.publicMemValueIsSame",
"Vale.Arch.Heap.heap_get",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_heap",
"Vale.Arch.Heap.heap_taint",
"Vale.X64.Machine_Semantics_s.op_String_Access",
"Vale.Def.Types_s.nat8",
"Vale.Arch.HeapTypes_s.taint",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x] | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val publicMemValuesAreSame : s1: Vale.X64.Machine_Semantics_s.machine_state -> s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.publicMemValuesAreSame | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s1: Vale.X64.Machine_Semantics_s.machine_state -> s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 118,
"end_line": 39,
"start_col": 2,
"start_line": 38
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let isConstantTime (code:code) (ts:leakage_taints) =
forall s1 s2 fuel.
isConstantTimeGivenStates code fuel ts s1 s2 | let isConstantTime (code: code) (ts: leakage_taints) = | false | null | false | forall s1 s2 fuel. isConstantTimeGivenStates code fuel ts s1 s2 | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Vale.X64.Leakage_s.leakage_taints",
"Prims.l_Forall",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.nat",
"Vale.X64.Leakage_s.isConstantTimeGivenStates",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x]
let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x
let publicValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
publicRegisterValuesAreSame ts s1 s2
/\ publicFlagValuesAreSame ts s1 s2
/\ publicCfFlagValuesAreSame ts s1 s2
/\ publicOfFlagValuesAreSame ts s1 s2
/\ publicMemValuesAreSame s1 s2
/\ publicStackValuesAreSame s1 s2
let constTimeInvariant (ts:leakage_taints) (s:machine_state) (s':machine_state) =
publicValuesAreSame ts s s'
/\ s.ms_trace = s'.ms_trace
let isConstantTimeGivenStates (code:code) (fuel:nat) (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
( (Some? r1) /\ (Some? r2)
/\ s1.ms_ok /\ (Some?.v r1).ms_ok
/\ s2.ms_ok /\ (Some?.v r2).ms_ok
/\ constTimeInvariant ts s1 s2
) ==> (Some?.v r1).ms_trace = (Some?.v r2).ms_trace | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val isConstantTime : code: Vale.X64.Machine_Semantics_s.code -> ts: Vale.X64.Leakage_s.leakage_taints -> Prims.logical | [] | Vale.X64.Leakage_s.isConstantTime | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | code: Vale.X64.Machine_Semantics_s.code -> ts: Vale.X64.Leakage_s.leakage_taints -> Prims.logical | {
"end_col": 50,
"end_line": 78,
"start_col": 2,
"start_line": 77
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags) | let publicFlagValuesAreSame (ts: leakage_taints) (s1 s2: machine_state) = | false | null | false | ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags) | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_Equality",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__flagsTaint",
"Vale.Arch.HeapTypes_s.Public",
"Prims.eq2",
"Vale.X64.Machine_Semantics_s.flags_t",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_flags",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val publicFlagValuesAreSame : ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.publicFlagValuesAreSame | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 57,
"end_line": 17,
"start_col": 2,
"start_line": 17
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x] | let publicMemValueIsSame (mem1 mem2: machine_heap) (memTaint1 memTaint2: Map.t int taint) (x: int) = | false | null | false | (Public? (memTaint1.[ x ]) || Public? (memTaint2.[ x ])) ==> mem1.[ x ] == mem2.[ x ] | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.Arch.MachineHeap_s.machine_heap",
"FStar.Map.t",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_BarBar",
"Vale.Arch.HeapTypes_s.uu___is_Public",
"Vale.X64.Machine_Semantics_s.op_String_Access",
"Prims.eq2",
"Vale.Def.Types_s.nat8",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint) | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val publicMemValueIsSame : mem1: Vale.Arch.MachineHeap_s.machine_heap ->
mem2: Vale.Arch.MachineHeap_s.machine_heap ->
memTaint1: FStar.Map.t Prims.int Vale.Arch.HeapTypes_s.taint ->
memTaint2: FStar.Map.t Prims.int Vale.Arch.HeapTypes_s.taint ->
x: Prims.int
-> Prims.logical | [] | Vale.X64.Leakage_s.publicMemValueIsSame | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
mem1: Vale.Arch.MachineHeap_s.machine_heap ->
mem2: Vale.Arch.MachineHeap_s.machine_heap ->
memTaint1: FStar.Map.t Prims.int Vale.Arch.HeapTypes_s.taint ->
memTaint2: FStar.Map.t Prims.int Vale.Arch.HeapTypes_s.taint ->
x: Prims.int
-> Prims.logical | {
"end_col": 25,
"end_line": 35,
"start_col": 2,
"start_line": 34
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let isExplicitLeakageFree (code:code) (ts:leakage_taints) (ts':leakage_taints) =
forall s1 s2 fuel.
isExplicitLeakageFreeGivenStates code fuel ts ts' s1 s2 | let isExplicitLeakageFree (code: code) (ts ts': leakage_taints) = | false | null | false | forall s1 s2 fuel. isExplicitLeakageFreeGivenStates code fuel ts ts' s1 s2 | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Vale.X64.Leakage_s.leakage_taints",
"Prims.l_Forall",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.nat",
"Vale.X64.Leakage_s.isExplicitLeakageFreeGivenStates",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x]
let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x
let publicValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
publicRegisterValuesAreSame ts s1 s2
/\ publicFlagValuesAreSame ts s1 s2
/\ publicCfFlagValuesAreSame ts s1 s2
/\ publicOfFlagValuesAreSame ts s1 s2
/\ publicMemValuesAreSame s1 s2
/\ publicStackValuesAreSame s1 s2
let constTimeInvariant (ts:leakage_taints) (s:machine_state) (s':machine_state) =
publicValuesAreSame ts s s'
/\ s.ms_trace = s'.ms_trace
let isConstantTimeGivenStates (code:code) (fuel:nat) (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
( (Some? r1) /\ (Some? r2)
/\ s1.ms_ok /\ (Some?.v r1).ms_ok
/\ s2.ms_ok /\ (Some?.v r2).ms_ok
/\ constTimeInvariant ts s1 s2
) ==> (Some?.v r1).ms_trace = (Some?.v r2).ms_trace
let isConstantTime (code:code) (ts:leakage_taints) =
forall s1 s2 fuel.
isConstantTimeGivenStates code fuel ts s1 s2
let is_explicit_leakage_free_lhs (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= s1.ms_ok /\ s2.ms_ok /\ constTimeInvariant ts s1 s2 /\
(let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ (Some?.v r1).ms_ok /\ (Some?.v r2).ms_ok)
let is_explicit_leakage_free_rhs (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ publicValuesAreSame ts' (Some?.v r1) (Some?.v r2)
let isExplicitLeakageFreeGivenStates (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= is_explicit_leakage_free_lhs code fuel ts ts' s1 s2 ==> is_explicit_leakage_free_rhs code fuel ts ts' s1 s2 | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val isExplicitLeakageFree : code: Vale.X64.Machine_Semantics_s.code ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints
-> Prims.logical | [] | Vale.X64.Leakage_s.isExplicitLeakageFree | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
code: Vale.X64.Machine_Semantics_s.code ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints
-> Prims.logical | {
"end_col": 59,
"end_line": 99,
"start_col": 2,
"start_line": 98
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x] | let publicStackValueIsSame
(stack1 stack2: machine_heap)
(stackTaint1 stackTaint2: Map.t int taint)
(x: int)
= | false | null | false | (Public? (stackTaint1.[ x ]) || Public? (stackTaint2.[ x ])) ==> stack1.[ x ] == stack2.[ x ] | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.Arch.MachineHeap_s.machine_heap",
"FStar.Map.t",
"Prims.int",
"Vale.Arch.HeapTypes_s.taint",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_BarBar",
"Vale.Arch.HeapTypes_s.uu___is_Public",
"Vale.X64.Machine_Semantics_s.op_String_Access",
"Prims.eq2",
"Vale.Def.Types_s.nat8",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint) | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val publicStackValueIsSame : stack1: Vale.Arch.MachineHeap_s.machine_heap ->
stack2: Vale.Arch.MachineHeap_s.machine_heap ->
stackTaint1: FStar.Map.t Prims.int Vale.Arch.HeapTypes_s.taint ->
stackTaint2: FStar.Map.t Prims.int Vale.Arch.HeapTypes_s.taint ->
x: Prims.int
-> Prims.logical | [] | Vale.X64.Leakage_s.publicStackValueIsSame | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
stack1: Vale.Arch.MachineHeap_s.machine_heap ->
stack2: Vale.Arch.MachineHeap_s.machine_heap ->
stackTaint1: FStar.Map.t Prims.int Vale.Arch.HeapTypes_s.taint ->
stackTaint2: FStar.Map.t Prims.int Vale.Arch.HeapTypes_s.taint ->
x: Prims.int
-> Prims.logical | {
"end_col": 29,
"end_line": 46,
"start_col": 4,
"start_line": 45
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let publicValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
publicRegisterValuesAreSame ts s1 s2
/\ publicFlagValuesAreSame ts s1 s2
/\ publicCfFlagValuesAreSame ts s1 s2
/\ publicOfFlagValuesAreSame ts s1 s2
/\ publicMemValuesAreSame s1 s2
/\ publicStackValuesAreSame s1 s2 | let publicValuesAreSame (ts: leakage_taints) (s1 s2: machine_state) = | false | null | false | publicRegisterValuesAreSame ts s1 s2 /\ publicFlagValuesAreSame ts s1 s2 /\
publicCfFlagValuesAreSame ts s1 s2 /\ publicOfFlagValuesAreSame ts s1 s2 /\
publicMemValuesAreSame s1 s2 /\ publicStackValuesAreSame s1 s2 | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_and",
"Vale.X64.Leakage_s.publicRegisterValuesAreSame",
"Vale.X64.Leakage_s.publicFlagValuesAreSame",
"Vale.X64.Leakage_s.publicCfFlagValuesAreSame",
"Vale.X64.Leakage_s.publicOfFlagValuesAreSame",
"Vale.X64.Leakage_s.publicMemValuesAreSame",
"Vale.X64.Leakage_s.publicStackValuesAreSame",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x]
let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val publicValuesAreSame : ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.publicValuesAreSame | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 35,
"end_line": 60,
"start_col": 3,
"start_line": 55
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let isExplicitLeakageFreeGivenStates (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= is_explicit_leakage_free_lhs code fuel ts ts' s1 s2 ==> is_explicit_leakage_free_rhs code fuel ts ts' s1 s2 | let isExplicitLeakageFreeGivenStates
(code: code)
(fuel: nat)
(ts ts': leakage_taints)
(s1 s2: machine_state)
= | false | null | false | is_explicit_leakage_free_lhs code fuel ts ts' s1 s2 ==>
is_explicit_leakage_free_rhs code fuel ts ts' s1 s2 | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Prims.nat",
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_imp",
"Vale.X64.Leakage_s.is_explicit_leakage_free_lhs",
"Vale.X64.Leakage_s.is_explicit_leakage_free_rhs",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x]
let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x
let publicValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
publicRegisterValuesAreSame ts s1 s2
/\ publicFlagValuesAreSame ts s1 s2
/\ publicCfFlagValuesAreSame ts s1 s2
/\ publicOfFlagValuesAreSame ts s1 s2
/\ publicMemValuesAreSame s1 s2
/\ publicStackValuesAreSame s1 s2
let constTimeInvariant (ts:leakage_taints) (s:machine_state) (s':machine_state) =
publicValuesAreSame ts s s'
/\ s.ms_trace = s'.ms_trace
let isConstantTimeGivenStates (code:code) (fuel:nat) (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
( (Some? r1) /\ (Some? r2)
/\ s1.ms_ok /\ (Some?.v r1).ms_ok
/\ s2.ms_ok /\ (Some?.v r2).ms_ok
/\ constTimeInvariant ts s1 s2
) ==> (Some?.v r1).ms_trace = (Some?.v r2).ms_trace
let isConstantTime (code:code) (ts:leakage_taints) =
forall s1 s2 fuel.
isConstantTimeGivenStates code fuel ts s1 s2
let is_explicit_leakage_free_lhs (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= s1.ms_ok /\ s2.ms_ok /\ constTimeInvariant ts s1 s2 /\
(let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ (Some?.v r1).ms_ok /\ (Some?.v r2).ms_ok)
let is_explicit_leakage_free_rhs (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ publicValuesAreSame ts' (Some?.v r1) (Some?.v r2)
let isExplicitLeakageFreeGivenStates (code:code) (fuel:nat) | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val isExplicitLeakageFreeGivenStates : code: Vale.X64.Machine_Semantics_s.code ->
fuel: Prims.nat ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.isExplicitLeakageFreeGivenStates | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
code: Vale.X64.Machine_Semantics_s.code ->
fuel: Prims.nat ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 111,
"end_line": 95,
"start_col": 4,
"start_line": 95
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let isLeakageFree (code:code) (ts:leakage_taints) (ts':leakage_taints) =
isConstantTime code ts
/\ isExplicitLeakageFree code ts ts' | let isLeakageFree (code: code) (ts ts': leakage_taints) = | false | null | false | isConstantTime code ts /\ isExplicitLeakageFree code ts ts' | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Vale.X64.Leakage_s.leakage_taints",
"Prims.l_and",
"Vale.X64.Leakage_s.isConstantTime",
"Vale.X64.Leakage_s.isExplicitLeakageFree",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x]
let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x
let publicValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
publicRegisterValuesAreSame ts s1 s2
/\ publicFlagValuesAreSame ts s1 s2
/\ publicCfFlagValuesAreSame ts s1 s2
/\ publicOfFlagValuesAreSame ts s1 s2
/\ publicMemValuesAreSame s1 s2
/\ publicStackValuesAreSame s1 s2
let constTimeInvariant (ts:leakage_taints) (s:machine_state) (s':machine_state) =
publicValuesAreSame ts s s'
/\ s.ms_trace = s'.ms_trace
let isConstantTimeGivenStates (code:code) (fuel:nat) (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
( (Some? r1) /\ (Some? r2)
/\ s1.ms_ok /\ (Some?.v r1).ms_ok
/\ s2.ms_ok /\ (Some?.v r2).ms_ok
/\ constTimeInvariant ts s1 s2
) ==> (Some?.v r1).ms_trace = (Some?.v r2).ms_trace
let isConstantTime (code:code) (ts:leakage_taints) =
forall s1 s2 fuel.
isConstantTimeGivenStates code fuel ts s1 s2
let is_explicit_leakage_free_lhs (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= s1.ms_ok /\ s2.ms_ok /\ constTimeInvariant ts s1 s2 /\
(let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ (Some?.v r1).ms_ok /\ (Some?.v r2).ms_ok)
let is_explicit_leakage_free_rhs (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ publicValuesAreSame ts' (Some?.v r1) (Some?.v r2)
let isExplicitLeakageFreeGivenStates (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= is_explicit_leakage_free_lhs code fuel ts ts' s1 s2 ==> is_explicit_leakage_free_rhs code fuel ts ts' s1 s2
let isExplicitLeakageFree (code:code) (ts:leakage_taints) (ts':leakage_taints) =
forall s1 s2 fuel.
isExplicitLeakageFreeGivenStates code fuel ts ts' s1 s2 | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val isLeakageFree : code: Vale.X64.Machine_Semantics_s.code ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints
-> Prims.logical | [] | Vale.X64.Leakage_s.isLeakageFree | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
code: Vale.X64.Machine_Semantics_s.code ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints
-> Prims.logical | {
"end_col": 38,
"end_line": 103,
"start_col": 4,
"start_line": 102
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x | let publicStackValuesAreSame (s1 s2: machine_state) = | false | null | false | let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x. {:pattern s1.ms_stackTaint.[ x ]\/s2.ms_stackTaint.[ x ]\/stack1.[ x ]\/stack2.[ x ]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.machine_state",
"Vale.Def.Types_s.nat64",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"FStar.Map.t",
"Prims.int",
"Vale.Def.Types_s.nat8",
"Prims.l_Forall",
"Vale.X64.Leakage_s.publicStackValueIsSame",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_stackTaint",
"Vale.X64.Machine_Semantics_s.op_String_Access",
"Vale.Arch.HeapTypes_s.taint",
"Prims.logical",
"Vale.X64.Machine_Semantics_s.machine_stack",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_stack"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x] | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val publicStackValuesAreSame : s1: Vale.X64.Machine_Semantics_s.machine_state -> s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.publicStackValuesAreSame | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | s1: Vale.X64.Machine_Semantics_s.machine_state -> s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 76,
"end_line": 52,
"start_col": 68,
"start_line": 48
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let is_explicit_leakage_free_rhs (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ publicValuesAreSame ts' (Some?.v r1) (Some?.v r2) | let is_explicit_leakage_free_rhs
(code: code)
(fuel: nat)
(ts ts': leakage_taints)
(s1 s2: machine_state)
= | false | null | false | let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ publicValuesAreSame ts' (Some?.v r1) (Some?.v r2) | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Prims.nat",
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_and",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"Vale.X64.Leakage_s.publicValuesAreSame",
"FStar.Pervasives.Native.__proj__Some__item__v",
"FStar.Pervasives.Native.option",
"Vale.X64.Machine_Semantics_s.machine_eval_code",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x]
let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x
let publicValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
publicRegisterValuesAreSame ts s1 s2
/\ publicFlagValuesAreSame ts s1 s2
/\ publicCfFlagValuesAreSame ts s1 s2
/\ publicOfFlagValuesAreSame ts s1 s2
/\ publicMemValuesAreSame s1 s2
/\ publicStackValuesAreSame s1 s2
let constTimeInvariant (ts:leakage_taints) (s:machine_state) (s':machine_state) =
publicValuesAreSame ts s s'
/\ s.ms_trace = s'.ms_trace
let isConstantTimeGivenStates (code:code) (fuel:nat) (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
( (Some? r1) /\ (Some? r2)
/\ s1.ms_ok /\ (Some?.v r1).ms_ok
/\ s2.ms_ok /\ (Some?.v r2).ms_ok
/\ constTimeInvariant ts s1 s2
) ==> (Some?.v r1).ms_trace = (Some?.v r2).ms_trace
let isConstantTime (code:code) (ts:leakage_taints) =
forall s1 s2 fuel.
isConstantTimeGivenStates code fuel ts s1 s2
let is_explicit_leakage_free_lhs (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= s1.ms_ok /\ s2.ms_ok /\ constTimeInvariant ts s1 s2 /\
(let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ (Some?.v r1).ms_ok /\ (Some?.v r2).ms_ok)
let is_explicit_leakage_free_rhs (code:code) (fuel:nat) | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val is_explicit_leakage_free_rhs : code: Vale.X64.Machine_Semantics_s.code ->
fuel: Prims.nat ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.is_explicit_leakage_free_rhs | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
code: Vale.X64.Machine_Semantics_s.code ->
fuel: Prims.nat ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 77,
"end_line": 91,
"start_col": 3,
"start_line": 89
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let is_explicit_leakage_free_lhs (code:code) (fuel:nat)
(ts:leakage_taints) (ts':leakage_taints) (s1:machine_state) (s2:machine_state)
= s1.ms_ok /\ s2.ms_ok /\ constTimeInvariant ts s1 s2 /\
(let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ (Some?.v r1).ms_ok /\ (Some?.v r2).ms_ok) | let is_explicit_leakage_free_lhs
(code: code)
(fuel: nat)
(ts ts': leakage_taints)
(s1 s2: machine_state)
= | false | null | false | s1.ms_ok /\ s2.ms_ok /\ constTimeInvariant ts s1 s2 /\
(let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
Some? r1 /\ Some? r2 /\ (Some?.v r1).ms_ok /\ (Some?.v r2).ms_ok) | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Prims.nat",
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_and",
"Prims.b2t",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_ok",
"Vale.X64.Leakage_s.constTimeInvariant",
"FStar.Pervasives.Native.uu___is_Some",
"FStar.Pervasives.Native.__proj__Some__item__v",
"FStar.Pervasives.Native.option",
"Vale.X64.Machine_Semantics_s.machine_eval_code",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x]
let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x
let publicValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
publicRegisterValuesAreSame ts s1 s2
/\ publicFlagValuesAreSame ts s1 s2
/\ publicCfFlagValuesAreSame ts s1 s2
/\ publicOfFlagValuesAreSame ts s1 s2
/\ publicMemValuesAreSame s1 s2
/\ publicStackValuesAreSame s1 s2
let constTimeInvariant (ts:leakage_taints) (s:machine_state) (s':machine_state) =
publicValuesAreSame ts s s'
/\ s.ms_trace = s'.ms_trace
let isConstantTimeGivenStates (code:code) (fuel:nat) (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
( (Some? r1) /\ (Some? r2)
/\ s1.ms_ok /\ (Some?.v r1).ms_ok
/\ s2.ms_ok /\ (Some?.v r2).ms_ok
/\ constTimeInvariant ts s1 s2
) ==> (Some?.v r1).ms_trace = (Some?.v r2).ms_trace
let isConstantTime (code:code) (ts:leakage_taints) =
forall s1 s2 fuel.
isConstantTimeGivenStates code fuel ts s1 s2
let is_explicit_leakage_free_lhs (code:code) (fuel:nat) | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val is_explicit_leakage_free_lhs : code: Vale.X64.Machine_Semantics_s.code ->
fuel: Prims.nat ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.is_explicit_leakage_free_lhs | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
code: Vale.X64.Machine_Semantics_s.code ->
fuel: Prims.nat ->
ts: Vale.X64.Leakage_s.leakage_taints ->
ts': Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 70,
"end_line": 85,
"start_col": 4,
"start_line": 82
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags) | let publicCfFlagValuesAreSame (ts: leakage_taints) (s1 s2: machine_state) = | false | null | false | Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags) | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_imp",
"Prims.b2t",
"Vale.Arch.HeapTypes_s.uu___is_Public",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__cfFlagsTaint",
"Prims.op_Equality",
"Vale.X64.Machine_Semantics_s.flag_val_t",
"Vale.X64.Machine_Semantics_s.cf",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_flags",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags) | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val publicCfFlagValuesAreSame : ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.publicCfFlagValuesAreSame | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 63,
"end_line": 20,
"start_col": 2,
"start_line": 20
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let constTimeInvariant (ts:leakage_taints) (s:machine_state) (s':machine_state) =
publicValuesAreSame ts s s'
/\ s.ms_trace = s'.ms_trace | let constTimeInvariant (ts: leakage_taints) (s s': machine_state) = | false | null | false | publicValuesAreSame ts s s' /\ s.ms_trace = s'.ms_trace | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_and",
"Vale.X64.Leakage_s.publicValuesAreSame",
"Prims.b2t",
"Prims.op_Equality",
"Prims.list",
"Vale.X64.Machine_s.observation",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_trace",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x]
let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x
let publicValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
publicRegisterValuesAreSame ts s1 s2
/\ publicFlagValuesAreSame ts s1 s2
/\ publicCfFlagValuesAreSame ts s1 s2
/\ publicOfFlagValuesAreSame ts s1 s2
/\ publicMemValuesAreSame s1 s2
/\ publicStackValuesAreSame s1 s2 | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val constTimeInvariant : ts: Vale.X64.Leakage_s.leakage_taints ->
s: Vale.X64.Machine_Semantics_s.machine_state ->
s': Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.constTimeInvariant | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ts: Vale.X64.Leakage_s.leakage_taints ->
s: Vale.X64.Machine_Semantics_s.machine_state ->
s': Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 29,
"end_line": 64,
"start_col": 4,
"start_line": 63
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags) | let publicOfFlagValuesAreSame (ts: leakage_taints) (s1 s2: machine_state) = | false | null | false | Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags) | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_imp",
"Prims.b2t",
"Vale.Arch.HeapTypes_s.uu___is_Public",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__ofFlagsTaint",
"Prims.op_Equality",
"Vale.X64.Machine_Semantics_s.flag_val_t",
"Vale.X64.Machine_Semantics_s.overflow",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_flags",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags) | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val publicOfFlagValuesAreSame : ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.publicOfFlagValuesAreSame | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 75,
"end_line": 23,
"start_col": 2,
"start_line": 23
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let isConstantTimeGivenStates (code:code) (fuel:nat) (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
( (Some? r1) /\ (Some? r2)
/\ s1.ms_ok /\ (Some?.v r1).ms_ok
/\ s2.ms_ok /\ (Some?.v r2).ms_ok
/\ constTimeInvariant ts s1 s2
) ==> (Some?.v r1).ms_trace = (Some?.v r2).ms_trace | let isConstantTimeGivenStates (code: code) (fuel: nat) (ts: leakage_taints) (s1 s2: machine_state) = | false | null | false | let r1 = machine_eval_code code fuel s1 in
let r2 = machine_eval_code code fuel s2 in
((Some? r1) /\ (Some? r2) /\ s1.ms_ok /\ (Some?.v r1).ms_ok /\ s2.ms_ok /\ (Some?.v r2).ms_ok /\
constTimeInvariant ts s1 s2) ==>
(Some?.v r1).ms_trace = (Some?.v r2).ms_trace | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Machine_Semantics_s.code",
"Prims.nat",
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_imp",
"Prims.l_and",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_ok",
"FStar.Pervasives.Native.__proj__Some__item__v",
"Vale.X64.Leakage_s.constTimeInvariant",
"Prims.op_Equality",
"Prims.list",
"Vale.X64.Machine_s.observation",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_trace",
"FStar.Pervasives.Native.option",
"Vale.X64.Machine_Semantics_s.machine_eval_code",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags)
let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r)
let publicMemValueIsSame
(mem1 mem2:machine_heap)
(memTaint1 memTaint2:Map.t int taint)
(x:int) =
(Public? (memTaint1.[x]) || Public? (memTaint2.[x])) ==>
mem1.[x] == mem2.[x]
let publicMemValuesAreSame (s1:machine_state) (s2:machine_state) =
forall x.{:pattern (heap_taint s1.ms_heap).[x] \/ (heap_taint s2.ms_heap).[x] \/ (heap_get s1.ms_heap).[x] \/ (heap_get s2.ms_heap).[x]}
publicMemValueIsSame (heap_get s1.ms_heap) (heap_get s2.ms_heap) (heap_taint s1.ms_heap) (heap_taint s2.ms_heap) x
let publicStackValueIsSame
(stack1 stack2:machine_heap)
(stackTaint1 stackTaint2:Map.t int taint)
(x:int)
= (Public? (stackTaint1.[x]) || Public? (stackTaint2.[x])) ==>
stack1.[x] == stack2.[x]
let publicStackValuesAreSame (s1:machine_state) (s2:machine_state) =
let Machine_stack _ stack1 = s1.ms_stack in
let Machine_stack _ stack2 = s2.ms_stack in
forall x.{:pattern s1.ms_stackTaint.[x] \/ s2.ms_stackTaint.[x] \/ stack1.[x] \/ stack2.[x]}
publicStackValueIsSame stack1 stack2 s1.ms_stackTaint s2.ms_stackTaint x
let publicValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
publicRegisterValuesAreSame ts s1 s2
/\ publicFlagValuesAreSame ts s1 s2
/\ publicCfFlagValuesAreSame ts s1 s2
/\ publicOfFlagValuesAreSame ts s1 s2
/\ publicMemValuesAreSame s1 s2
/\ publicStackValuesAreSame s1 s2
let constTimeInvariant (ts:leakage_taints) (s:machine_state) (s':machine_state) =
publicValuesAreSame ts s s'
/\ s.ms_trace = s'.ms_trace | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val isConstantTimeGivenStates : code: Vale.X64.Machine_Semantics_s.code ->
fuel: Prims.nat ->
ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.isConstantTimeGivenStates | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
code: Vale.X64.Machine_Semantics_s.code ->
fuel: Prims.nat ->
ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 53,
"end_line": 74,
"start_col": 112,
"start_line": 67
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "FStar.FunctionalExtensionality",
"short_module": "F"
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_Semantics_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.X64.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapTypes_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
}
] | false | let publicRegisterValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
forall r.{:pattern ts.regTaint r \/ s1.ms_regs r \/ s2.ms_regs r}
ts.regTaint r = Public ==>
(s1.ms_regs r = s2.ms_regs r) | let publicRegisterValuesAreSame (ts: leakage_taints) (s1 s2: machine_state) = | false | null | false | forall r. {:pattern ts.regTaint r\/s1.ms_regs r\/s2.ms_regs r}
ts.regTaint r = Public ==> (s1.ms_regs r = s2.ms_regs r) | {
"checked_file": "Vale.X64.Leakage_s.fst.checked",
"dependencies": [
"Vale.X64.Machine_Semantics_s.fst.checked",
"Vale.X64.Machine_s.fst.checked",
"Vale.Arch.HeapTypes_s.fst.checked",
"Vale.Arch.Heap.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Map.fsti.checked",
"FStar.FunctionalExtensionality.fsti.checked"
],
"interface_file": false,
"source_file": "Vale.X64.Leakage_s.fst"
} | [
"total"
] | [
"Vale.X64.Leakage_s.leakage_taints",
"Vale.X64.Machine_Semantics_s.machine_state",
"Prims.l_Forall",
"Vale.X64.Machine_s.reg",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_Equality",
"Vale.Arch.HeapTypes_s.taint",
"Vale.X64.Leakage_s.__proj__LeakageTaints__item__regTaint",
"Vale.Arch.HeapTypes_s.Public",
"Vale.X64.Machine_s.t_reg",
"Vale.X64.Machine_Semantics_s.__proj__Mkmachine_state__item__ms_regs",
"Prims.logical"
] | [] | module Vale.X64.Leakage_s
open FStar.Mul
open Vale.Arch.HeapTypes_s
open Vale.Arch.Heap
open Vale.X64.Machine_s
open Vale.X64.Machine_Semantics_s
module F = FStar.FunctionalExtensionality
type reg_taint = F.restricted_t reg (fun _ -> taint)
noeq type leakage_taints =
| LeakageTaints: regTaint: reg_taint -> flagsTaint: taint -> cfFlagsTaint: taint -> ofFlagsTaint: taint ->
leakage_taints
let publicFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
ts.flagsTaint = Public ==> (s1.ms_flags == s2.ms_flags)
let publicCfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.cfFlagsTaint ==> (cf s1.ms_flags = cf s2.ms_flags)
let publicOfFlagValuesAreSame (ts:leakage_taints) (s1:machine_state) (s2:machine_state) =
Public? ts.ofFlagsTaint ==> (overflow s1.ms_flags = overflow s2.ms_flags) | false | true | Vale.X64.Leakage_s.fst | {
"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"
} | null | val publicRegisterValuesAreSame : ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | [] | Vale.X64.Leakage_s.publicRegisterValuesAreSame | {
"file_name": "vale/specs/hardware/Vale.X64.Leakage_s.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ts: Vale.X64.Leakage_s.leakage_taints ->
s1: Vale.X64.Machine_Semantics_s.machine_state ->
s2: Vale.X64.Machine_Semantics_s.machine_state
-> Prims.logical | {
"end_col": 33,
"end_line": 28,
"start_col": 2,
"start_line": 26
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Meta.Chacha20.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"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
}
] | false | let chacha20_encrypt_128 = vec_chacha20_encrypt_higher #4 True chacha20_init_128 chacha20_core_128 | let chacha20_encrypt_128 = | false | null | false | vec_chacha20_encrypt_higher #4 True chacha20_init_128 chacha20_core_128 | {
"checked_file": "Hacl.Chacha20.Vec128.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Meta.Chacha20.Vec.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Chacha20.Vec128.fst"
} | [
"total"
] | [
"Hacl.Meta.Chacha20.Vec.vec_chacha20_encrypt_higher",
"Prims.l_True",
"Hacl.Chacha20.Vec128.chacha20_init_128",
"Hacl.Chacha20.Vec128.chacha20_core_128"
] | [] | module Hacl.Chacha20.Vec128
open Hacl.Meta.Chacha20.Vec
[@CInline]
private
let double_round_128 = core32xn_double_round_higher #4 True
[@CInline]
private
let chacha20_core_128 = vec_chacha20_core_higher #4 True double_round_128
[@CInline]
private
let chacha20_init_128 = Hacl.Impl.Chacha20.Vec.chacha20_init #4 | false | false | Hacl.Chacha20.Vec128.fst | {
"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"
} | null | val chacha20_encrypt_128 : Hacl.Meta.Chacha20.Vec.vec_chacha20_encrypt_higher_t Prims.l_True | [] | Hacl.Chacha20.Vec128.chacha20_encrypt_128 | {
"file_name": "code/chacha20/Hacl.Chacha20.Vec128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Meta.Chacha20.Vec.vec_chacha20_encrypt_higher_t Prims.l_True | {
"end_col": 98,
"end_line": 15,
"start_col": 27,
"start_line": 15
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Meta.Chacha20.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"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
}
] | false | let double_round_128 = core32xn_double_round_higher #4 True | let double_round_128 = | false | null | false | core32xn_double_round_higher #4 True | {
"checked_file": "Hacl.Chacha20.Vec128.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Meta.Chacha20.Vec.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Chacha20.Vec128.fst"
} | [
"total"
] | [
"Hacl.Meta.Chacha20.Vec.core32xn_double_round_higher",
"Prims.l_True"
] | [] | module Hacl.Chacha20.Vec128
open Hacl.Meta.Chacha20.Vec
[@CInline] | false | false | Hacl.Chacha20.Vec128.fst | {
"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"
} | null | val double_round_128 : Hacl.Meta.Chacha20.Vec.core32xn_double_round_higher_t Prims.l_True | [] | Hacl.Chacha20.Vec128.double_round_128 | {
"file_name": "code/chacha20/Hacl.Chacha20.Vec128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Meta.Chacha20.Vec.core32xn_double_round_higher_t Prims.l_True | {
"end_col": 59,
"end_line": 7,
"start_col": 23,
"start_line": 7
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Meta.Chacha20.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"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
}
] | false | let chacha20_core_128 = vec_chacha20_core_higher #4 True double_round_128 | let chacha20_core_128 = | false | null | false | vec_chacha20_core_higher #4 True double_round_128 | {
"checked_file": "Hacl.Chacha20.Vec128.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Meta.Chacha20.Vec.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Chacha20.Vec128.fst"
} | [
"total"
] | [
"Hacl.Meta.Chacha20.Vec.vec_chacha20_core_higher",
"Prims.l_True",
"Hacl.Chacha20.Vec128.double_round_128"
] | [] | module Hacl.Chacha20.Vec128
open Hacl.Meta.Chacha20.Vec
[@CInline]
private
let double_round_128 = core32xn_double_round_higher #4 True
[@CInline] | false | false | Hacl.Chacha20.Vec128.fst | {
"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"
} | null | val chacha20_core_128 : Hacl.Meta.Chacha20.Vec.vec_chacha20_core_higher_t Prims.l_True | [] | Hacl.Chacha20.Vec128.chacha20_core_128 | {
"file_name": "code/chacha20/Hacl.Chacha20.Vec128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Meta.Chacha20.Vec.vec_chacha20_core_higher_t Prims.l_True | {
"end_col": 73,
"end_line": 10,
"start_col": 24,
"start_line": 10
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Hacl.Meta.Chacha20.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"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
}
] | false | let chacha20_decrypt_128 = vec_chacha20_decrypt_higher #4 True chacha20_init_128 chacha20_core_128 | let chacha20_decrypt_128 = | false | null | false | vec_chacha20_decrypt_higher #4 True chacha20_init_128 chacha20_core_128 | {
"checked_file": "Hacl.Chacha20.Vec128.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Meta.Chacha20.Vec.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Chacha20.Vec128.fst"
} | [
"total"
] | [
"Hacl.Meta.Chacha20.Vec.vec_chacha20_decrypt_higher",
"Prims.l_True",
"Hacl.Chacha20.Vec128.chacha20_init_128",
"Hacl.Chacha20.Vec128.chacha20_core_128"
] | [] | module Hacl.Chacha20.Vec128
open Hacl.Meta.Chacha20.Vec
[@CInline]
private
let double_round_128 = core32xn_double_round_higher #4 True
[@CInline]
private
let chacha20_core_128 = vec_chacha20_core_higher #4 True double_round_128
[@CInline]
private
let chacha20_init_128 = Hacl.Impl.Chacha20.Vec.chacha20_init #4 | false | false | Hacl.Chacha20.Vec128.fst | {
"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"
} | null | val chacha20_decrypt_128 : Hacl.Meta.Chacha20.Vec.vec_chacha20_decrypt_higher_t Prims.l_True | [] | Hacl.Chacha20.Vec128.chacha20_decrypt_128 | {
"file_name": "code/chacha20/Hacl.Chacha20.Vec128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Meta.Chacha20.Vec.vec_chacha20_decrypt_higher_t Prims.l_True | {
"end_col": 98,
"end_line": 16,
"start_col": 27,
"start_line": 16
} |
|
FStar.HyperStack.ST.Stack | [
{
"abbrev": false,
"full_module": "Hacl.Meta.Chacha20.Vec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Chacha20",
"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
}
] | false | let chacha20_init_128 = Hacl.Impl.Chacha20.Vec.chacha20_init #4 | let chacha20_init_128 = | true | null | false | Hacl.Impl.Chacha20.Vec.chacha20_init #4 | {
"checked_file": "Hacl.Chacha20.Vec128.fst.checked",
"dependencies": [
"prims.fst.checked",
"Hacl.Meta.Chacha20.Vec.fst.checked",
"Hacl.Impl.Chacha20.Vec.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Chacha20.Vec128.fst"
} | [] | [
"Hacl.Impl.Chacha20.Vec.chacha20_init"
] | [] | module Hacl.Chacha20.Vec128
open Hacl.Meta.Chacha20.Vec
[@CInline]
private
let double_round_128 = core32xn_double_round_higher #4 True
[@CInline]
private
let chacha20_core_128 = vec_chacha20_core_higher #4 True double_round_128
[@CInline] | false | false | Hacl.Chacha20.Vec128.fst | {
"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"
} | null | val chacha20_init_128 : ctx: Hacl.Impl.Chacha20.Core32xN.state 4 ->
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul ->
ctr0: Lib.IntTypes.size_t
-> FStar.HyperStack.ST.Stack Prims.unit | [] | Hacl.Chacha20.Vec128.chacha20_init_128 | {
"file_name": "code/chacha20/Hacl.Chacha20.Vec128.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
ctx: Hacl.Impl.Chacha20.Core32xN.state 4 ->
k: Lib.Buffer.lbuffer Lib.IntTypes.uint8 32ul ->
n: Lib.Buffer.lbuffer Lib.IntTypes.uint8 12ul ->
ctr0: Lib.IntTypes.size_t
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 63,
"end_line": 13,
"start_col": 24,
"start_line": 13
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Steel.PCMReference",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Steel.ST.Coercions",
"short_module": "C"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"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
}
] | false | let fact_valid_compat (#a:Type) (#pcm:pcm a)
(fact:stable_property pcm)
(v:erased a)
= squash (forall z. compatible pcm v z ==> fact z) | let fact_valid_compat (#a: Type) (#pcm: pcm a) (fact: stable_property pcm) (v: erased a) = | false | null | false | squash (forall z. compatible pcm v z ==> fact z) | {
"checked_file": "Steel.ST.PCMReference.fsti.checked",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.PCMReference.fsti"
} | [
"total"
] | [
"FStar.PCM.pcm",
"Steel.Memory.stable_property",
"FStar.Ghost.erased",
"Prims.squash",
"Prims.l_Forall",
"Prims.l_imp",
"FStar.PCM.compatible",
"FStar.Ghost.reveal"
] | [] | (*
Copyright 2020 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 Steel.ST.PCMReference
open FStar.PCM
open FStar.Ghost
open Steel.ST.Util
/// This module exposes the core PCM-based memory model defined in Steel.Memory
/// as stateful Steel computations.
#set-options "--ide_id_info_off"
/// Lifting the pts_to separation logic, PCM-indexed predicate to a vprop.
/// Its selector is non-informative (it is unit)
[@@ __steel_reduce__]
unfold
let pts_to (#a:Type) (#pcm:pcm a) (r:ref a pcm) (v:a) = to_vprop (pts_to r v)
let pts_to_not_null
(#opened: _)
(#t: Type)
(#p: pcm t)
(r: ref t p)
(v: t)
: STGhost unit opened
(pts_to r v)
(fun _ -> pts_to r v)
True
(fun _ -> r =!= null)
= extract_fact
(pts_to r v)
(r =!= null)
(fun m -> pts_to_not_null r v m)
/// Reading the contents of reference [r] in memory.
/// The returned value [v] is ensured to be compatible with respect
/// to the PCM [pcm] with our current knowledge [v0]
val read (#a:Type)
(#pcm:pcm a)
(r:ref a pcm)
(v0:erased a)
: ST a
(pts_to r v0)
(fun _ -> pts_to r v0)
(requires True)
(ensures fun v -> compatible pcm v0 v /\ True)
/// Writing value [v1] in reference [r], as long as it is frame-preserving with our
/// current knowledge [v0], and that [v1] is a refined value for the PCM [pcm]
val write (#a:Type)
(#pcm:pcm a)
(r:ref a pcm)
(v0:erased a)
(v1:a)
: ST unit
(pts_to r v0)
(fun _ -> pts_to r v1)
(requires frame_preserving pcm v0 v1 /\ pcm.refine v1)
(ensures fun _ -> True)
/// Allocates a new reference, initially storing value [x].
val alloc (#a:Type)
(#pcm:pcm a)
(x:a)
: ST (ref a pcm)
emp
(fun r -> pts_to r x)
(requires pcm.refine x)
(ensures fun _ -> True)
/// Frees reference [r], as long as we have exclusive ownership of [r]
/// according to the governing PCM.
/// Freeing here sets the value to the unit value of the PCM, one can manually
/// call `drop` from Steel.Effect.Atomic to forget it entirely from the context
val free (#a:Type)
(#p:pcm a)
(r:ref a p)
(x:erased a)
: ST unit (pts_to r x) (fun _ -> pts_to r p.p.one)
(requires exclusive p x /\ p.refine p.p.one)
(ensures fun _ -> True)
/// Splits permission on reference [r], in a way that is compatible with the governing PCM.
val split (#inames: _)
(#a:Type)
(#p:pcm a)
(r:ref a p)
(v:erased a)
(v0:erased a)
(v1:erased a)
: STGhost unit inames (pts_to r v)
(fun _ -> pts_to r v0 `star` pts_to r v1)
(requires
composable p v0 v1 /\
v == hide (op p v0 v1))
(ensures fun _ -> True)
/// Gather permissions on reference [r]
val gather (#inames: _)
(#a:Type)
(#p:FStar.PCM.pcm a)
(r:ref a p)
(v0:erased a)
(v1:erased a)
: STGhostT (_:unit{composable p v0 v1}) inames
(pts_to r v0 `star` pts_to r v1)
(fun _ -> pts_to r (op p v0 v1))
let fact_valid_compat (#a:Type) (#pcm:pcm a)
(fact:stable_property pcm) | false | false | Steel.ST.PCMReference.fsti | {
"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"
} | null | val fact_valid_compat : fact: Steel.Memory.stable_property pcm -> v: FStar.Ghost.erased a -> Type0 | [] | Steel.ST.PCMReference.fact_valid_compat | {
"file_name": "lib/steel/Steel.ST.PCMReference.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | fact: Steel.Memory.stable_property pcm -> v: FStar.Ghost.erased a -> Type0 | {
"end_col": 52,
"end_line": 128,
"start_col": 4,
"start_line": 128
} |
|
Prims.Tot | [
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"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
}
] | false | let pts_to (#a:Type) (#pcm:pcm a) (r:ref a pcm) (v:a) = to_vprop (pts_to r v) | let pts_to (#a: Type) (#pcm: pcm a) (r: ref a pcm) (v: a) = | false | null | false | to_vprop (pts_to r v) | {
"checked_file": "Steel.ST.PCMReference.fsti.checked",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.PCMReference.fsti"
} | [
"total"
] | [
"FStar.PCM.pcm",
"Steel.Memory.ref",
"Steel.Effect.Common.to_vprop",
"Steel.Memory.pts_to",
"Steel.Effect.Common.vprop"
] | [] | (*
Copyright 2020 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 Steel.ST.PCMReference
open FStar.PCM
open FStar.Ghost
open Steel.ST.Util
/// This module exposes the core PCM-based memory model defined in Steel.Memory
/// as stateful Steel computations.
#set-options "--ide_id_info_off"
/// Lifting the pts_to separation logic, PCM-indexed predicate to a vprop.
/// Its selector is non-informative (it is unit)
[@@ __steel_reduce__] | false | false | Steel.ST.PCMReference.fsti | {
"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"
} | null | val pts_to : r: Steel.Memory.ref a pcm -> v: a -> Steel.Effect.Common.vprop | [] | Steel.ST.PCMReference.pts_to | {
"file_name": "lib/steel/Steel.ST.PCMReference.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | r: Steel.Memory.ref a pcm -> v: a -> Steel.Effect.Common.vprop | {
"end_col": 77,
"end_line": 33,
"start_col": 56,
"start_line": 33
} |
|
Steel.ST.Effect.Ghost.STGhost | val pts_to_not_null (#opened: _) (#t: Type) (#p: pcm t) (r: ref t p) (v: t)
: STGhost unit opened (pts_to r v) (fun _ -> pts_to r v) True (fun _ -> r =!= null) | [
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.PCM",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"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
}
] | false | let pts_to_not_null
(#opened: _)
(#t: Type)
(#p: pcm t)
(r: ref t p)
(v: t)
: STGhost unit opened
(pts_to r v)
(fun _ -> pts_to r v)
True
(fun _ -> r =!= null)
= extract_fact
(pts_to r v)
(r =!= null)
(fun m -> pts_to_not_null r v m) | val pts_to_not_null (#opened: _) (#t: Type) (#p: pcm t) (r: ref t p) (v: t)
: STGhost unit opened (pts_to r v) (fun _ -> pts_to r v) True (fun _ -> r =!= null)
let pts_to_not_null (#opened: _) (#t: Type) (#p: pcm t) (r: ref t p) (v: t)
: STGhost unit opened (pts_to r v) (fun _ -> pts_to r v) True (fun _ -> r =!= null) = | true | null | false | extract_fact (pts_to r v) (r =!= null) (fun m -> pts_to_not_null r v m) | {
"checked_file": "Steel.ST.PCMReference.fsti.checked",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.PCM.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Steel.ST.PCMReference.fsti"
} | [] | [
"Steel.Memory.inames",
"FStar.PCM.pcm",
"Steel.Memory.ref",
"Steel.ST.Effect.Ghost.extract_fact",
"Steel.ST.PCMReference.pts_to",
"Prims.l_not",
"Prims.eq2",
"Steel.Memory.null",
"Steel.Memory.mem",
"Steel.Memory.pts_to_not_null",
"Prims.unit",
"Steel.Effect.Common.vprop",
"Prims.l_True"
] | [] | (*
Copyright 2020 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 Steel.ST.PCMReference
open FStar.PCM
open FStar.Ghost
open Steel.ST.Util
/// This module exposes the core PCM-based memory model defined in Steel.Memory
/// as stateful Steel computations.
#set-options "--ide_id_info_off"
/// Lifting the pts_to separation logic, PCM-indexed predicate to a vprop.
/// Its selector is non-informative (it is unit)
[@@ __steel_reduce__]
unfold
let pts_to (#a:Type) (#pcm:pcm a) (r:ref a pcm) (v:a) = to_vprop (pts_to r v)
let pts_to_not_null
(#opened: _)
(#t: Type)
(#p: pcm t)
(r: ref t p)
(v: t)
: STGhost unit opened
(pts_to r v)
(fun _ -> pts_to r v)
True | false | false | Steel.ST.PCMReference.fsti | {
"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"
} | null | val pts_to_not_null (#opened: _) (#t: Type) (#p: pcm t) (r: ref t p) (v: t)
: STGhost unit opened (pts_to r v) (fun _ -> pts_to r v) True (fun _ -> r =!= null) | [] | Steel.ST.PCMReference.pts_to_not_null | {
"file_name": "lib/steel/Steel.ST.PCMReference.fsti",
"git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | r: Steel.Memory.ref t p -> v: t -> Steel.ST.Effect.Ghost.STGhost Prims.unit | {
"end_col": 36,
"end_line": 49,
"start_col": 2,
"start_line": 46
} |
FStar.Tactics.Effect.Tac | val step (t: (unit -> Tac unit)) : Tac unit | [
{
"abbrev": true,
"full_module": "FStar.Order",
"short_module": "O"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2.Arith",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"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
}
] | false | let step (t : unit -> Tac unit) : Tac unit =
apply_lemma (`trans);
t () | val step (t: (unit -> Tac unit)) : Tac unit
let step (t: (unit -> Tac unit)) : Tac unit = | true | null | false | apply_lemma (`trans);
t () | {
"checked_file": "FStar.Tactics.Canon.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.Arith.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Order.fst.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.Canon.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V2.Derived.apply_lemma"
] | [] | (*
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.Tactics.Canon
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Reflection.V2.Arith
open FStar.Mul
module O = FStar.Order
private
val distr : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y + z) == x * y + x * z)
private
let distr #x #y #z = ()
private
val distl : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) * z == x * z + y * z)
private
let distl #x #y #z = ()
private
val ass_plus_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x + (y + z) == (x + y) + z)
private
let ass_plus_l #x #y #z = ()
private
val ass_mult_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y * z) == (x * y) * z)
private
let ass_mult_l #x #y #z = ()
private
val comm_plus : (#x : int) -> (#y : int) -> Lemma (x + y == y + x)
private
let comm_plus #x #y = ()
private
val sw_plus : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) + z == (x + z) + y)
private
let sw_plus #x #y #z = ()
private
val sw_mult : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x * y) * z == (x * z) * y)
private
let sw_mult #x #y #z = ()
private
val comm_mult : (#x : int) -> (#y : int) -> Lemma (x * y == y * x)
private
let comm_mult #x #y = ()
private
val trans : (#a:Type) -> (#x:a) -> (#z:a) -> (#y:a) ->
squash (x == y) -> squash (y == z) -> Lemma (x == z)
private
let trans #a #x #z #y e1 e2 = ()
private
val cong_plus : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w + x == y + z)
private
let cong_plus #w #x #y #z p q = ()
private
val cong_mult : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w * x == y * z)
private
let cong_mult #w #x #y #z p q = ()
private
val neg_minus_one : (#x:int) -> Lemma (-x == (-1) * x)
private
let neg_minus_one #x = ()
private
val x_plus_zero : (#x:int) -> Lemma (x + 0 == x)
private
let x_plus_zero #x = ()
private
val zero_plus_x : (#x:int) -> Lemma (0 + x == x)
private
let zero_plus_x #x = ()
private
val x_mult_zero : (#x:int) -> Lemma (x * 0 == 0)
private
let x_mult_zero #x = ()
private
val zero_mult_x : (#x:int) -> Lemma (0 * x == 0)
private
let zero_mult_x #x = ()
private
val x_mult_one : (#x:int) -> Lemma (x * 1 == x)
private
let x_mult_one #x = ()
private
val one_mult_x : (#x:int) -> Lemma (1 * x == x)
private
let one_mult_x #x = ()
private
val minus_is_plus : (#x : int) -> (#y : int) -> Lemma (x - y == x + (-y))
private
let minus_is_plus #x #y = ()
private | false | false | FStar.Tactics.Canon.fst | {
"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"
} | null | val step (t: (unit -> Tac unit)) : Tac unit | [] | FStar.Tactics.Canon.step | {
"file_name": "ulib/FStar.Tactics.Canon.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | t: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit) -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 8,
"end_line": 127,
"start_col": 4,
"start_line": 126
} |
FStar.Tactics.Effect.Tac | val step_lemma (lem: term) : Tac unit | [
{
"abbrev": true,
"full_module": "FStar.Order",
"short_module": "O"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2.Arith",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"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
}
] | false | let step_lemma (lem : term) : Tac unit =
step (fun () -> apply_lemma lem) | val step_lemma (lem: term) : Tac unit
let step_lemma (lem: term) : Tac unit = | true | null | false | step (fun () -> apply_lemma lem) | {
"checked_file": "FStar.Tactics.Canon.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.Arith.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Order.fst.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.Canon.fst"
} | [] | [
"FStar.Tactics.NamedView.term",
"FStar.Tactics.Canon.step",
"Prims.unit",
"FStar.Tactics.V2.Derived.apply_lemma"
] | [] | (*
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.Tactics.Canon
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Reflection.V2.Arith
open FStar.Mul
module O = FStar.Order
private
val distr : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y + z) == x * y + x * z)
private
let distr #x #y #z = ()
private
val distl : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) * z == x * z + y * z)
private
let distl #x #y #z = ()
private
val ass_plus_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x + (y + z) == (x + y) + z)
private
let ass_plus_l #x #y #z = ()
private
val ass_mult_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y * z) == (x * y) * z)
private
let ass_mult_l #x #y #z = ()
private
val comm_plus : (#x : int) -> (#y : int) -> Lemma (x + y == y + x)
private
let comm_plus #x #y = ()
private
val sw_plus : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) + z == (x + z) + y)
private
let sw_plus #x #y #z = ()
private
val sw_mult : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x * y) * z == (x * z) * y)
private
let sw_mult #x #y #z = ()
private
val comm_mult : (#x : int) -> (#y : int) -> Lemma (x * y == y * x)
private
let comm_mult #x #y = ()
private
val trans : (#a:Type) -> (#x:a) -> (#z:a) -> (#y:a) ->
squash (x == y) -> squash (y == z) -> Lemma (x == z)
private
let trans #a #x #z #y e1 e2 = ()
private
val cong_plus : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w + x == y + z)
private
let cong_plus #w #x #y #z p q = ()
private
val cong_mult : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w * x == y * z)
private
let cong_mult #w #x #y #z p q = ()
private
val neg_minus_one : (#x:int) -> Lemma (-x == (-1) * x)
private
let neg_minus_one #x = ()
private
val x_plus_zero : (#x:int) -> Lemma (x + 0 == x)
private
let x_plus_zero #x = ()
private
val zero_plus_x : (#x:int) -> Lemma (0 + x == x)
private
let zero_plus_x #x = ()
private
val x_mult_zero : (#x:int) -> Lemma (x * 0 == 0)
private
let x_mult_zero #x = ()
private
val zero_mult_x : (#x:int) -> Lemma (0 * x == 0)
private
let zero_mult_x #x = ()
private
val x_mult_one : (#x:int) -> Lemma (x * 1 == x)
private
let x_mult_one #x = ()
private
val one_mult_x : (#x:int) -> Lemma (1 * x == x)
private
let one_mult_x #x = ()
private
val minus_is_plus : (#x : int) -> (#y : int) -> Lemma (x - y == x + (-y))
private
let minus_is_plus #x #y = ()
private
let step (t : unit -> Tac unit) : Tac unit =
apply_lemma (`trans);
t ()
private | false | false | FStar.Tactics.Canon.fst | {
"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"
} | null | val step_lemma (lem: term) : Tac unit | [] | FStar.Tactics.Canon.step_lemma | {
"file_name": "ulib/FStar.Tactics.Canon.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | lem: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 36,
"end_line": 131,
"start_col": 4,
"start_line": 131
} |
FStar.Tactics.Effect.Tac | val canon: Prims.unit -> Tac unit | [
{
"abbrev": true,
"full_module": "FStar.Order",
"short_module": "O"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2.Arith",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"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
}
] | false | let canon () : Tac unit =
pointwise canon_point_entry | val canon: Prims.unit -> Tac unit
let canon () : Tac unit = | true | null | false | pointwise canon_point_entry | {
"checked_file": "FStar.Tactics.Canon.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.Arith.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Order.fst.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.Canon.fst"
} | [] | [
"Prims.unit",
"FStar.Tactics.V2.Derived.pointwise",
"FStar.Tactics.Canon.canon_point_entry"
] | [] | (*
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.Tactics.Canon
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Reflection.V2.Arith
open FStar.Mul
module O = FStar.Order
private
val distr : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y + z) == x * y + x * z)
private
let distr #x #y #z = ()
private
val distl : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) * z == x * z + y * z)
private
let distl #x #y #z = ()
private
val ass_plus_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x + (y + z) == (x + y) + z)
private
let ass_plus_l #x #y #z = ()
private
val ass_mult_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y * z) == (x * y) * z)
private
let ass_mult_l #x #y #z = ()
private
val comm_plus : (#x : int) -> (#y : int) -> Lemma (x + y == y + x)
private
let comm_plus #x #y = ()
private
val sw_plus : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) + z == (x + z) + y)
private
let sw_plus #x #y #z = ()
private
val sw_mult : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x * y) * z == (x * z) * y)
private
let sw_mult #x #y #z = ()
private
val comm_mult : (#x : int) -> (#y : int) -> Lemma (x * y == y * x)
private
let comm_mult #x #y = ()
private
val trans : (#a:Type) -> (#x:a) -> (#z:a) -> (#y:a) ->
squash (x == y) -> squash (y == z) -> Lemma (x == z)
private
let trans #a #x #z #y e1 e2 = ()
private
val cong_plus : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w + x == y + z)
private
let cong_plus #w #x #y #z p q = ()
private
val cong_mult : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w * x == y * z)
private
let cong_mult #w #x #y #z p q = ()
private
val neg_minus_one : (#x:int) -> Lemma (-x == (-1) * x)
private
let neg_minus_one #x = ()
private
val x_plus_zero : (#x:int) -> Lemma (x + 0 == x)
private
let x_plus_zero #x = ()
private
val zero_plus_x : (#x:int) -> Lemma (0 + x == x)
private
let zero_plus_x #x = ()
private
val x_mult_zero : (#x:int) -> Lemma (x * 0 == 0)
private
let x_mult_zero #x = ()
private
val zero_mult_x : (#x:int) -> Lemma (0 * x == 0)
private
let zero_mult_x #x = ()
private
val x_mult_one : (#x:int) -> Lemma (x * 1 == x)
private
let x_mult_one #x = ()
private
val one_mult_x : (#x:int) -> Lemma (1 * x == x)
private
let one_mult_x #x = ()
private
val minus_is_plus : (#x : int) -> (#y : int) -> Lemma (x - y == x + (-y))
private
let minus_is_plus #x #y = ()
private
let step (t : unit -> Tac unit) : Tac unit =
apply_lemma (`trans);
t ()
private
let step_lemma (lem : term) : Tac unit =
step (fun () -> apply_lemma lem)
private val canon_point : expr -> Tac expr
private let rec canon_point e =
let skip () : Tac expr =
trefl (); e
in
match e with
// Evaluate constants
| Plus (Lit a) (Lit b) ->
norm [primops];
trefl ();
Lit (a + b)
| Mult (Lit a) (Lit b) ->
norm [delta; primops]; // Need delta to turn op_Star into op_Multiply, as there's no primop for it
trefl ();
Lit (a * b)
// Forget about negations
| Neg e ->
step_lemma (`neg_minus_one);
canon_point (Mult (Lit (-1)) e)
// Distribute
| Mult a (Plus b c) ->
step_lemma (`distr);
step_lemma (`cong_plus);
let l = canon_point (Mult a b) in
let r = canon_point (Mult a c) in
canon_point (Plus l r)
| Mult (Plus a b) c ->
step_lemma (`distl);
step_lemma (`cong_plus);
let l = canon_point (Mult a c) in
let r = canon_point (Mult b c) in
canon_point (Plus l r)
// Associate to the left
| Mult a (Mult b c) ->
step_lemma (`ass_mult_l);
step_lemma (`cong_mult);
let l = canon_point (Mult a b) in
let r = canon_point c in
canon_point (Mult l r)
| Plus a (Plus b c) ->
step_lemma (`ass_plus_l);
step_lemma (`cong_plus);
let l = canon_point (Plus a b) in
let r = canon_point c in
canon_point (Plus l r)
| Plus (Plus a b) c ->
if O.gt (compare_expr b c)
then begin
step_lemma (`sw_plus);
apply_lemma (`cong_plus);
let l = canon_point (Plus a c) in
trefl() ;
Plus l b
end
else skip ()
| Mult (Mult a b) c ->
if O.gt (compare_expr b c)
then begin
step_lemma (`sw_mult);
apply_lemma (`cong_mult);
let l = canon_point (Mult a c) in
trefl ();
Mult l b
end
else skip ()
| Plus a (Lit 0) ->
apply_lemma (`x_plus_zero);
a
| Plus (Lit 0) b ->
apply_lemma (`zero_plus_x);
b
| Plus a b ->
if O.gt (compare_expr a b)
then (apply_lemma (`comm_plus); Plus b a)
else skip ()
| Mult (Lit 0) _ ->
apply_lemma (`zero_mult_x);
Lit 0
| Mult _ (Lit 0) ->
apply_lemma (`x_mult_zero);
Lit 0
| Mult (Lit 1) r ->
apply_lemma (`one_mult_x);
r
| Mult l (Lit 1) ->
apply_lemma (`x_mult_one);
l
| Mult a b ->
if O.gt (compare_expr a b)
then (apply_lemma (`comm_mult); Mult b a)
else skip ()
// Forget about subtraction
| Minus a b ->
step_lemma (`minus_is_plus);
step_lemma (`cong_plus);
trefl ();
let r = canon_point (Neg b) in
canon_point (Plus a r)
| _ ->
skip ()
// On canon_point_entry, we interpret the LHS of the goal as an
// arithmetic expression, of which we keep track in canon_point so we
// avoid reinterpreting the goal, which gives a good speedup.
//
// However, we are repeating work between canon_point_entry calls, since
// in (L + R), we are called once for L, once for R, and once for the
// sum which traverses both (their canonized forms, actually).
//
// The proper way to solve this is have some state-passing in pointwise,
// maybe having the inner tactic be of type (list a -> tactic a), where
// the list is the collected results for all child calls.
let canon_point_entry () : Tac unit =
norm [];
let g = cur_goal () in
match term_as_formula g with
| Comp (Eq _) l r ->
begin match run_tm (is_arith_expr l) with
| Inr e -> (let _e = canon_point e in ())
| Inl _ -> trefl ()
end
| _ ->
fail ("impossible: " ^ term_to_string g) | false | false | FStar.Tactics.Canon.fst | {
"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"
} | null | val canon: Prims.unit -> Tac unit | [] | FStar.Tactics.Canon.canon | {
"file_name": "ulib/FStar.Tactics.Canon.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 31,
"end_line": 276,
"start_col": 4,
"start_line": 276
} |
FStar.Tactics.Effect.Tac | val canon_point : expr -> Tac expr | [
{
"abbrev": true,
"full_module": "FStar.Order",
"short_module": "O"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2.Arith",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"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
}
] | false | let rec canon_point e =
let skip () : Tac expr =
trefl (); e
in
match e with
// Evaluate constants
| Plus (Lit a) (Lit b) ->
norm [primops];
trefl ();
Lit (a + b)
| Mult (Lit a) (Lit b) ->
norm [delta; primops]; // Need delta to turn op_Star into op_Multiply, as there's no primop for it
trefl ();
Lit (a * b)
// Forget about negations
| Neg e ->
step_lemma (`neg_minus_one);
canon_point (Mult (Lit (-1)) e)
// Distribute
| Mult a (Plus b c) ->
step_lemma (`distr);
step_lemma (`cong_plus);
let l = canon_point (Mult a b) in
let r = canon_point (Mult a c) in
canon_point (Plus l r)
| Mult (Plus a b) c ->
step_lemma (`distl);
step_lemma (`cong_plus);
let l = canon_point (Mult a c) in
let r = canon_point (Mult b c) in
canon_point (Plus l r)
// Associate to the left
| Mult a (Mult b c) ->
step_lemma (`ass_mult_l);
step_lemma (`cong_mult);
let l = canon_point (Mult a b) in
let r = canon_point c in
canon_point (Mult l r)
| Plus a (Plus b c) ->
step_lemma (`ass_plus_l);
step_lemma (`cong_plus);
let l = canon_point (Plus a b) in
let r = canon_point c in
canon_point (Plus l r)
| Plus (Plus a b) c ->
if O.gt (compare_expr b c)
then begin
step_lemma (`sw_plus);
apply_lemma (`cong_plus);
let l = canon_point (Plus a c) in
trefl() ;
Plus l b
end
else skip ()
| Mult (Mult a b) c ->
if O.gt (compare_expr b c)
then begin
step_lemma (`sw_mult);
apply_lemma (`cong_mult);
let l = canon_point (Mult a c) in
trefl ();
Mult l b
end
else skip ()
| Plus a (Lit 0) ->
apply_lemma (`x_plus_zero);
a
| Plus (Lit 0) b ->
apply_lemma (`zero_plus_x);
b
| Plus a b ->
if O.gt (compare_expr a b)
then (apply_lemma (`comm_plus); Plus b a)
else skip ()
| Mult (Lit 0) _ ->
apply_lemma (`zero_mult_x);
Lit 0
| Mult _ (Lit 0) ->
apply_lemma (`x_mult_zero);
Lit 0
| Mult (Lit 1) r ->
apply_lemma (`one_mult_x);
r
| Mult l (Lit 1) ->
apply_lemma (`x_mult_one);
l
| Mult a b ->
if O.gt (compare_expr a b)
then (apply_lemma (`comm_mult); Mult b a)
else skip ()
// Forget about subtraction
| Minus a b ->
step_lemma (`minus_is_plus);
step_lemma (`cong_plus);
trefl ();
let r = canon_point (Neg b) in
canon_point (Plus a r)
| _ ->
skip () | val canon_point : expr -> Tac expr
let rec canon_point e = | true | null | false | let skip () : Tac expr =
trefl ();
e
in
match e with
| Plus (Lit a) (Lit b) ->
norm [primops];
trefl ();
Lit (a + b)
| Mult (Lit a) (Lit b) ->
norm [delta; primops];
trefl ();
Lit (a * b)
| Neg e ->
step_lemma (`neg_minus_one);
canon_point (Mult (Lit (- 1)) e)
| Mult a (Plus b c) ->
step_lemma (`distr);
step_lemma (`cong_plus);
let l = canon_point (Mult a b) in
let r = canon_point (Mult a c) in
canon_point (Plus l r)
| Mult (Plus a b) c ->
step_lemma (`distl);
step_lemma (`cong_plus);
let l = canon_point (Mult a c) in
let r = canon_point (Mult b c) in
canon_point (Plus l r)
| Mult a (Mult b c) ->
step_lemma (`ass_mult_l);
step_lemma (`cong_mult);
let l = canon_point (Mult a b) in
let r = canon_point c in
canon_point (Mult l r)
| Plus a (Plus b c) ->
step_lemma (`ass_plus_l);
step_lemma (`cong_plus);
let l = canon_point (Plus a b) in
let r = canon_point c in
canon_point (Plus l r)
| Plus (Plus a b) c ->
if O.gt (compare_expr b c)
then
(step_lemma (`sw_plus);
apply_lemma (`cong_plus);
let l = canon_point (Plus a c) in
trefl ();
Plus l b)
else skip ()
| Mult (Mult a b) c ->
if O.gt (compare_expr b c)
then
(step_lemma (`sw_mult);
apply_lemma (`cong_mult);
let l = canon_point (Mult a c) in
trefl ();
Mult l b)
else skip ()
| Plus a (Lit 0) ->
apply_lemma (`x_plus_zero);
a
| Plus (Lit 0) b ->
apply_lemma (`zero_plus_x);
b
| Plus a b ->
if O.gt (compare_expr a b)
then
(apply_lemma (`comm_plus);
Plus b a)
else skip ()
| Mult (Lit 0) _ ->
apply_lemma (`zero_mult_x);
Lit 0
| Mult _ (Lit 0) ->
apply_lemma (`x_mult_zero);
Lit 0
| Mult (Lit 1) r ->
apply_lemma (`one_mult_x);
r
| Mult l (Lit 1) ->
apply_lemma (`x_mult_one);
l
| Mult a b ->
if O.gt (compare_expr a b)
then
(apply_lemma (`comm_mult);
Mult b a)
else skip ()
| Minus a b ->
step_lemma (`minus_is_plus);
step_lemma (`cong_plus);
trefl ();
let r = canon_point (Neg b) in
canon_point (Plus a r)
| _ -> skip () | {
"checked_file": "FStar.Tactics.Canon.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.Arith.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Order.fst.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.Canon.fst"
} | [] | [
"FStar.Reflection.V2.Arith.expr",
"Prims.int",
"FStar.Reflection.V2.Arith.Lit",
"Prims.op_Addition",
"Prims.unit",
"FStar.Tactics.V2.Derived.trefl",
"FStar.Tactics.V2.Builtins.norm",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.primops",
"Prims.Nil",
"FStar.Mul.op_Star",
"FStar.Pervasives.delta",
"FStar.Tactics.Canon.canon_point",
"FStar.Reflection.V2.Arith.Mult",
"Prims.op_Minus",
"FStar.Tactics.Canon.step_lemma",
"FStar.Reflection.V2.Arith.Plus",
"FStar.Order.gt",
"FStar.Reflection.V2.Arith.compare_expr",
"FStar.Tactics.V2.Derived.apply_lemma",
"Prims.bool",
"FStar.Reflection.V2.Arith.Neg"
] | [] | (*
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.Tactics.Canon
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Reflection.V2.Arith
open FStar.Mul
module O = FStar.Order
private
val distr : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y + z) == x * y + x * z)
private
let distr #x #y #z = ()
private
val distl : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) * z == x * z + y * z)
private
let distl #x #y #z = ()
private
val ass_plus_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x + (y + z) == (x + y) + z)
private
let ass_plus_l #x #y #z = ()
private
val ass_mult_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y * z) == (x * y) * z)
private
let ass_mult_l #x #y #z = ()
private
val comm_plus : (#x : int) -> (#y : int) -> Lemma (x + y == y + x)
private
let comm_plus #x #y = ()
private
val sw_plus : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) + z == (x + z) + y)
private
let sw_plus #x #y #z = ()
private
val sw_mult : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x * y) * z == (x * z) * y)
private
let sw_mult #x #y #z = ()
private
val comm_mult : (#x : int) -> (#y : int) -> Lemma (x * y == y * x)
private
let comm_mult #x #y = ()
private
val trans : (#a:Type) -> (#x:a) -> (#z:a) -> (#y:a) ->
squash (x == y) -> squash (y == z) -> Lemma (x == z)
private
let trans #a #x #z #y e1 e2 = ()
private
val cong_plus : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w + x == y + z)
private
let cong_plus #w #x #y #z p q = ()
private
val cong_mult : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w * x == y * z)
private
let cong_mult #w #x #y #z p q = ()
private
val neg_minus_one : (#x:int) -> Lemma (-x == (-1) * x)
private
let neg_minus_one #x = ()
private
val x_plus_zero : (#x:int) -> Lemma (x + 0 == x)
private
let x_plus_zero #x = ()
private
val zero_plus_x : (#x:int) -> Lemma (0 + x == x)
private
let zero_plus_x #x = ()
private
val x_mult_zero : (#x:int) -> Lemma (x * 0 == 0)
private
let x_mult_zero #x = ()
private
val zero_mult_x : (#x:int) -> Lemma (0 * x == 0)
private
let zero_mult_x #x = ()
private
val x_mult_one : (#x:int) -> Lemma (x * 1 == x)
private
let x_mult_one #x = ()
private
val one_mult_x : (#x:int) -> Lemma (1 * x == x)
private
let one_mult_x #x = ()
private
val minus_is_plus : (#x : int) -> (#y : int) -> Lemma (x - y == x + (-y))
private
let minus_is_plus #x #y = ()
private
let step (t : unit -> Tac unit) : Tac unit =
apply_lemma (`trans);
t ()
private
let step_lemma (lem : term) : Tac unit =
step (fun () -> apply_lemma lem) | false | false | FStar.Tactics.Canon.fst | {
"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"
} | null | val canon_point : expr -> Tac expr | [
"recursion"
] | FStar.Tactics.Canon.canon_point | {
"file_name": "ulib/FStar.Tactics.Canon.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | e: FStar.Reflection.V2.Arith.expr -> FStar.Tactics.Effect.Tac FStar.Reflection.V2.Arith.expr | {
"end_col": 15,
"end_line": 250,
"start_col": 31,
"start_line": 134
} |
FStar.Tactics.Effect.Tac | val canon_point_entry: Prims.unit -> Tac unit | [
{
"abbrev": true,
"full_module": "FStar.Order",
"short_module": "O"
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2.Arith",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Reflection.V2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Tactics",
"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
}
] | false | let canon_point_entry () : Tac unit =
norm [];
let g = cur_goal () in
match term_as_formula g with
| Comp (Eq _) l r ->
begin match run_tm (is_arith_expr l) with
| Inr e -> (let _e = canon_point e in ())
| Inl _ -> trefl ()
end
| _ ->
fail ("impossible: " ^ term_to_string g) | val canon_point_entry: Prims.unit -> Tac unit
let canon_point_entry () : Tac unit = | true | null | false | norm [];
let g = cur_goal () in
match term_as_formula g with
| Comp (Eq _) l r ->
(match run_tm (is_arith_expr l) with
| Inr e ->
(let _e = canon_point e in
())
| Inl _ -> trefl ())
| _ -> fail ("impossible: " ^ term_to_string g) | {
"checked_file": "FStar.Tactics.Canon.fst.checked",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Reflection.V2.Arith.fst.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Order.fst.checked",
"FStar.Mul.fst.checked"
],
"interface_file": false,
"source_file": "FStar.Tactics.Canon.fst"
} | [] | [
"Prims.unit",
"FStar.Pervasives.Native.option",
"FStar.Reflection.Types.typ",
"FStar.Tactics.NamedView.term",
"FStar.Reflection.V2.Arith.expr",
"FStar.Tactics.Canon.canon_point",
"Prims.string",
"FStar.Tactics.V2.Derived.trefl",
"FStar.Pervasives.either",
"FStar.Reflection.V2.Arith.run_tm",
"FStar.Reflection.V2.Arith.is_arith_expr",
"FStar.Reflection.V2.Formula.formula",
"FStar.Tactics.V2.Derived.fail",
"Prims.op_Hat",
"FStar.Tactics.V2.Builtins.term_to_string",
"FStar.Reflection.V2.Formula.term_as_formula",
"FStar.Tactics.V2.Derived.cur_goal",
"FStar.Tactics.V2.Builtins.norm",
"Prims.Nil",
"FStar.Pervasives.norm_step"
] | [] | (*
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.Tactics.Canon
open FStar.Reflection.V2
open FStar.Tactics.V2
open FStar.Reflection.V2.Arith
open FStar.Mul
module O = FStar.Order
private
val distr : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y + z) == x * y + x * z)
private
let distr #x #y #z = ()
private
val distl : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) * z == x * z + y * z)
private
let distl #x #y #z = ()
private
val ass_plus_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x + (y + z) == (x + y) + z)
private
let ass_plus_l #x #y #z = ()
private
val ass_mult_l : (#x : int) -> (#y : int) -> (#z : int) -> Lemma (x * (y * z) == (x * y) * z)
private
let ass_mult_l #x #y #z = ()
private
val comm_plus : (#x : int) -> (#y : int) -> Lemma (x + y == y + x)
private
let comm_plus #x #y = ()
private
val sw_plus : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x + y) + z == (x + z) + y)
private
let sw_plus #x #y #z = ()
private
val sw_mult : (#x : int) -> (#y : int) -> (#z : int) -> Lemma ((x * y) * z == (x * z) * y)
private
let sw_mult #x #y #z = ()
private
val comm_mult : (#x : int) -> (#y : int) -> Lemma (x * y == y * x)
private
let comm_mult #x #y = ()
private
val trans : (#a:Type) -> (#x:a) -> (#z:a) -> (#y:a) ->
squash (x == y) -> squash (y == z) -> Lemma (x == z)
private
let trans #a #x #z #y e1 e2 = ()
private
val cong_plus : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w + x == y + z)
private
let cong_plus #w #x #y #z p q = ()
private
val cong_mult : (#w:int) -> (#x:int) -> (#y:int) -> (#z:int) ->
squash (w == y) -> squash (x == z) ->
Lemma (w * x == y * z)
private
let cong_mult #w #x #y #z p q = ()
private
val neg_minus_one : (#x:int) -> Lemma (-x == (-1) * x)
private
let neg_minus_one #x = ()
private
val x_plus_zero : (#x:int) -> Lemma (x + 0 == x)
private
let x_plus_zero #x = ()
private
val zero_plus_x : (#x:int) -> Lemma (0 + x == x)
private
let zero_plus_x #x = ()
private
val x_mult_zero : (#x:int) -> Lemma (x * 0 == 0)
private
let x_mult_zero #x = ()
private
val zero_mult_x : (#x:int) -> Lemma (0 * x == 0)
private
let zero_mult_x #x = ()
private
val x_mult_one : (#x:int) -> Lemma (x * 1 == x)
private
let x_mult_one #x = ()
private
val one_mult_x : (#x:int) -> Lemma (1 * x == x)
private
let one_mult_x #x = ()
private
val minus_is_plus : (#x : int) -> (#y : int) -> Lemma (x - y == x + (-y))
private
let minus_is_plus #x #y = ()
private
let step (t : unit -> Tac unit) : Tac unit =
apply_lemma (`trans);
t ()
private
let step_lemma (lem : term) : Tac unit =
step (fun () -> apply_lemma lem)
private val canon_point : expr -> Tac expr
private let rec canon_point e =
let skip () : Tac expr =
trefl (); e
in
match e with
// Evaluate constants
| Plus (Lit a) (Lit b) ->
norm [primops];
trefl ();
Lit (a + b)
| Mult (Lit a) (Lit b) ->
norm [delta; primops]; // Need delta to turn op_Star into op_Multiply, as there's no primop for it
trefl ();
Lit (a * b)
// Forget about negations
| Neg e ->
step_lemma (`neg_minus_one);
canon_point (Mult (Lit (-1)) e)
// Distribute
| Mult a (Plus b c) ->
step_lemma (`distr);
step_lemma (`cong_plus);
let l = canon_point (Mult a b) in
let r = canon_point (Mult a c) in
canon_point (Plus l r)
| Mult (Plus a b) c ->
step_lemma (`distl);
step_lemma (`cong_plus);
let l = canon_point (Mult a c) in
let r = canon_point (Mult b c) in
canon_point (Plus l r)
// Associate to the left
| Mult a (Mult b c) ->
step_lemma (`ass_mult_l);
step_lemma (`cong_mult);
let l = canon_point (Mult a b) in
let r = canon_point c in
canon_point (Mult l r)
| Plus a (Plus b c) ->
step_lemma (`ass_plus_l);
step_lemma (`cong_plus);
let l = canon_point (Plus a b) in
let r = canon_point c in
canon_point (Plus l r)
| Plus (Plus a b) c ->
if O.gt (compare_expr b c)
then begin
step_lemma (`sw_plus);
apply_lemma (`cong_plus);
let l = canon_point (Plus a c) in
trefl() ;
Plus l b
end
else skip ()
| Mult (Mult a b) c ->
if O.gt (compare_expr b c)
then begin
step_lemma (`sw_mult);
apply_lemma (`cong_mult);
let l = canon_point (Mult a c) in
trefl ();
Mult l b
end
else skip ()
| Plus a (Lit 0) ->
apply_lemma (`x_plus_zero);
a
| Plus (Lit 0) b ->
apply_lemma (`zero_plus_x);
b
| Plus a b ->
if O.gt (compare_expr a b)
then (apply_lemma (`comm_plus); Plus b a)
else skip ()
| Mult (Lit 0) _ ->
apply_lemma (`zero_mult_x);
Lit 0
| Mult _ (Lit 0) ->
apply_lemma (`x_mult_zero);
Lit 0
| Mult (Lit 1) r ->
apply_lemma (`one_mult_x);
r
| Mult l (Lit 1) ->
apply_lemma (`x_mult_one);
l
| Mult a b ->
if O.gt (compare_expr a b)
then (apply_lemma (`comm_mult); Mult b a)
else skip ()
// Forget about subtraction
| Minus a b ->
step_lemma (`minus_is_plus);
step_lemma (`cong_plus);
trefl ();
let r = canon_point (Neg b) in
canon_point (Plus a r)
| _ ->
skip ()
// On canon_point_entry, we interpret the LHS of the goal as an
// arithmetic expression, of which we keep track in canon_point so we
// avoid reinterpreting the goal, which gives a good speedup.
//
// However, we are repeating work between canon_point_entry calls, since
// in (L + R), we are called once for L, once for R, and once for the
// sum which traverses both (their canonized forms, actually).
//
// The proper way to solve this is have some state-passing in pointwise,
// maybe having the inner tactic be of type (list a -> tactic a), where
// the list is the collected results for all child calls. | false | false | FStar.Tactics.Canon.fst | {
"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"
} | null | val canon_point_entry: Prims.unit -> Tac unit | [] | FStar.Tactics.Canon.canon_point_entry | {
"file_name": "ulib/FStar.Tactics.Canon.fst",
"git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | {
"end_col": 48,
"end_line": 273,
"start_col": 4,
"start_line": 264
} |
Prims.Tot | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"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": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"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
}
] | false | let chacha20_decrypt_st (w:lanes) =
len:size_t
-> out:lbuffer uint8 len
-> cipher:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t{v ctr + w <= max_size_t } ->
Stack unit
(requires fun h ->
live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Chacha20.chacha20_decrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher)) | let chacha20_decrypt_st (w: lanes) = | false | null | false |
len: size_t ->
out: lbuffer uint8 len ->
cipher: lbuffer uint8 len ->
key: lbuffer uint8 32ul ->
n: lbuffer uint8 12ul ->
ctr: size_t{v ctr + w <= max_size_t}
-> Stack unit
(requires
fun h -> live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out)
(ensures
fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out ==
Spec.Chacha20.chacha20_decrypt_bytes (as_seq h0 key)
(as_seq h0 n)
(v ctr)
(as_seq h0 cipher)) | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [
"total"
] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Lib.IntTypes.size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Lib.Buffer.eq_or_disjoint",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Prims.eq2",
"Lib.Sequence.seq",
"Prims.l_or",
"Prims.nat",
"FStar.Seq.Base.length",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.as_seq",
"Spec.Chacha20.chacha20_decrypt_bytes"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame()
noextract
val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_last #w ctx len out incr text =
push_frame();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame()
noextract
val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_update #w ctx len out text =
assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get() in
map_blocks h0 len (size w *! 64ul) text out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i -> chacha20_encrypt_block ctx (sub out (i *! (size w *! 64ul)) (size w *! 64ul)) i (sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i -> chacha20_encrypt_last ctx rem (sub out (i *! (size w *! 64ul)) rem) i (sub text (i *! (size w *! 64ul)) rem))
noextract
val chacha20_encrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_vec #w len out text key n ctr =
push_frame();
let ctx = create_state w in
chacha20_init #w ctx key n ctr;
chacha20_update #w ctx len out text;
pop_frame()
inline_for_extraction noextract
let chacha20_encrypt_st (w:lanes) =
len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t{v ctr + w <= max_size_t } ->
Stack unit
(requires fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text))
noextract
val chacha20_encrypt: #w:lanes -> chacha20_encrypt_st w
[@ Meta.Attribute.specialize ]
let chacha20_encrypt #w len out text key n ctr =
let h0 = ST.get () in
chacha20_encrypt_vec #w len out text key n ctr;
Chacha20Equiv.lemma_chacha20_vec_equiv #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)
noextract
val chacha20_decrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> cipher:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_decrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher)))
[@ Meta.Attribute.inline_ ]
let chacha20_decrypt_vec #w len out cipher key n ctr =
push_frame();
let ctx = create_state w in
chacha20_init ctx key n ctr;
chacha20_update ctx len out cipher;
pop_frame()
inline_for_extraction noextract | false | true | Hacl.Impl.Chacha20.Vec.fst | {
"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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_decrypt_st : w: Hacl.Impl.Chacha20.Core32xN.lanes -> Type0 | [] | Hacl.Impl.Chacha20.Vec.chacha20_decrypt_st | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | w: Hacl.Impl.Chacha20.Core32xN.lanes -> Type0 | {
"end_col": 117,
"end_line": 278,
"start_col": 4,
"start_line": 267
} |
|
Prims.Tot | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"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": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"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
}
] | false | let chacha20_encrypt_st (w:lanes) =
len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t{v ctr + w <= max_size_t } ->
Stack unit
(requires fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)) | let chacha20_encrypt_st (w: lanes) = | false | null | false |
len: size_t ->
out: lbuffer uint8 len ->
text: lbuffer uint8 len ->
key: lbuffer uint8 32ul ->
n: lbuffer uint8 12ul ->
ctr: size_t{v ctr + w <= max_size_t}
-> Stack unit
(requires
fun h -> live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out)
(ensures
fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out ==
Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key)
(as_seq h0 n)
(v ctr)
(as_seq h0 text)) | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [
"total"
] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Lib.IntTypes.size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Lib.Buffer.eq_or_disjoint",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Prims.eq2",
"Lib.Sequence.seq",
"Prims.l_or",
"Prims.nat",
"FStar.Seq.Base.length",
"Lib.Sequence.length",
"Lib.IntTypes.uint_t",
"Lib.IntTypes.U8",
"Lib.IntTypes.SEC",
"Lib.Buffer.as_seq",
"Spec.Chacha20.chacha20_encrypt_bytes"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame()
noextract
val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_last #w ctx len out incr text =
push_frame();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame()
noextract
val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_update #w ctx len out text =
assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get() in
map_blocks h0 len (size w *! 64ul) text out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i -> chacha20_encrypt_block ctx (sub out (i *! (size w *! 64ul)) (size w *! 64ul)) i (sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i -> chacha20_encrypt_last ctx rem (sub out (i *! (size w *! 64ul)) rem) i (sub text (i *! (size w *! 64ul)) rem))
noextract
val chacha20_encrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_vec #w len out text key n ctr =
push_frame();
let ctx = create_state w in
chacha20_init #w ctx key n ctr;
chacha20_update #w ctx len out text;
pop_frame()
inline_for_extraction noextract | false | true | Hacl.Impl.Chacha20.Vec.fst | {
"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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_encrypt_st : w: Hacl.Impl.Chacha20.Core32xN.lanes -> Type0 | [] | Hacl.Impl.Chacha20.Vec.chacha20_encrypt_st | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | w: Hacl.Impl.Chacha20.Core32xN.lanes -> Type0 | {
"end_col": 115,
"end_line": 233,
"start_col": 4,
"start_line": 222
} |
|
Prims.Tot | val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants} | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"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": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"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
}
] | false | let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l | val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants = | false | null | false | [@@ inline_let ]let l = [Spec.c0; Spec.c1; Spec.c2; Spec.c3] in
assert_norm (List.Tot.length l == 4);
createL_global l | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [
"total"
] | [
"Lib.Buffer.createL_global",
"Lib.IntTypes.size_t",
"Lib.Buffer.glbuffer",
"Lib.IntTypes.size",
"FStar.Pervasives.normalize_term",
"Lib.IntTypes.size_nat",
"FStar.List.Tot.Base.length",
"Prims.unit",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.int",
"FStar.UInt32.__uint_to_t",
"Prims.l_and",
"Lib.Buffer.recallable",
"Lib.Buffer.CONST",
"Lib.Buffer.witnessed",
"Spec.Chacha20.chacha20_constants",
"Prims.list",
"Lib.IntTypes.int_t",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims.Cons",
"Hacl.Spec.Chacha20.Vec.c0",
"Hacl.Spec.Chacha20.Vec.c1",
"Hacl.Spec.Chacha20.Vec.c2",
"Hacl.Spec.Chacha20.Vec.c3",
"Prims.Nil"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants} | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants} | [] | Hacl.Impl.Chacha20.Vec.chacha20_constants | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | b:
Lib.Buffer.glbuffer Lib.IntTypes.size_t 4ul
{Lib.Buffer.recallable b /\ Lib.Buffer.witnessed b Spec.Chacha20.chacha20_constants} | {
"end_col": 18,
"end_line": 70,
"start_col": 2,
"start_line": 67
} |
Prims.Tot | val chacha20_decrypt: #w:lanes -> chacha20_decrypt_st w | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"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": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"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
}
] | false | let chacha20_decrypt #w len out cipher key n ctr =
let h0 = ST.get () in
chacha20_decrypt_vec #w len out cipher key n ctr;
Chacha20Equiv.lemma_chacha20_vec_equiv #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher) | val chacha20_decrypt: #w:lanes -> chacha20_decrypt_st w
let chacha20_decrypt #w len out cipher key n ctr = | false | null | false | let h0 = ST.get () in
chacha20_decrypt_vec #w len out cipher key n ctr;
Chacha20Equiv.lemma_chacha20_vec_equiv #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher) | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [
"total"
] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Lib.IntTypes.size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Hacl.Spec.Chacha20.Equiv.lemma_chacha20_vec_equiv",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Prims.unit",
"Hacl.Impl.Chacha20.Vec.chacha20_decrypt_vec",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame()
noextract
val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_last #w ctx len out incr text =
push_frame();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame()
noextract
val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_update #w ctx len out text =
assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get() in
map_blocks h0 len (size w *! 64ul) text out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i -> chacha20_encrypt_block ctx (sub out (i *! (size w *! 64ul)) (size w *! 64ul)) i (sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i -> chacha20_encrypt_last ctx rem (sub out (i *! (size w *! 64ul)) rem) i (sub text (i *! (size w *! 64ul)) rem))
noextract
val chacha20_encrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_vec #w len out text key n ctr =
push_frame();
let ctx = create_state w in
chacha20_init #w ctx key n ctr;
chacha20_update #w ctx len out text;
pop_frame()
inline_for_extraction noextract
let chacha20_encrypt_st (w:lanes) =
len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t{v ctr + w <= max_size_t } ->
Stack unit
(requires fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text))
noextract
val chacha20_encrypt: #w:lanes -> chacha20_encrypt_st w
[@ Meta.Attribute.specialize ]
let chacha20_encrypt #w len out text key n ctr =
let h0 = ST.get () in
chacha20_encrypt_vec #w len out text key n ctr;
Chacha20Equiv.lemma_chacha20_vec_equiv #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)
noextract
val chacha20_decrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> cipher:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_decrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher)))
[@ Meta.Attribute.inline_ ]
let chacha20_decrypt_vec #w len out cipher key n ctr =
push_frame();
let ctx = create_state w in
chacha20_init ctx key n ctr;
chacha20_update ctx len out cipher;
pop_frame()
inline_for_extraction noextract
let chacha20_decrypt_st (w:lanes) =
len:size_t
-> out:lbuffer uint8 len
-> cipher:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t{v ctr + w <= max_size_t } ->
Stack unit
(requires fun h ->
live h key /\ live h n /\ live h cipher /\ live h out /\ eq_or_disjoint cipher out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Chacha20.chacha20_decrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 cipher))
noextract
val chacha20_decrypt: #w:lanes -> chacha20_decrypt_st w | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_decrypt: #w:lanes -> chacha20_decrypt_st w | [] | Hacl.Impl.Chacha20.Vec.chacha20_decrypt | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Chacha20.Vec.chacha20_decrypt_st w | {
"end_col": 100,
"end_line": 286,
"start_col": 50,
"start_line": 283
} |
Prims.Tot | val chacha20_encrypt: #w:lanes -> chacha20_encrypt_st w | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"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": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"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
}
] | false | let chacha20_encrypt #w len out text key n ctr =
let h0 = ST.get () in
chacha20_encrypt_vec #w len out text key n ctr;
Chacha20Equiv.lemma_chacha20_vec_equiv #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text) | val chacha20_encrypt: #w:lanes -> chacha20_encrypt_st w
let chacha20_encrypt #w len out text key n ctr = | false | null | false | let h0 = ST.get () in
chacha20_encrypt_vec #w len out text key n ctr;
Chacha20Equiv.lemma_chacha20_vec_equiv #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text) | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [
"total"
] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Lib.IntTypes.size_t",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"FStar.UInt32.__uint_to_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Hacl.Spec.Chacha20.Equiv.lemma_chacha20_vec_equiv",
"Lib.Buffer.as_seq",
"Lib.Buffer.MUT",
"Prims.unit",
"Hacl.Impl.Chacha20.Vec.chacha20_encrypt_vec",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ]
let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv
val chacha20_constants:
b:glbuffer size_t 4ul{recallable b /\ witnessed b Spec.Chacha20.chacha20_constants}
let chacha20_constants =
[@ inline_let]
let l = [Spec.c0;Spec.c1;Spec.c2;Spec.c3] in
assert_norm(List.Tot.length l == 4);
createL_global l
inline_for_extraction noextract
val setup1:
ctx:lbuffer uint32 16ul
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (u32 0)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.setup1 (as_seq h0 k) (as_seq h0 n) (v ctr0)))
let setup1 ctx k n ctr =
let h0 = ST.get() in
recall_contents chacha20_constants Spec.chacha20_constants;
update_sub_f h0 ctx 0ul 4ul
(fun h -> Lib.Sequence.map secret Spec.chacha20_constants)
(fun _ -> mapT 4ul (sub ctx 0ul 4ul) secret chacha20_constants);
let h1 = ST.get() in
update_sub_f h1 ctx 4ul 8ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h k))
(fun _ -> uints_from_bytes_le (sub ctx 4ul 8ul) k);
let h2 = ST.get() in
ctx.(12ul) <- size_to_uint32 ctr;
let h3 = ST.get() in
update_sub_f h3 ctx 13ul 3ul
(fun h -> Lib.ByteSequence.uints_from_bytes_le (as_seq h n))
(fun _ -> uints_from_bytes_le (sub ctx 13ul 3ul) n)
inline_for_extraction noextract
val chacha20_init:
#w:lanes
-> ctx:state w
-> k:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr0:size_t ->
Stack unit
(requires (fun h ->
live h ctx /\ live h k /\ live h n /\
disjoint ctx k /\ disjoint ctx n /\
as_seq h ctx == Lib.Sequence.create 16 (vec_zero U32 w)))
(ensures (fun h0 _ h1 -> modifies (loc ctx) h0 h1 /\
as_seq h1 ctx == Spec.chacha20_init (as_seq h0 k) (as_seq h0 n) (v ctr0)))
[@ Meta.Attribute.specialize ]
let chacha20_init #w ctx k n ctr =
push_frame();
let ctx1 = create 16ul (u32 0) in
setup1 ctx1 k n ctr;
let h0 = ST.get() in
mapT 16ul ctx (Spec.vec_load_i w) ctx1;
let ctr = vec_counter U32 w in
let c12 = ctx.(12ul) in
ctx.(12ul) <- c12 +| ctr;
pop_frame()
noextract
val chacha20_encrypt_block:
#w:lanes
-> ctx:state w
-> out:lbuffer uint8 (size w *! 64ul)
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 (size w *! 64ul) ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_block (as_seq h0 ctx) (v incr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_block #w ctx out incr text =
push_frame();
let k = create 16ul (vec_zero U32 w) in
chacha20_core k ctx incr;
transpose k;
xor_block out k text;
pop_frame()
noextract
val chacha20_encrypt_last:
#w:lanes
-> ctx:state w
-> len:size_t{v len < w * 64}
-> out:lbuffer uint8 len
-> incr:size_t{w * v incr <= max_size_t}
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
disjoint out ctx /\ disjoint text ctx))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_last (as_seq h0 ctx) (v incr) (v len) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_last #w ctx len out incr text =
push_frame();
let plain = create (size w *! size 64) (u8 0) in
update_sub plain 0ul len text;
chacha20_encrypt_block ctx plain incr plain;
copy out (sub plain 0ul len);
pop_frame()
noextract
val chacha20_update:
#w:lanes
-> ctx:state w
-> len:size_t{v len / (w * 64) <= max_size_t}
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h ctx /\ live h text /\ live h out /\
eq_or_disjoint text out /\ disjoint text ctx /\ disjoint out ctx))
(ensures (fun h0 _ h1 -> modifies (loc ctx |+| loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_update (as_seq h0 ctx) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_update #w ctx len out text =
assert_norm (range (v len / v (size w *! 64ul)) U32);
let blocks = len /. (size w *! 64ul) in
let rem = len %. (size w *! 64ul) in
let h0 = ST.get() in
map_blocks h0 len (size w *! 64ul) text out
(fun h -> Spec.chacha20_encrypt_block (as_seq h0 ctx))
(fun h -> Spec.chacha20_encrypt_last (as_seq h0 ctx))
(fun i -> chacha20_encrypt_block ctx (sub out (i *! (size w *! 64ul)) (size w *! 64ul)) i (sub text (i *! (size w *! 64ul)) (size w *! 64ul)))
(fun i -> chacha20_encrypt_last ctx rem (sub out (i *! (size w *! 64ul)) rem) i (sub text (i *! (size w *! 64ul)) rem))
noextract
val chacha20_encrypt_vec:
#w:lanes
-> len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t ->
Stack unit
(requires (fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out))
(ensures (fun h0 _ h1 -> modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.chacha20_encrypt_bytes #w (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text)))
[@ Meta.Attribute.inline_ ]
let chacha20_encrypt_vec #w len out text key n ctr =
push_frame();
let ctx = create_state w in
chacha20_init #w ctx key n ctr;
chacha20_update #w ctx len out text;
pop_frame()
inline_for_extraction noextract
let chacha20_encrypt_st (w:lanes) =
len:size_t
-> out:lbuffer uint8 len
-> text:lbuffer uint8 len
-> key:lbuffer uint8 32ul
-> n:lbuffer uint8 12ul
-> ctr:size_t{v ctr + w <= max_size_t } ->
Stack unit
(requires fun h ->
live h key /\ live h n /\ live h text /\ live h out /\ eq_or_disjoint text out)
(ensures fun h0 _ h1 ->
modifies (loc out) h0 h1 /\
as_seq h1 out == Spec.Chacha20.chacha20_encrypt_bytes (as_seq h0 key) (as_seq h0 n) (v ctr) (as_seq h0 text))
noextract
val chacha20_encrypt: #w:lanes -> chacha20_encrypt_st w | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_encrypt: #w:lanes -> chacha20_encrypt_st w | [] | Hacl.Impl.Chacha20.Vec.chacha20_encrypt | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} | Hacl.Impl.Chacha20.Vec.chacha20_encrypt_st w | {
"end_col": 98,
"end_line": 241,
"start_col": 48,
"start_line": 238
} |
FStar.HyperStack.ST.Stack | val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0))) | [
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loop"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Equiv",
"short_module": "Chacha20Equiv"
},
{
"abbrev": true,
"full_module": "Hacl.Spec.Chacha20.Vec",
"short_module": "Spec"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20.Core32xN",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"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": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Chacha20",
"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
}
] | false | let chacha20_core #w k ctx ctr =
copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv | val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
let chacha20_core #w k ctx ctr = | true | null | false | copy_state k ctx;
let ctr_u32 = u32 w *! size_to_uint32 ctr in
let cv = vec_load ctr_u32 w in
k.(12ul) <- k.(12ul) +| cv;
rounds k;
sum_state k ctx;
k.(12ul) <- k.(12ul) +| cv | {
"checked_file": "Hacl.Impl.Chacha20.Vec.fst.checked",
"dependencies": [
"Spec.Chacha20.fst.checked",
"prims.fst.checked",
"Meta.Attribute.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntVector.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Spec.Chacha20.Vec.fst.checked",
"Hacl.Spec.Chacha20.Equiv.fst.checked",
"Hacl.Impl.Chacha20.Core32xN.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.All.fst.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Chacha20.Vec.fst"
} | [] | [
"Hacl.Impl.Chacha20.Core32xN.lanes",
"Hacl.Impl.Chacha20.Core32xN.state",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Mul.op_Star",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.IntTypes.max_size_t",
"Lib.Buffer.op_Array_Assignment",
"Hacl.Impl.Chacha20.Core32xN.uint32xN",
"FStar.UInt32.__uint_to_t",
"Prims.unit",
"Lib.IntVector.op_Plus_Bar",
"Lib.IntVector.vec_t",
"Lib.Buffer.op_Array_Access",
"Lib.Buffer.MUT",
"Hacl.Impl.Chacha20.Core32xN.sum_state",
"Hacl.Impl.Chacha20.Vec.rounds",
"Prims.eq2",
"Lib.Sequence.lseq",
"Lib.IntTypes.int_t",
"Lib.IntTypes.SEC",
"Lib.IntVector.vec_v",
"Lib.Sequence.create",
"Lib.IntVector.vec_load",
"Lib.IntTypes.op_Star_Bang",
"Lib.IntTypes.u32",
"Lib.IntTypes.size_to_uint32",
"Hacl.Impl.Chacha20.Core32xN.copy_state"
] | [] | module Hacl.Impl.Chacha20.Vec
module ST = FStar.HyperStack.ST
open FStar.HyperStack
open FStar.HyperStack.All
open FStar.Mul
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.IntVector
open Hacl.Impl.Chacha20.Core32xN
module Spec = Hacl.Spec.Chacha20.Vec
module Chacha20Equiv = Hacl.Spec.Chacha20.Equiv
module Loop = Lib.LoopCombinators
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 200 --record_options"
//#set-options "--debug Hacl.Impl.Chacha20.Vec --debug_level ExtractNorm"
noextract
val rounds:
#w:lanes
-> st:state w ->
Stack unit
(requires (fun h -> live h st))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
as_seq h1 st == Spec.rounds (as_seq h0 st)))
[@ Meta.Attribute.inline_ ]
let rounds #w st =
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st;
double_round st
noextract
val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0)))
[@ Meta.Attribute.specialize ] | false | false | Hacl.Impl.Chacha20.Vec.fst | {
"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": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 200,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | null | val chacha20_core:
#w:lanes
-> k:state w
-> ctx0:state w
-> ctr:size_t{w * v ctr <= max_size_t} ->
Stack unit
(requires (fun h -> live h ctx0 /\ live h k /\ disjoint ctx0 k))
(ensures (fun h0 _ h1 -> modifies (loc k) h0 h1 /\
as_seq h1 k == Spec.chacha20_core (v ctr) (as_seq h0 ctx0))) | [] | Hacl.Impl.Chacha20.Vec.chacha20_core | {
"file_name": "code/chacha20/Hacl.Impl.Chacha20.Vec.fst",
"git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e",
"git_url": "https://github.com/hacl-star/hacl-star.git",
"project_name": "hacl-star"
} |
k: Hacl.Impl.Chacha20.Core32xN.state w ->
ctx0: Hacl.Impl.Chacha20.Core32xN.state w ->
ctr: Lib.IntTypes.size_t{w * Lib.IntTypes.v ctr <= Lib.IntTypes.max_size_t}
-> FStar.HyperStack.ST.Stack Prims.unit | {
"end_col": 28,
"end_line": 61,
"start_col": 2,
"start_line": 55
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.