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": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 elim_exists_post (u:universe) (a:term) (p:term) (x:var) = let erased_a = mk_erased u a in mk_abs erased_a Q_Explicit (elim_exists_post_body u a p x)
let elim_exists_post (u: universe) (a p: term) (x: var) =
false
null
false
let erased_a = mk_erased u a in mk_abs erased_a Q_Explicit (elim_exists_post_body u a p x)
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.var", "Pulse.Reflection.Util.mk_abs", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Steel.Wrapper.Typing.elim_exists_post_body", "Pulse.Reflection.Util.mk_erased" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p)) let return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_ghost_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return u a e p) (return_stt_ghost_comp u a e p x)) let return_stt_ghost_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_ghost_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return_noeq u a x p) (return_stt_ghost_noeq_comp u a x p)) (* g |- inv : bool -> vprop g |- cond : stt<0> bool (exists_ inv) inv g |- body : stt<0> unit (inv true) (fun _ -> exists_ inv) ------------------------------------------------------------------------- g |- while inv cond body : stt<0> unit (exists_ inv) (fun _ -> inv false) *) val while_typing (#g:env) (#inv:term) (#cond:term) (#body:term) (inv_typing:RT.tot_typing g inv (mk_arrow (bool_tm, Q_Explicit) vprop_tm)) (cond_typing:RT.tot_typing g cond (mk_stt_comp uzero bool_tm (mk_exists uzero bool_tm inv) inv)) (body_typing:RT.tot_typing g body (mk_stt_comp uzero unit_tm (pack_ln (Tv_App inv (true_tm, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists uzero bool_tm inv)))) : RT.tot_typing g (mk_while inv cond body) (mk_stt_comp uzero unit_tm (mk_exists uzero bool_tm inv) (mk_abs unit_tm Q_Explicit (pack_ln (Tv_App inv (false_tm, Q_Explicit))))) let par_post (u:universe) (aL aR:term) (postL postR:term) (x:var) : term = let x_tm = RT.var_as_term x in let postL = pack_ln (Tv_App postL (mk_fst u u aL aR x_tm, Q_Explicit)) in let postR = pack_ln (Tv_App postR (mk_snd u u aL aR x_tm, Q_Explicit)) in let post = mk_star postL postR in RT.subst_term post [ RT.ND x 0 ] val par_typing (#g:env) (#u:universe) (#aL #aR:term) (#preL #postL:term) (#preR #postR:term) (#eL #eR:term) (x:var{None? (RT.lookup_bvar g x)}) (aL_typing:RT.tot_typing g aL (pack_ln (Tv_Type u))) (aR_typing:RT.tot_typing g aR (pack_ln (Tv_Type u))) (preL_typing:RT.tot_typing g preL vprop_tm) (postL_typing:RT.tot_typing g postL (mk_arrow (aL, Q_Explicit) vprop_tm)) (preR_typing:RT.tot_typing g preR vprop_tm) (postR_typing:RT.tot_typing g postR (mk_arrow (aR, Q_Explicit) vprop_tm)) (eL_typing:RT.tot_typing g eL (mk_stt_comp u aL preL postL)) (eR_typing:RT.tot_typing g eR (mk_stt_comp u aR preR postR)) : GTot (RT.tot_typing g (mk_par u aL aR preL postL preR postR eL eR) (mk_stt_comp u (mk_tuple2 u u aL aR) (mk_star preL preR) (mk_abs (mk_tuple2 u u aL aR) Q_Explicit (par_post u aL aR postL postR x)))) val exists_inversion (#g:env) (#u:universe) (#a:term) (#p:term) (e_typing:RT.tot_typing g (mk_exists u a p) vprop_tm) : GTot (RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (* g |- a : Type u g |- p : a -> vprop ---------------------------------------------------------------- g |- elim_exists<u> #a p : stt_ghost<u> a empty (exists_<u> p) (fun x -> p (reveal x)) *) let elim_exists_post_body (u:universe) (a:term) (p:term) (x:var) = let x_tm = RT.var_as_term x in let reveal_x = mk_reveal u a x_tm in let post = pack_ln (Tv_App p (reveal_x, Q_Explicit)) in RT.subst_term post [ RT.ND x 0 ]
false
true
Pulse.Steel.Wrapper.Typing.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 elim_exists_post : u46: FStar.Reflection.Types.universe -> a: FStar.Reflection.Types.term -> p: FStar.Reflection.Types.term -> x: FStar.Reflection.V2.Data.var -> FStar.Reflection.Types.term
[]
Pulse.Steel.Wrapper.Typing.elim_exists_post
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u46: FStar.Reflection.Types.universe -> a: FStar.Reflection.Types.term -> p: FStar.Reflection.Types.term -> x: FStar.Reflection.V2.Data.var -> FStar.Reflection.Types.term
{ "end_col": 60, "end_line": 217, "start_col": 61, "start_line": 215 }
Prims.Tot
val return_stt_ghost_noeq_comp (u: universe) (a x p: term) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 return_stt_ghost_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p
val return_stt_ghost_noeq_comp (u: universe) (a x p: term) : term let return_stt_ghost_noeq_comp (u: universe) (a x p: term) : term =
false
null
false
mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_stt_ghost_comp", "Pulse.Reflection.Util.emp_inames_tm", "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" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p)) let return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_ghost_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return u a e p) (return_stt_ghost_comp u a e p x))
false
true
Pulse.Steel.Wrapper.Typing.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 return_stt_ghost_noeq_comp (u: universe) (a x p: term) : term
[]
Pulse.Steel.Wrapper.Typing.return_stt_ghost_noeq_comp
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u32: FStar.Reflection.Types.universe -> a: FStar.Reflection.Types.term -> x: FStar.Reflection.Types.term -> p: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 76, "end_line": 110, "start_col": 2, "start_line": 110 }
Prims.Tot
val return_stt_noeq_comp (u: universe) (a x p: term) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p
val return_stt_noeq_comp (u: universe) (a x p: term) : term let return_stt_noeq_comp (u: universe) (a x p: term) : term =
false
null
false
mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_stt_comp", "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" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x))
false
true
Pulse.Steel.Wrapper.Typing.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 return_stt_noeq_comp (u: universe) (a x p: term) : term
[]
Pulse.Steel.Wrapper.Typing.return_stt_noeq_comp
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u14: FStar.Reflection.Types.universe -> a: FStar.Reflection.Types.term -> x: FStar.Reflection.Types.term -> p: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 56, "end_line": 36, "start_col": 2, "start_line": 36 }
Prims.Tot
val with_localarray_body_post (post a ret_t arr: term) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 with_localarray_body_post (post:term) (a:term) (ret_t:term) (arr:term) : term = mk_abs ret_t Q_Explicit (with_localarray_body_post_body post a arr)
val with_localarray_body_post (post a ret_t arr: term) : term let with_localarray_body_post (post a ret_t arr: term) : term =
false
null
false
mk_abs ret_t Q_Explicit (with_localarray_body_post_body post a arr)
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_abs", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Steel.Wrapper.Typing.with_localarray_body_post_body" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p)) let return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_ghost_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return u a e p) (return_stt_ghost_comp u a e p x)) let return_stt_ghost_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_ghost_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return_noeq u a x p) (return_stt_ghost_noeq_comp u a x p)) (* g |- inv : bool -> vprop g |- cond : stt<0> bool (exists_ inv) inv g |- body : stt<0> unit (inv true) (fun _ -> exists_ inv) ------------------------------------------------------------------------- g |- while inv cond body : stt<0> unit (exists_ inv) (fun _ -> inv false) *) val while_typing (#g:env) (#inv:term) (#cond:term) (#body:term) (inv_typing:RT.tot_typing g inv (mk_arrow (bool_tm, Q_Explicit) vprop_tm)) (cond_typing:RT.tot_typing g cond (mk_stt_comp uzero bool_tm (mk_exists uzero bool_tm inv) inv)) (body_typing:RT.tot_typing g body (mk_stt_comp uzero unit_tm (pack_ln (Tv_App inv (true_tm, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists uzero bool_tm inv)))) : RT.tot_typing g (mk_while inv cond body) (mk_stt_comp uzero unit_tm (mk_exists uzero bool_tm inv) (mk_abs unit_tm Q_Explicit (pack_ln (Tv_App inv (false_tm, Q_Explicit))))) let par_post (u:universe) (aL aR:term) (postL postR:term) (x:var) : term = let x_tm = RT.var_as_term x in let postL = pack_ln (Tv_App postL (mk_fst u u aL aR x_tm, Q_Explicit)) in let postR = pack_ln (Tv_App postR (mk_snd u u aL aR x_tm, Q_Explicit)) in let post = mk_star postL postR in RT.subst_term post [ RT.ND x 0 ] val par_typing (#g:env) (#u:universe) (#aL #aR:term) (#preL #postL:term) (#preR #postR:term) (#eL #eR:term) (x:var{None? (RT.lookup_bvar g x)}) (aL_typing:RT.tot_typing g aL (pack_ln (Tv_Type u))) (aR_typing:RT.tot_typing g aR (pack_ln (Tv_Type u))) (preL_typing:RT.tot_typing g preL vprop_tm) (postL_typing:RT.tot_typing g postL (mk_arrow (aL, Q_Explicit) vprop_tm)) (preR_typing:RT.tot_typing g preR vprop_tm) (postR_typing:RT.tot_typing g postR (mk_arrow (aR, Q_Explicit) vprop_tm)) (eL_typing:RT.tot_typing g eL (mk_stt_comp u aL preL postL)) (eR_typing:RT.tot_typing g eR (mk_stt_comp u aR preR postR)) : GTot (RT.tot_typing g (mk_par u aL aR preL postL preR postR eL eR) (mk_stt_comp u (mk_tuple2 u u aL aR) (mk_star preL preR) (mk_abs (mk_tuple2 u u aL aR) Q_Explicit (par_post u aL aR postL postR x)))) val exists_inversion (#g:env) (#u:universe) (#a:term) (#p:term) (e_typing:RT.tot_typing g (mk_exists u a p) vprop_tm) : GTot (RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (* g |- a : Type u g |- p : a -> vprop ---------------------------------------------------------------- g |- elim_exists<u> #a p : stt_ghost<u> a empty (exists_<u> p) (fun x -> p (reveal x)) *) let elim_exists_post_body (u:universe) (a:term) (p:term) (x:var) = let x_tm = RT.var_as_term x in let reveal_x = mk_reveal u a x_tm in let post = pack_ln (Tv_App p (reveal_x, Q_Explicit)) in RT.subst_term post [ RT.ND x 0 ] let elim_exists_post (u:universe) (a:term) (p:term) (x:var) = let erased_a = mk_erased u a in mk_abs erased_a Q_Explicit (elim_exists_post_body u a p x) val elim_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_elim_exists u a p) (mk_stt_ghost_comp u (mk_erased u a) emp_inames_tm (mk_exists u a p) (elim_exists_post u a p x))) (* g |- a : Type u g |- p : a -> vprop g |- e : vprop ------------------------------------------------------------------------- g |- intro_exists<u> #a p e : stt_ghost<0> unit empty (p e) (fun _ -> exists_ p) *) val intro_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#e:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (e_typing:RT.ghost_typing g e a) : GTot (RT.tot_typing g (mk_intro_exists u a p e) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists u a p)))) (* g |- a : Type u g |- p : vprop g |- q : a -> vprop ------------------------------------------ g |- stt_admit a p q : stt a p q *) val stt_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_admit u a p q) (mk_stt_comp u a p q)) val stt_atomic_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_admit u a p q) (mk_stt_atomic_comp u a emp_inames_tm p q)) val stt_ghost_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_admit u a p q) (mk_stt_ghost_comp u a emp_inames_tm p q)) val rewrite_typing (#g:env) (#p:term) (#q:term) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q vprop_tm) (equiv:RT.tot_typing g (`()) (stt_vprop_equiv p q)) : GTot (RT.tot_typing g (mk_rewrite p q) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm p (mk_abs unit_tm Q_Explicit q))) // mk_star pre (mk_pts_to a (RT.bound_var 0) full_perm_tm init let with_local_body_pre (pre:term) (a:term) (x:term) (init:term) : term = let pts_to : term = mk_pts_to a x full_perm_tm init in mk_star pre pts_to // // post has 0 db index free // let with_local_body_post_body (post:term) (a:term) (x:term) : term = // exists_ (R.pts_to r full_perm) let exists_tm = mk_exists (pack_universe Uv_Zero) a (mk_abs a Q_Explicit (mk_pts_to a x full_perm_tm (RT.bound_var 0))) in mk_star post exists_tm let with_local_body_post (post:term) (a:term) (ret_t:term) (x:term) : term = mk_abs ret_t Q_Explicit (with_local_body_post_body post a x) val with_local_typing (#g:env) (#u:universe) (#a:term) (#init:term) (#pre:term) (#ret_t:term) (#post:term) // post has db 0 free (#body:term) // body has x free (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type (pack_universe Uv_Zero)))) (init_typing:RT.tot_typing g init a) (pre_typing:RT.tot_typing g pre vprop_tm) (ret_t_typing:RT.tot_typing g ret_t (pack_ln (Tv_Type u))) (post_typing:RT.tot_typing g (RT.mk_abs ret_t Q_Explicit post) (mk_arrow (ret_t, Q_Explicit) vprop_tm)) (body_typing:RT.tot_typing (RT.extend_env g x (mk_ref a)) body (mk_stt_comp u ret_t (with_local_body_pre pre a (RT.var_as_term x) init) (with_local_body_post post a ret_t (RT.var_as_term x)))) : GTot (RT.tot_typing g (mk_withlocal u a init pre ret_t (RT.mk_abs ret_t Q_Explicit post) (RT.mk_abs (mk_ref a) Q_Explicit (RT.close_term body x))) (mk_stt_comp u ret_t pre (mk_abs ret_t Q_Explicit post))) let with_localarray_body_pre (pre:term) (a:term) (arr:term) (init:term) (len:term) : term = let pts_to : term = mk_array_pts_to a arr full_perm_tm (mk_seq_create uzero a (mk_szv len) init) in let is_full : term = mk_pure (mk_array_is_full a arr) in let len_vp : term = mk_pure (mk_eq2 uzero nat_tm (mk_array_length a arr) (mk_szv len)) in mk_star pre (mk_star pts_to (mk_star is_full len_vp)) // // post has 0 db index free // let with_localarray_body_post_body (post:term) (a:term) (arr:term) : term = // exists_ (A.pts_to arr full_perm) let exists_tm = mk_exists uzero (mk_seq uzero a) (mk_abs (mk_seq uzero a) Q_Explicit (mk_array_pts_to a arr full_perm_tm (RT.bound_var 0))) in mk_star post exists_tm
false
true
Pulse.Steel.Wrapper.Typing.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 with_localarray_body_post (post a ret_t arr: term) : term
[]
Pulse.Steel.Wrapper.Typing.with_localarray_body_post
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
post: FStar.Reflection.Types.term -> a: FStar.Reflection.Types.term -> ret_t: FStar.Reflection.Types.term -> arr: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 69, "end_line": 395, "start_col": 2, "start_line": 395 }
Prims.Tot
val with_localarray_body_pre (pre a arr init len: term) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 with_localarray_body_pre (pre:term) (a:term) (arr:term) (init:term) (len:term) : term = let pts_to : term = mk_array_pts_to a arr full_perm_tm (mk_seq_create uzero a (mk_szv len) init) in let is_full : term = mk_pure (mk_array_is_full a arr) in let len_vp : term = mk_pure (mk_eq2 uzero nat_tm (mk_array_length a arr) (mk_szv len)) in mk_star pre (mk_star pts_to (mk_star is_full len_vp))
val with_localarray_body_pre (pre a arr init len: term) : term let with_localarray_body_pre (pre a arr init len: term) : term =
false
null
false
let pts_to:term = mk_array_pts_to a arr full_perm_tm (mk_seq_create uzero a (mk_szv len) init) in let is_full:term = mk_pure (mk_array_is_full a arr) in let len_vp:term = mk_pure (mk_eq2 uzero nat_tm (mk_array_length a arr) (mk_szv len)) in mk_star pre (mk_star pts_to (mk_star is_full len_vp))
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_star", "Pulse.Reflection.Util.mk_pure", "Pulse.Reflection.Util.mk_eq2", "Pulse.Reflection.Util.uzero", "Pulse.Reflection.Util.nat_tm", "Pulse.Reflection.Util.mk_array_length", "Pulse.Reflection.Util.mk_szv", "Pulse.Reflection.Util.mk_array_is_full", "Pulse.Reflection.Util.mk_array_pts_to", "Pulse.Reflection.Util.full_perm_tm", "Pulse.Reflection.Util.mk_seq_create" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p)) let return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_ghost_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return u a e p) (return_stt_ghost_comp u a e p x)) let return_stt_ghost_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_ghost_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return_noeq u a x p) (return_stt_ghost_noeq_comp u a x p)) (* g |- inv : bool -> vprop g |- cond : stt<0> bool (exists_ inv) inv g |- body : stt<0> unit (inv true) (fun _ -> exists_ inv) ------------------------------------------------------------------------- g |- while inv cond body : stt<0> unit (exists_ inv) (fun _ -> inv false) *) val while_typing (#g:env) (#inv:term) (#cond:term) (#body:term) (inv_typing:RT.tot_typing g inv (mk_arrow (bool_tm, Q_Explicit) vprop_tm)) (cond_typing:RT.tot_typing g cond (mk_stt_comp uzero bool_tm (mk_exists uzero bool_tm inv) inv)) (body_typing:RT.tot_typing g body (mk_stt_comp uzero unit_tm (pack_ln (Tv_App inv (true_tm, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists uzero bool_tm inv)))) : RT.tot_typing g (mk_while inv cond body) (mk_stt_comp uzero unit_tm (mk_exists uzero bool_tm inv) (mk_abs unit_tm Q_Explicit (pack_ln (Tv_App inv (false_tm, Q_Explicit))))) let par_post (u:universe) (aL aR:term) (postL postR:term) (x:var) : term = let x_tm = RT.var_as_term x in let postL = pack_ln (Tv_App postL (mk_fst u u aL aR x_tm, Q_Explicit)) in let postR = pack_ln (Tv_App postR (mk_snd u u aL aR x_tm, Q_Explicit)) in let post = mk_star postL postR in RT.subst_term post [ RT.ND x 0 ] val par_typing (#g:env) (#u:universe) (#aL #aR:term) (#preL #postL:term) (#preR #postR:term) (#eL #eR:term) (x:var{None? (RT.lookup_bvar g x)}) (aL_typing:RT.tot_typing g aL (pack_ln (Tv_Type u))) (aR_typing:RT.tot_typing g aR (pack_ln (Tv_Type u))) (preL_typing:RT.tot_typing g preL vprop_tm) (postL_typing:RT.tot_typing g postL (mk_arrow (aL, Q_Explicit) vprop_tm)) (preR_typing:RT.tot_typing g preR vprop_tm) (postR_typing:RT.tot_typing g postR (mk_arrow (aR, Q_Explicit) vprop_tm)) (eL_typing:RT.tot_typing g eL (mk_stt_comp u aL preL postL)) (eR_typing:RT.tot_typing g eR (mk_stt_comp u aR preR postR)) : GTot (RT.tot_typing g (mk_par u aL aR preL postL preR postR eL eR) (mk_stt_comp u (mk_tuple2 u u aL aR) (mk_star preL preR) (mk_abs (mk_tuple2 u u aL aR) Q_Explicit (par_post u aL aR postL postR x)))) val exists_inversion (#g:env) (#u:universe) (#a:term) (#p:term) (e_typing:RT.tot_typing g (mk_exists u a p) vprop_tm) : GTot (RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (* g |- a : Type u g |- p : a -> vprop ---------------------------------------------------------------- g |- elim_exists<u> #a p : stt_ghost<u> a empty (exists_<u> p) (fun x -> p (reveal x)) *) let elim_exists_post_body (u:universe) (a:term) (p:term) (x:var) = let x_tm = RT.var_as_term x in let reveal_x = mk_reveal u a x_tm in let post = pack_ln (Tv_App p (reveal_x, Q_Explicit)) in RT.subst_term post [ RT.ND x 0 ] let elim_exists_post (u:universe) (a:term) (p:term) (x:var) = let erased_a = mk_erased u a in mk_abs erased_a Q_Explicit (elim_exists_post_body u a p x) val elim_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_elim_exists u a p) (mk_stt_ghost_comp u (mk_erased u a) emp_inames_tm (mk_exists u a p) (elim_exists_post u a p x))) (* g |- a : Type u g |- p : a -> vprop g |- e : vprop ------------------------------------------------------------------------- g |- intro_exists<u> #a p e : stt_ghost<0> unit empty (p e) (fun _ -> exists_ p) *) val intro_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#e:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (e_typing:RT.ghost_typing g e a) : GTot (RT.tot_typing g (mk_intro_exists u a p e) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists u a p)))) (* g |- a : Type u g |- p : vprop g |- q : a -> vprop ------------------------------------------ g |- stt_admit a p q : stt a p q *) val stt_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_admit u a p q) (mk_stt_comp u a p q)) val stt_atomic_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_admit u a p q) (mk_stt_atomic_comp u a emp_inames_tm p q)) val stt_ghost_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_admit u a p q) (mk_stt_ghost_comp u a emp_inames_tm p q)) val rewrite_typing (#g:env) (#p:term) (#q:term) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q vprop_tm) (equiv:RT.tot_typing g (`()) (stt_vprop_equiv p q)) : GTot (RT.tot_typing g (mk_rewrite p q) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm p (mk_abs unit_tm Q_Explicit q))) // mk_star pre (mk_pts_to a (RT.bound_var 0) full_perm_tm init let with_local_body_pre (pre:term) (a:term) (x:term) (init:term) : term = let pts_to : term = mk_pts_to a x full_perm_tm init in mk_star pre pts_to // // post has 0 db index free // let with_local_body_post_body (post:term) (a:term) (x:term) : term = // exists_ (R.pts_to r full_perm) let exists_tm = mk_exists (pack_universe Uv_Zero) a (mk_abs a Q_Explicit (mk_pts_to a x full_perm_tm (RT.bound_var 0))) in mk_star post exists_tm let with_local_body_post (post:term) (a:term) (ret_t:term) (x:term) : term = mk_abs ret_t Q_Explicit (with_local_body_post_body post a x) val with_local_typing (#g:env) (#u:universe) (#a:term) (#init:term) (#pre:term) (#ret_t:term) (#post:term) // post has db 0 free (#body:term) // body has x free (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type (pack_universe Uv_Zero)))) (init_typing:RT.tot_typing g init a) (pre_typing:RT.tot_typing g pre vprop_tm) (ret_t_typing:RT.tot_typing g ret_t (pack_ln (Tv_Type u))) (post_typing:RT.tot_typing g (RT.mk_abs ret_t Q_Explicit post) (mk_arrow (ret_t, Q_Explicit) vprop_tm)) (body_typing:RT.tot_typing (RT.extend_env g x (mk_ref a)) body (mk_stt_comp u ret_t (with_local_body_pre pre a (RT.var_as_term x) init) (with_local_body_post post a ret_t (RT.var_as_term x)))) : GTot (RT.tot_typing g (mk_withlocal u a init pre ret_t (RT.mk_abs ret_t Q_Explicit post) (RT.mk_abs (mk_ref a) Q_Explicit (RT.close_term body x))) (mk_stt_comp u ret_t pre (mk_abs ret_t Q_Explicit post)))
false
true
Pulse.Steel.Wrapper.Typing.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 with_localarray_body_pre (pre a arr init len: term) : term
[]
Pulse.Steel.Wrapper.Typing.with_localarray_body_pre
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
pre: FStar.Reflection.Types.term -> a: FStar.Reflection.Types.term -> arr: FStar.Reflection.Types.term -> init: FStar.Reflection.Types.term -> len: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 55, "end_line": 381, "start_col": 91, "start_line": 375 }
Prims.Tot
val with_local_body_post_body (post a x: term) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 with_local_body_post_body (post:term) (a:term) (x:term) : term = // exists_ (R.pts_to r full_perm) let exists_tm = mk_exists (pack_universe Uv_Zero) a (mk_abs a Q_Explicit (mk_pts_to a x full_perm_tm (RT.bound_var 0))) in mk_star post exists_tm
val with_local_body_post_body (post a x: term) : term let with_local_body_post_body (post a x: term) : term =
false
null
false
let exists_tm = mk_exists (pack_universe Uv_Zero) a (mk_abs a Q_Explicit (mk_pts_to a x full_perm_tm (RT.bound_var 0))) in mk_star post exists_tm
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_star", "Pulse.Reflection.Util.mk_exists", "FStar.Reflection.V2.Builtins.pack_universe", "FStar.Reflection.V2.Data.Uv_Zero", "Pulse.Reflection.Util.mk_abs", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Reflection.Util.mk_pts_to", "Pulse.Reflection.Util.full_perm_tm", "FStar.Reflection.Typing.bound_var" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p)) let return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_ghost_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return u a e p) (return_stt_ghost_comp u a e p x)) let return_stt_ghost_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_ghost_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return_noeq u a x p) (return_stt_ghost_noeq_comp u a x p)) (* g |- inv : bool -> vprop g |- cond : stt<0> bool (exists_ inv) inv g |- body : stt<0> unit (inv true) (fun _ -> exists_ inv) ------------------------------------------------------------------------- g |- while inv cond body : stt<0> unit (exists_ inv) (fun _ -> inv false) *) val while_typing (#g:env) (#inv:term) (#cond:term) (#body:term) (inv_typing:RT.tot_typing g inv (mk_arrow (bool_tm, Q_Explicit) vprop_tm)) (cond_typing:RT.tot_typing g cond (mk_stt_comp uzero bool_tm (mk_exists uzero bool_tm inv) inv)) (body_typing:RT.tot_typing g body (mk_stt_comp uzero unit_tm (pack_ln (Tv_App inv (true_tm, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists uzero bool_tm inv)))) : RT.tot_typing g (mk_while inv cond body) (mk_stt_comp uzero unit_tm (mk_exists uzero bool_tm inv) (mk_abs unit_tm Q_Explicit (pack_ln (Tv_App inv (false_tm, Q_Explicit))))) let par_post (u:universe) (aL aR:term) (postL postR:term) (x:var) : term = let x_tm = RT.var_as_term x in let postL = pack_ln (Tv_App postL (mk_fst u u aL aR x_tm, Q_Explicit)) in let postR = pack_ln (Tv_App postR (mk_snd u u aL aR x_tm, Q_Explicit)) in let post = mk_star postL postR in RT.subst_term post [ RT.ND x 0 ] val par_typing (#g:env) (#u:universe) (#aL #aR:term) (#preL #postL:term) (#preR #postR:term) (#eL #eR:term) (x:var{None? (RT.lookup_bvar g x)}) (aL_typing:RT.tot_typing g aL (pack_ln (Tv_Type u))) (aR_typing:RT.tot_typing g aR (pack_ln (Tv_Type u))) (preL_typing:RT.tot_typing g preL vprop_tm) (postL_typing:RT.tot_typing g postL (mk_arrow (aL, Q_Explicit) vprop_tm)) (preR_typing:RT.tot_typing g preR vprop_tm) (postR_typing:RT.tot_typing g postR (mk_arrow (aR, Q_Explicit) vprop_tm)) (eL_typing:RT.tot_typing g eL (mk_stt_comp u aL preL postL)) (eR_typing:RT.tot_typing g eR (mk_stt_comp u aR preR postR)) : GTot (RT.tot_typing g (mk_par u aL aR preL postL preR postR eL eR) (mk_stt_comp u (mk_tuple2 u u aL aR) (mk_star preL preR) (mk_abs (mk_tuple2 u u aL aR) Q_Explicit (par_post u aL aR postL postR x)))) val exists_inversion (#g:env) (#u:universe) (#a:term) (#p:term) (e_typing:RT.tot_typing g (mk_exists u a p) vprop_tm) : GTot (RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (* g |- a : Type u g |- p : a -> vprop ---------------------------------------------------------------- g |- elim_exists<u> #a p : stt_ghost<u> a empty (exists_<u> p) (fun x -> p (reveal x)) *) let elim_exists_post_body (u:universe) (a:term) (p:term) (x:var) = let x_tm = RT.var_as_term x in let reveal_x = mk_reveal u a x_tm in let post = pack_ln (Tv_App p (reveal_x, Q_Explicit)) in RT.subst_term post [ RT.ND x 0 ] let elim_exists_post (u:universe) (a:term) (p:term) (x:var) = let erased_a = mk_erased u a in mk_abs erased_a Q_Explicit (elim_exists_post_body u a p x) val elim_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_elim_exists u a p) (mk_stt_ghost_comp u (mk_erased u a) emp_inames_tm (mk_exists u a p) (elim_exists_post u a p x))) (* g |- a : Type u g |- p : a -> vprop g |- e : vprop ------------------------------------------------------------------------- g |- intro_exists<u> #a p e : stt_ghost<0> unit empty (p e) (fun _ -> exists_ p) *) val intro_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#e:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (e_typing:RT.ghost_typing g e a) : GTot (RT.tot_typing g (mk_intro_exists u a p e) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists u a p)))) (* g |- a : Type u g |- p : vprop g |- q : a -> vprop ------------------------------------------ g |- stt_admit a p q : stt a p q *) val stt_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_admit u a p q) (mk_stt_comp u a p q)) val stt_atomic_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_admit u a p q) (mk_stt_atomic_comp u a emp_inames_tm p q)) val stt_ghost_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_admit u a p q) (mk_stt_ghost_comp u a emp_inames_tm p q)) val rewrite_typing (#g:env) (#p:term) (#q:term) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q vprop_tm) (equiv:RT.tot_typing g (`()) (stt_vprop_equiv p q)) : GTot (RT.tot_typing g (mk_rewrite p q) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm p (mk_abs unit_tm Q_Explicit q))) // mk_star pre (mk_pts_to a (RT.bound_var 0) full_perm_tm init let with_local_body_pre (pre:term) (a:term) (x:term) (init:term) : term = let pts_to : term = mk_pts_to a x full_perm_tm init in mk_star pre pts_to // // post has 0 db index free
false
true
Pulse.Steel.Wrapper.Typing.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 with_local_body_post_body (post a x: term) : term
[]
Pulse.Steel.Wrapper.Typing.with_local_body_post_body
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
post: FStar.Reflection.Types.term -> a: FStar.Reflection.Types.term -> x: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 24, "end_line": 344, "start_col": 68, "start_line": 338 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 elim_exists_post_body (u:universe) (a:term) (p:term) (x:var) = let x_tm = RT.var_as_term x in let reveal_x = mk_reveal u a x_tm in let post = pack_ln (Tv_App p (reveal_x, Q_Explicit)) in RT.subst_term post [ RT.ND x 0 ]
let elim_exists_post_body (u: universe) (a p: term) (x: var) =
false
null
false
let x_tm = RT.var_as_term x in let reveal_x = mk_reveal u a x_tm in let post = pack_ln (Tv_App p (reveal_x, Q_Explicit)) in RT.subst_term post [RT.ND x 0]
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.var", "FStar.Reflection.Typing.subst_term", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "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.mk_reveal", "FStar.Reflection.Typing.var_as_term" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p)) let return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_ghost_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return u a e p) (return_stt_ghost_comp u a e p x)) let return_stt_ghost_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_ghost_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return_noeq u a x p) (return_stt_ghost_noeq_comp u a x p)) (* g |- inv : bool -> vprop g |- cond : stt<0> bool (exists_ inv) inv g |- body : stt<0> unit (inv true) (fun _ -> exists_ inv) ------------------------------------------------------------------------- g |- while inv cond body : stt<0> unit (exists_ inv) (fun _ -> inv false) *) val while_typing (#g:env) (#inv:term) (#cond:term) (#body:term) (inv_typing:RT.tot_typing g inv (mk_arrow (bool_tm, Q_Explicit) vprop_tm)) (cond_typing:RT.tot_typing g cond (mk_stt_comp uzero bool_tm (mk_exists uzero bool_tm inv) inv)) (body_typing:RT.tot_typing g body (mk_stt_comp uzero unit_tm (pack_ln (Tv_App inv (true_tm, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists uzero bool_tm inv)))) : RT.tot_typing g (mk_while inv cond body) (mk_stt_comp uzero unit_tm (mk_exists uzero bool_tm inv) (mk_abs unit_tm Q_Explicit (pack_ln (Tv_App inv (false_tm, Q_Explicit))))) let par_post (u:universe) (aL aR:term) (postL postR:term) (x:var) : term = let x_tm = RT.var_as_term x in let postL = pack_ln (Tv_App postL (mk_fst u u aL aR x_tm, Q_Explicit)) in let postR = pack_ln (Tv_App postR (mk_snd u u aL aR x_tm, Q_Explicit)) in let post = mk_star postL postR in RT.subst_term post [ RT.ND x 0 ] val par_typing (#g:env) (#u:universe) (#aL #aR:term) (#preL #postL:term) (#preR #postR:term) (#eL #eR:term) (x:var{None? (RT.lookup_bvar g x)}) (aL_typing:RT.tot_typing g aL (pack_ln (Tv_Type u))) (aR_typing:RT.tot_typing g aR (pack_ln (Tv_Type u))) (preL_typing:RT.tot_typing g preL vprop_tm) (postL_typing:RT.tot_typing g postL (mk_arrow (aL, Q_Explicit) vprop_tm)) (preR_typing:RT.tot_typing g preR vprop_tm) (postR_typing:RT.tot_typing g postR (mk_arrow (aR, Q_Explicit) vprop_tm)) (eL_typing:RT.tot_typing g eL (mk_stt_comp u aL preL postL)) (eR_typing:RT.tot_typing g eR (mk_stt_comp u aR preR postR)) : GTot (RT.tot_typing g (mk_par u aL aR preL postL preR postR eL eR) (mk_stt_comp u (mk_tuple2 u u aL aR) (mk_star preL preR) (mk_abs (mk_tuple2 u u aL aR) Q_Explicit (par_post u aL aR postL postR x)))) val exists_inversion (#g:env) (#u:universe) (#a:term) (#p:term) (e_typing:RT.tot_typing g (mk_exists u a p) vprop_tm) : GTot (RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (* g |- a : Type u g |- p : a -> vprop ---------------------------------------------------------------- g |- elim_exists<u> #a p : stt_ghost<u> a empty (exists_<u> p) (fun x -> p (reveal x)) *)
false
true
Pulse.Steel.Wrapper.Typing.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 elim_exists_post_body : u42: FStar.Reflection.Types.universe -> a: FStar.Reflection.Types.term -> p: FStar.Reflection.Types.term -> x: FStar.Reflection.V2.Data.var -> FStar.Reflection.Types.term
[]
Pulse.Steel.Wrapper.Typing.elim_exists_post_body
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u42: FStar.Reflection.Types.universe -> a: FStar.Reflection.Types.term -> p: FStar.Reflection.Types.term -> x: FStar.Reflection.V2.Data.var -> FStar.Reflection.Types.term
{ "end_col": 34, "end_line": 213, "start_col": 66, "start_line": 209 }
Prims.Tot
val return_stt_ghost_comp (u: universe) (a e p: term) (x: var) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x)
val return_stt_ghost_comp (u: universe) (a e p: term) (x: var) : term let return_stt_ghost_comp (u: universe) (a e p: term) (x: var) : term =
false
null
false
mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x)
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.var", "Pulse.Reflection.Util.mk_stt_ghost_comp", "Pulse.Reflection.Util.emp_inames_tm", "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.Steel.Wrapper.Typing.return_post_with_eq" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p))
false
true
Pulse.Steel.Wrapper.Typing.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 return_stt_ghost_comp (u: universe) (a e p: term) (x: var) : term
[]
Pulse.Steel.Wrapper.Typing.return_stt_ghost_comp
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u28: FStar.Reflection.Types.universe -> a: FStar.Reflection.Types.term -> e: FStar.Reflection.Types.term -> p: FStar.Reflection.Types.term -> x: FStar.Reflection.V2.Data.var -> FStar.Reflection.Types.term
{ "end_col": 35, "end_line": 92, "start_col": 2, "start_line": 90 }
Prims.Tot
val with_localarray_body_post_body (post a arr: term) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 with_localarray_body_post_body (post:term) (a:term) (arr:term) : term = // exists_ (A.pts_to arr full_perm) let exists_tm = mk_exists uzero (mk_seq uzero a) (mk_abs (mk_seq uzero a) Q_Explicit (mk_array_pts_to a arr full_perm_tm (RT.bound_var 0))) in mk_star post exists_tm
val with_localarray_body_post_body (post a arr: term) : term let with_localarray_body_post_body (post a arr: term) : term =
false
null
false
let exists_tm = mk_exists uzero (mk_seq uzero a) (mk_abs (mk_seq uzero a) Q_Explicit (mk_array_pts_to a arr full_perm_tm (RT.bound_var 0))) in mk_star post exists_tm
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_star", "Pulse.Reflection.Util.mk_exists", "Pulse.Reflection.Util.uzero", "Pulse.Reflection.Util.mk_seq", "Pulse.Reflection.Util.mk_abs", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Reflection.Util.mk_array_pts_to", "Pulse.Reflection.Util.full_perm_tm", "FStar.Reflection.Typing.bound_var" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p)) let return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_ghost_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return u a e p) (return_stt_ghost_comp u a e p x)) let return_stt_ghost_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_ghost_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return_noeq u a x p) (return_stt_ghost_noeq_comp u a x p)) (* g |- inv : bool -> vprop g |- cond : stt<0> bool (exists_ inv) inv g |- body : stt<0> unit (inv true) (fun _ -> exists_ inv) ------------------------------------------------------------------------- g |- while inv cond body : stt<0> unit (exists_ inv) (fun _ -> inv false) *) val while_typing (#g:env) (#inv:term) (#cond:term) (#body:term) (inv_typing:RT.tot_typing g inv (mk_arrow (bool_tm, Q_Explicit) vprop_tm)) (cond_typing:RT.tot_typing g cond (mk_stt_comp uzero bool_tm (mk_exists uzero bool_tm inv) inv)) (body_typing:RT.tot_typing g body (mk_stt_comp uzero unit_tm (pack_ln (Tv_App inv (true_tm, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists uzero bool_tm inv)))) : RT.tot_typing g (mk_while inv cond body) (mk_stt_comp uzero unit_tm (mk_exists uzero bool_tm inv) (mk_abs unit_tm Q_Explicit (pack_ln (Tv_App inv (false_tm, Q_Explicit))))) let par_post (u:universe) (aL aR:term) (postL postR:term) (x:var) : term = let x_tm = RT.var_as_term x in let postL = pack_ln (Tv_App postL (mk_fst u u aL aR x_tm, Q_Explicit)) in let postR = pack_ln (Tv_App postR (mk_snd u u aL aR x_tm, Q_Explicit)) in let post = mk_star postL postR in RT.subst_term post [ RT.ND x 0 ] val par_typing (#g:env) (#u:universe) (#aL #aR:term) (#preL #postL:term) (#preR #postR:term) (#eL #eR:term) (x:var{None? (RT.lookup_bvar g x)}) (aL_typing:RT.tot_typing g aL (pack_ln (Tv_Type u))) (aR_typing:RT.tot_typing g aR (pack_ln (Tv_Type u))) (preL_typing:RT.tot_typing g preL vprop_tm) (postL_typing:RT.tot_typing g postL (mk_arrow (aL, Q_Explicit) vprop_tm)) (preR_typing:RT.tot_typing g preR vprop_tm) (postR_typing:RT.tot_typing g postR (mk_arrow (aR, Q_Explicit) vprop_tm)) (eL_typing:RT.tot_typing g eL (mk_stt_comp u aL preL postL)) (eR_typing:RT.tot_typing g eR (mk_stt_comp u aR preR postR)) : GTot (RT.tot_typing g (mk_par u aL aR preL postL preR postR eL eR) (mk_stt_comp u (mk_tuple2 u u aL aR) (mk_star preL preR) (mk_abs (mk_tuple2 u u aL aR) Q_Explicit (par_post u aL aR postL postR x)))) val exists_inversion (#g:env) (#u:universe) (#a:term) (#p:term) (e_typing:RT.tot_typing g (mk_exists u a p) vprop_tm) : GTot (RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (* g |- a : Type u g |- p : a -> vprop ---------------------------------------------------------------- g |- elim_exists<u> #a p : stt_ghost<u> a empty (exists_<u> p) (fun x -> p (reveal x)) *) let elim_exists_post_body (u:universe) (a:term) (p:term) (x:var) = let x_tm = RT.var_as_term x in let reveal_x = mk_reveal u a x_tm in let post = pack_ln (Tv_App p (reveal_x, Q_Explicit)) in RT.subst_term post [ RT.ND x 0 ] let elim_exists_post (u:universe) (a:term) (p:term) (x:var) = let erased_a = mk_erased u a in mk_abs erased_a Q_Explicit (elim_exists_post_body u a p x) val elim_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_elim_exists u a p) (mk_stt_ghost_comp u (mk_erased u a) emp_inames_tm (mk_exists u a p) (elim_exists_post u a p x))) (* g |- a : Type u g |- p : a -> vprop g |- e : vprop ------------------------------------------------------------------------- g |- intro_exists<u> #a p e : stt_ghost<0> unit empty (p e) (fun _ -> exists_ p) *) val intro_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#e:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (e_typing:RT.ghost_typing g e a) : GTot (RT.tot_typing g (mk_intro_exists u a p e) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists u a p)))) (* g |- a : Type u g |- p : vprop g |- q : a -> vprop ------------------------------------------ g |- stt_admit a p q : stt a p q *) val stt_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_admit u a p q) (mk_stt_comp u a p q)) val stt_atomic_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_admit u a p q) (mk_stt_atomic_comp u a emp_inames_tm p q)) val stt_ghost_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_admit u a p q) (mk_stt_ghost_comp u a emp_inames_tm p q)) val rewrite_typing (#g:env) (#p:term) (#q:term) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q vprop_tm) (equiv:RT.tot_typing g (`()) (stt_vprop_equiv p q)) : GTot (RT.tot_typing g (mk_rewrite p q) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm p (mk_abs unit_tm Q_Explicit q))) // mk_star pre (mk_pts_to a (RT.bound_var 0) full_perm_tm init let with_local_body_pre (pre:term) (a:term) (x:term) (init:term) : term = let pts_to : term = mk_pts_to a x full_perm_tm init in mk_star pre pts_to // // post has 0 db index free // let with_local_body_post_body (post:term) (a:term) (x:term) : term = // exists_ (R.pts_to r full_perm) let exists_tm = mk_exists (pack_universe Uv_Zero) a (mk_abs a Q_Explicit (mk_pts_to a x full_perm_tm (RT.bound_var 0))) in mk_star post exists_tm let with_local_body_post (post:term) (a:term) (ret_t:term) (x:term) : term = mk_abs ret_t Q_Explicit (with_local_body_post_body post a x) val with_local_typing (#g:env) (#u:universe) (#a:term) (#init:term) (#pre:term) (#ret_t:term) (#post:term) // post has db 0 free (#body:term) // body has x free (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type (pack_universe Uv_Zero)))) (init_typing:RT.tot_typing g init a) (pre_typing:RT.tot_typing g pre vprop_tm) (ret_t_typing:RT.tot_typing g ret_t (pack_ln (Tv_Type u))) (post_typing:RT.tot_typing g (RT.mk_abs ret_t Q_Explicit post) (mk_arrow (ret_t, Q_Explicit) vprop_tm)) (body_typing:RT.tot_typing (RT.extend_env g x (mk_ref a)) body (mk_stt_comp u ret_t (with_local_body_pre pre a (RT.var_as_term x) init) (with_local_body_post post a ret_t (RT.var_as_term x)))) : GTot (RT.tot_typing g (mk_withlocal u a init pre ret_t (RT.mk_abs ret_t Q_Explicit post) (RT.mk_abs (mk_ref a) Q_Explicit (RT.close_term body x))) (mk_stt_comp u ret_t pre (mk_abs ret_t Q_Explicit post))) let with_localarray_body_pre (pre:term) (a:term) (arr:term) (init:term) (len:term) : term = let pts_to : term = mk_array_pts_to a arr full_perm_tm (mk_seq_create uzero a (mk_szv len) init) in let is_full : term = mk_pure (mk_array_is_full a arr) in let len_vp : term = mk_pure (mk_eq2 uzero nat_tm (mk_array_length a arr) (mk_szv len)) in mk_star pre (mk_star pts_to (mk_star is_full len_vp)) // // post has 0 db index free
false
true
Pulse.Steel.Wrapper.Typing.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 with_localarray_body_post_body (post a arr: term) : term
[]
Pulse.Steel.Wrapper.Typing.with_localarray_body_post_body
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
post: FStar.Reflection.Types.term -> a: FStar.Reflection.Types.term -> arr: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 24, "end_line": 392, "start_col": 75, "start_line": 386 }
Prims.Tot
val return_stt_atomic_noeq_comp (u: universe) (a x p: term) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p
val return_stt_atomic_noeq_comp (u: universe) (a x p: term) : term let return_stt_atomic_noeq_comp (u: universe) (a x p: term) : term =
false
null
false
mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_stt_atomic_comp", "Pulse.Reflection.Util.emp_inames_tm", "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" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x))
false
true
Pulse.Steel.Wrapper.Typing.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 return_stt_atomic_noeq_comp (u: universe) (a x p: term) : term
[]
Pulse.Steel.Wrapper.Typing.return_stt_atomic_noeq_comp
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u23: FStar.Reflection.Types.universe -> a: FStar.Reflection.Types.term -> x: FStar.Reflection.Types.term -> p: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 77, "end_line": 73, "start_col": 2, "start_line": 73 }
Prims.Tot
val with_local_body_pre (pre a x init: term) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 with_local_body_pre (pre:term) (a:term) (x:term) (init:term) : term = let pts_to : term = mk_pts_to a x full_perm_tm init in mk_star pre pts_to
val with_local_body_pre (pre a x init: term) : term let with_local_body_pre (pre a x init: term) : term =
false
null
false
let pts_to:term = mk_pts_to a x full_perm_tm init in mk_star pre pts_to
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_star", "Pulse.Reflection.Util.mk_pts_to", "Pulse.Reflection.Util.full_perm_tm" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p)) let return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_ghost_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return u a e p) (return_stt_ghost_comp u a e p x)) let return_stt_ghost_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_ghost_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return_noeq u a x p) (return_stt_ghost_noeq_comp u a x p)) (* g |- inv : bool -> vprop g |- cond : stt<0> bool (exists_ inv) inv g |- body : stt<0> unit (inv true) (fun _ -> exists_ inv) ------------------------------------------------------------------------- g |- while inv cond body : stt<0> unit (exists_ inv) (fun _ -> inv false) *) val while_typing (#g:env) (#inv:term) (#cond:term) (#body:term) (inv_typing:RT.tot_typing g inv (mk_arrow (bool_tm, Q_Explicit) vprop_tm)) (cond_typing:RT.tot_typing g cond (mk_stt_comp uzero bool_tm (mk_exists uzero bool_tm inv) inv)) (body_typing:RT.tot_typing g body (mk_stt_comp uzero unit_tm (pack_ln (Tv_App inv (true_tm, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists uzero bool_tm inv)))) : RT.tot_typing g (mk_while inv cond body) (mk_stt_comp uzero unit_tm (mk_exists uzero bool_tm inv) (mk_abs unit_tm Q_Explicit (pack_ln (Tv_App inv (false_tm, Q_Explicit))))) let par_post (u:universe) (aL aR:term) (postL postR:term) (x:var) : term = let x_tm = RT.var_as_term x in let postL = pack_ln (Tv_App postL (mk_fst u u aL aR x_tm, Q_Explicit)) in let postR = pack_ln (Tv_App postR (mk_snd u u aL aR x_tm, Q_Explicit)) in let post = mk_star postL postR in RT.subst_term post [ RT.ND x 0 ] val par_typing (#g:env) (#u:universe) (#aL #aR:term) (#preL #postL:term) (#preR #postR:term) (#eL #eR:term) (x:var{None? (RT.lookup_bvar g x)}) (aL_typing:RT.tot_typing g aL (pack_ln (Tv_Type u))) (aR_typing:RT.tot_typing g aR (pack_ln (Tv_Type u))) (preL_typing:RT.tot_typing g preL vprop_tm) (postL_typing:RT.tot_typing g postL (mk_arrow (aL, Q_Explicit) vprop_tm)) (preR_typing:RT.tot_typing g preR vprop_tm) (postR_typing:RT.tot_typing g postR (mk_arrow (aR, Q_Explicit) vprop_tm)) (eL_typing:RT.tot_typing g eL (mk_stt_comp u aL preL postL)) (eR_typing:RT.tot_typing g eR (mk_stt_comp u aR preR postR)) : GTot (RT.tot_typing g (mk_par u aL aR preL postL preR postR eL eR) (mk_stt_comp u (mk_tuple2 u u aL aR) (mk_star preL preR) (mk_abs (mk_tuple2 u u aL aR) Q_Explicit (par_post u aL aR postL postR x)))) val exists_inversion (#g:env) (#u:universe) (#a:term) (#p:term) (e_typing:RT.tot_typing g (mk_exists u a p) vprop_tm) : GTot (RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (* g |- a : Type u g |- p : a -> vprop ---------------------------------------------------------------- g |- elim_exists<u> #a p : stt_ghost<u> a empty (exists_<u> p) (fun x -> p (reveal x)) *) let elim_exists_post_body (u:universe) (a:term) (p:term) (x:var) = let x_tm = RT.var_as_term x in let reveal_x = mk_reveal u a x_tm in let post = pack_ln (Tv_App p (reveal_x, Q_Explicit)) in RT.subst_term post [ RT.ND x 0 ] let elim_exists_post (u:universe) (a:term) (p:term) (x:var) = let erased_a = mk_erased u a in mk_abs erased_a Q_Explicit (elim_exists_post_body u a p x) val elim_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_elim_exists u a p) (mk_stt_ghost_comp u (mk_erased u a) emp_inames_tm (mk_exists u a p) (elim_exists_post u a p x))) (* g |- a : Type u g |- p : a -> vprop g |- e : vprop ------------------------------------------------------------------------- g |- intro_exists<u> #a p e : stt_ghost<0> unit empty (p e) (fun _ -> exists_ p) *) val intro_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#e:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (e_typing:RT.ghost_typing g e a) : GTot (RT.tot_typing g (mk_intro_exists u a p e) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists u a p)))) (* g |- a : Type u g |- p : vprop g |- q : a -> vprop ------------------------------------------ g |- stt_admit a p q : stt a p q *) val stt_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_admit u a p q) (mk_stt_comp u a p q)) val stt_atomic_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_admit u a p q) (mk_stt_atomic_comp u a emp_inames_tm p q)) val stt_ghost_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_admit u a p q) (mk_stt_ghost_comp u a emp_inames_tm p q)) val rewrite_typing (#g:env) (#p:term) (#q:term) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q vprop_tm) (equiv:RT.tot_typing g (`()) (stt_vprop_equiv p q)) : GTot (RT.tot_typing g (mk_rewrite p q) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm p (mk_abs unit_tm Q_Explicit q)))
false
true
Pulse.Steel.Wrapper.Typing.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 with_local_body_pre (pre a x init: term) : term
[]
Pulse.Steel.Wrapper.Typing.with_local_body_pre
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
pre: FStar.Reflection.Types.term -> a: FStar.Reflection.Types.term -> x: FStar.Reflection.Types.term -> init: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 20, "end_line": 333, "start_col": 73, "start_line": 330 }
Prims.Tot
val with_local_body_post (post a ret_t x: term) : term
[ { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "FStar.Reflection.V2", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Steel.Wrapper", "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 with_local_body_post (post:term) (a:term) (ret_t:term) (x:term) : term = mk_abs ret_t Q_Explicit (with_local_body_post_body post a x)
val with_local_body_post (post a ret_t x: term) : term let with_local_body_post (post a ret_t x: term) : term =
false
null
false
mk_abs ret_t Q_Explicit (with_local_body_post_body post a x)
{ "checked_file": "Pulse.Steel.Wrapper.Typing.fsti.checked", "dependencies": [ "Pulse.Reflection.Util.fst.checked", "prims.fst.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "Pulse.Steel.Wrapper.Typing.fsti" }
[ "total" ]
[ "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_abs", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Steel.Wrapper.Typing.with_local_body_post_body" ]
[]
module Pulse.Steel.Wrapper.Typing open FStar.Reflection.V2 open Pulse.Reflection.Util module RT = FStar.Reflection.Typing let return_post_with_eq (u:universe) (a:term) (e:term) (p:term) (x:var) : term = let x_tm = RT.var_as_term x in let eq2_tm = mk_eq2 u a x_tm e in let p_app_x = pack_ln (Tv_App p (x_tm, Q_Explicit)) in let star_tm = mk_star p_app_x (mk_pure eq2_tm) in mk_abs a Q_Explicit (RT.subst_term star_tm [ RT.ND x 0 ]) let return_stt_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_comp u a (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return u a e p) (return_stt_comp u a e p x)) let return_stt_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_comp u a (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_return_noeq u a x p) (return_stt_noeq_comp u a x p)) let return_stt_atomic_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_atomic_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return u a e p) (return_stt_atomic_comp u a e p x)) let return_stt_atomic_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_atomic_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_atomic_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_return_noeq u a x p) (return_stt_atomic_noeq_comp u a x p)) let return_stt_ghost_comp (u:universe) (a:term) (e:term) (p:term) (x:var) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (return_post_with_eq u a e p x) val return_stt_ghost_typing (#g:env) (#u:universe) (#a:term) (#e:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (e_typing:RT.tot_typing g e a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return u a e p) (return_stt_ghost_comp u a e p x)) let return_stt_ghost_noeq_comp (u:universe) (a:term) (x:term) (p:term) : term = mk_stt_ghost_comp u a emp_inames_tm (pack_ln (Tv_App p (x, Q_Explicit))) p val return_stt_ghost_noeq_typing (#g:env) (#u:universe) (#a:term) (#x:term) (#p:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (x_typing:RT.tot_typing g x a) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_return_noeq u a x p) (return_stt_ghost_noeq_comp u a x p)) (* g |- inv : bool -> vprop g |- cond : stt<0> bool (exists_ inv) inv g |- body : stt<0> unit (inv true) (fun _ -> exists_ inv) ------------------------------------------------------------------------- g |- while inv cond body : stt<0> unit (exists_ inv) (fun _ -> inv false) *) val while_typing (#g:env) (#inv:term) (#cond:term) (#body:term) (inv_typing:RT.tot_typing g inv (mk_arrow (bool_tm, Q_Explicit) vprop_tm)) (cond_typing:RT.tot_typing g cond (mk_stt_comp uzero bool_tm (mk_exists uzero bool_tm inv) inv)) (body_typing:RT.tot_typing g body (mk_stt_comp uzero unit_tm (pack_ln (Tv_App inv (true_tm, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists uzero bool_tm inv)))) : RT.tot_typing g (mk_while inv cond body) (mk_stt_comp uzero unit_tm (mk_exists uzero bool_tm inv) (mk_abs unit_tm Q_Explicit (pack_ln (Tv_App inv (false_tm, Q_Explicit))))) let par_post (u:universe) (aL aR:term) (postL postR:term) (x:var) : term = let x_tm = RT.var_as_term x in let postL = pack_ln (Tv_App postL (mk_fst u u aL aR x_tm, Q_Explicit)) in let postR = pack_ln (Tv_App postR (mk_snd u u aL aR x_tm, Q_Explicit)) in let post = mk_star postL postR in RT.subst_term post [ RT.ND x 0 ] val par_typing (#g:env) (#u:universe) (#aL #aR:term) (#preL #postL:term) (#preR #postR:term) (#eL #eR:term) (x:var{None? (RT.lookup_bvar g x)}) (aL_typing:RT.tot_typing g aL (pack_ln (Tv_Type u))) (aR_typing:RT.tot_typing g aR (pack_ln (Tv_Type u))) (preL_typing:RT.tot_typing g preL vprop_tm) (postL_typing:RT.tot_typing g postL (mk_arrow (aL, Q_Explicit) vprop_tm)) (preR_typing:RT.tot_typing g preR vprop_tm) (postR_typing:RT.tot_typing g postR (mk_arrow (aR, Q_Explicit) vprop_tm)) (eL_typing:RT.tot_typing g eL (mk_stt_comp u aL preL postL)) (eR_typing:RT.tot_typing g eR (mk_stt_comp u aR preR postR)) : GTot (RT.tot_typing g (mk_par u aL aR preL postL preR postR eL eR) (mk_stt_comp u (mk_tuple2 u u aL aR) (mk_star preL preR) (mk_abs (mk_tuple2 u u aL aR) Q_Explicit (par_post u aL aR postL postR x)))) val exists_inversion (#g:env) (#u:universe) (#a:term) (#p:term) (e_typing:RT.tot_typing g (mk_exists u a p) vprop_tm) : GTot (RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (* g |- a : Type u g |- p : a -> vprop ---------------------------------------------------------------- g |- elim_exists<u> #a p : stt_ghost<u> a empty (exists_<u> p) (fun x -> p (reveal x)) *) let elim_exists_post_body (u:universe) (a:term) (p:term) (x:var) = let x_tm = RT.var_as_term x in let reveal_x = mk_reveal u a x_tm in let post = pack_ln (Tv_App p (reveal_x, Q_Explicit)) in RT.subst_term post [ RT.ND x 0 ] let elim_exists_post (u:universe) (a:term) (p:term) (x:var) = let erased_a = mk_erased u a in mk_abs erased_a Q_Explicit (elim_exists_post_body u a p x) val elim_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (x:var{None? (RT.lookup_bvar g x)}) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_elim_exists u a p) (mk_stt_ghost_comp u (mk_erased u a) emp_inames_tm (mk_exists u a p) (elim_exists_post u a p x))) (* g |- a : Type u g |- p : a -> vprop g |- e : vprop ------------------------------------------------------------------------- g |- intro_exists<u> #a p e : stt_ghost<0> unit empty (p e) (fun _ -> exists_ p) *) val intro_exists_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#e:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p (mk_arrow (a, Q_Explicit) vprop_tm)) (e_typing:RT.ghost_typing g e a) : GTot (RT.tot_typing g (mk_intro_exists u a p e) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm (pack_ln (Tv_App p (e, Q_Explicit))) (mk_abs unit_tm Q_Explicit (mk_exists u a p)))) (* g |- a : Type u g |- p : vprop g |- q : a -> vprop ------------------------------------------ g |- stt_admit a p q : stt a p q *) val stt_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_admit u a p q) (mk_stt_comp u a p q)) val stt_atomic_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_atomic_admit u a p q) (mk_stt_atomic_comp u a emp_inames_tm p q)) val stt_ghost_admit_typing (#g:env) (#u:universe) (#a:term) (#p:term) (#q:term) (a_typing:RT.tot_typing g a (pack_ln (Tv_Type u))) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q (mk_arrow (a, Q_Explicit) vprop_tm)) : GTot (RT.tot_typing g (mk_stt_ghost_admit u a p q) (mk_stt_ghost_comp u a emp_inames_tm p q)) val rewrite_typing (#g:env) (#p:term) (#q:term) (p_typing:RT.tot_typing g p vprop_tm) (q_typing:RT.tot_typing g q vprop_tm) (equiv:RT.tot_typing g (`()) (stt_vprop_equiv p q)) : GTot (RT.tot_typing g (mk_rewrite p q) (mk_stt_ghost_comp uzero unit_tm emp_inames_tm p (mk_abs unit_tm Q_Explicit q))) // mk_star pre (mk_pts_to a (RT.bound_var 0) full_perm_tm init let with_local_body_pre (pre:term) (a:term) (x:term) (init:term) : term = let pts_to : term = mk_pts_to a x full_perm_tm init in mk_star pre pts_to // // post has 0 db index free // let with_local_body_post_body (post:term) (a:term) (x:term) : term = // exists_ (R.pts_to r full_perm) let exists_tm = mk_exists (pack_universe Uv_Zero) a (mk_abs a Q_Explicit (mk_pts_to a x full_perm_tm (RT.bound_var 0))) in mk_star post exists_tm
false
true
Pulse.Steel.Wrapper.Typing.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 with_local_body_post (post a ret_t x: term) : term
[]
Pulse.Steel.Wrapper.Typing.with_local_body_post
{ "file_name": "lib/steel/pulse/Pulse.Steel.Wrapper.Typing.fsti", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
post: FStar.Reflection.Types.term -> a: FStar.Reflection.Types.term -> ret_t: FStar.Reflection.Types.term -> x: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 62, "end_line": 347, "start_col": 2, "start_line": 347 }
Prims.Tot
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_exp_mont_consttime_threshold = 200
let bn_exp_mont_consttime_threshold =
false
null
false
200
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_sqr #t #len n mu aM = BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM let mk_bn_mont_concrete_ops (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.concrete_ops (bn_mont_t n) = { SE.to = mk_to_nat_mont_ll_comm_monoid n mu; SE.one = bn_mont_one #t #len n mu; SE.mul = bn_mont_mul #t #len n mu; SE.sqr = bn_mont_sqr #t #len n mu; } /////////////////////////////////////////////////////////////////////////////// //TODO: set _threshold properly and //add `bn_get_window_size` (consttime and vartime) inline_for_extraction noextract let bn_exp_mont_vartime_threshold = 200
false
true
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_exp_mont_consttime_threshold : Prims.int
[]
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_consttime_threshold
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Prims.int
{ "end_col": 41, "end_line": 99, "start_col": 38, "start_line": 99 }
Prims.Tot
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_exp_mont_vartime_threshold = 200
let bn_exp_mont_vartime_threshold =
false
null
false
200
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_sqr #t #len n mu aM = BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM let mk_bn_mont_concrete_ops (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.concrete_ops (bn_mont_t n) = { SE.to = mk_to_nat_mont_ll_comm_monoid n mu; SE.one = bn_mont_one #t #len n mu; SE.mul = bn_mont_mul #t #len n mu; SE.sqr = bn_mont_sqr #t #len n mu; } /////////////////////////////////////////////////////////////////////////////// //TODO: set _threshold properly and //add `bn_get_window_size` (consttime and vartime)
false
true
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_exp_mont_vartime_threshold : Prims.int
[]
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_vartime_threshold
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Prims.int
{ "end_col": 39, "end_line": 96, "start_col": 36, "start_line": 96 }
Prims.Tot
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n}
let bn_mont_t (#t: limb_t) (#len: BN.bn_len t) (n: lbignum t len) =
false
null
false
x: lbignum t len {bn_v x < bn_v n}
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Hacl.Spec.Bignum.Definitions.lbignum", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.Bignum.Definitions.bn_v" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_mont_t : n: Hacl.Spec.Bignum.Definitions.lbignum t len -> Type0
[]
Hacl.Spec.Bignum.MontExponentiation.bn_mont_t
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Hacl.Spec.Bignum.Definitions.lbignum t len -> Type0
{ "end_col": 34, "end_line": 25, "start_col": 2, "start_line": 25 }
Prims.Tot
val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu)
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2
val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ =
false
null
false
BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "Prims.unit", "Hacl.Spec.Bignum.Montgomery.bn_mont_one", "Hacl.Spec.Bignum.Montgomery.bn_mont_one_lemma", "Hacl.Spec.Bignum.Montgomery.bn_precomp_r2_mod_n", "Hacl.Spec.Bignum.Montgomery.bn_precomp_r2_mod_n_lemma", "Hacl.Spec.Bignum.MontExponentiation.bn_mont_t" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu)
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu)
[]
Hacl.Spec.Bignum.MontExponentiation.bn_mont_one
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Hacl.Spec.Bignum.Definitions.lbignum t len -> mu: Hacl.Spec.Bignum.Definitions.limb t {Hacl.Spec.Bignum.Montgomery.bn_mont_pre n mu} -> Spec.Exponentiation.one_st (Hacl.Spec.Bignum.MontExponentiation.bn_mont_t n) (Hacl.Spec.Bignum.MontExponentiation.mk_to_nat_mont_ll_comm_monoid n mu)
{ "end_col": 24, "end_line": 51, "start_col": 2, "start_line": 48 }
Prims.Tot
val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu)
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM
val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM =
false
null
false
BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "Hacl.Spec.Bignum.MontExponentiation.bn_mont_t", "Hacl.Spec.Bignum.Montgomery.bn_mont_mul", "Prims.unit", "Hacl.Spec.Bignum.Montgomery.bn_mont_mul_lemma" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu)
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu)
[]
Hacl.Spec.Bignum.MontExponentiation.bn_mont_mul
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Hacl.Spec.Bignum.Definitions.lbignum t len -> mu: Hacl.Spec.Bignum.Definitions.limb t {Hacl.Spec.Bignum.Montgomery.bn_mont_pre n mu} -> Spec.Exponentiation.mul_st (Hacl.Spec.Bignum.MontExponentiation.bn_mont_t n) (Hacl.Spec.Bignum.MontExponentiation.mk_to_nat_mont_ll_comm_monoid n mu)
{ "end_col": 27, "end_line": 63, "start_col": 2, "start_line": 62 }
Prims.Tot
val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu)
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_mont_sqr #t #len n mu aM = BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM
val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_sqr #t #len n mu aM =
false
null
false
BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "Hacl.Spec.Bignum.MontExponentiation.bn_mont_t", "Hacl.Spec.Bignum.Montgomery.bn_mont_sqr", "Prims.unit", "Hacl.Spec.Bignum.Montgomery.bn_mont_sqr_lemma" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu)
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu)
[]
Hacl.Spec.Bignum.MontExponentiation.bn_mont_sqr
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
n: Hacl.Spec.Bignum.Definitions.lbignum t len -> mu: Hacl.Spec.Bignum.Definitions.limb t {Hacl.Spec.Bignum.Montgomery.bn_mont_pre n mu} -> Spec.Exponentiation.sqr_st (Hacl.Spec.Bignum.MontExponentiation.bn_mont_t n) (Hacl.Spec.Bignum.MontExponentiation.mk_to_nat_mont_ll_comm_monoid n mu)
{ "end_col": 24, "end_line": 75, "start_col": 2, "start_line": 74 }
Prims.Tot
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_exp_mont_st (t:limb_t) (len:BN.bn_len t) = n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> aM:bn_mont_t n -> bBits:size_nat -> b:lbignum t (blocks0 bBits (bits t)){bn_v b < pow2 bBits} -> Pure (bn_mont_t n) (requires True) (ensures fun resM -> let k = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu) in bn_v resM == LE.pow k (bn_v aM) (bn_v b))
let bn_exp_mont_st (t: limb_t) (len: BN.bn_len t) =
false
null
false
n: lbignum t len -> mu: limb t {BM.bn_mont_pre n mu} -> aM: bn_mont_t n -> bBits: size_nat -> b: lbignum t (blocks0 bBits (bits t)) {bn_v b < pow2 bBits} -> Pure (bn_mont_t n) (requires True) (ensures fun resM -> let k = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu) in bn_v resM == LE.pow k (bn_v aM) (bn_v b))
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "Hacl.Spec.Bignum.MontExponentiation.bn_mont_t", "Lib.IntTypes.size_nat", "Hacl.Spec.Bignum.Definitions.blocks0", "Lib.IntTypes.bits", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.Bignum.Definitions.bn_v", "Prims.pow2", "Prims.l_True", "Prims.eq2", "Prims.nat", "Lib.Exponentiation.Definition.pow", "Lib.NatMod.nat_mod", "Lib.Exponentiation.Definition.comm_monoid", "Hacl.Spec.Exponentiation.Lemmas.mk_nat_mont_ll_comm_monoid", "Lib.IntTypes.v", "Lib.IntTypes.SEC" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_sqr #t #len n mu aM = BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM let mk_bn_mont_concrete_ops (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.concrete_ops (bn_mont_t n) = { SE.to = mk_to_nat_mont_ll_comm_monoid n mu; SE.one = bn_mont_one #t #len n mu; SE.mul = bn_mont_mul #t #len n mu; SE.sqr = bn_mont_sqr #t #len n mu; } /////////////////////////////////////////////////////////////////////////////// //TODO: set _threshold properly and //add `bn_get_window_size` (consttime and vartime) inline_for_extraction noextract let bn_exp_mont_vartime_threshold = 200 inline_for_extraction noextract let bn_exp_mont_consttime_threshold = 200 noextract
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_exp_mont_st : t: Hacl.Spec.Bignum.Definitions.limb_t -> len: Hacl.Spec.Bignum.bn_len t -> Type0
[]
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_st
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
t: Hacl.Spec.Bignum.Definitions.limb_t -> len: Hacl.Spec.Bignum.bn_len t -> Type0
{ "end_col": 45, "end_line": 113, "start_col": 4, "start_line": 104 }
Prims.Tot
val bn_exp_mont_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_exp_mont_vartime #t #len n mu aM bBits b = if bBits < bn_exp_mont_vartime_threshold then bn_exp_mont_bm_vartime n mu aM bBits b else bn_exp_mont_fw 4 n mu aM bBits b
val bn_exp_mont_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_vartime #t #len n mu aM bBits b =
false
null
false
if bBits < bn_exp_mont_vartime_threshold then bn_exp_mont_bm_vartime n mu aM bBits b else bn_exp_mont_fw 4 n mu aM bBits b
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "Hacl.Spec.Bignum.MontExponentiation.bn_mont_t", "Lib.IntTypes.size_nat", "Hacl.Spec.Bignum.Definitions.blocks0", "Lib.IntTypes.bits", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.Bignum.Definitions.bn_v", "Prims.pow2", "Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_vartime_threshold", "Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_bm_vartime", "Prims.bool", "Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_fw" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_sqr #t #len n mu aM = BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM let mk_bn_mont_concrete_ops (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.concrete_ops (bn_mont_t n) = { SE.to = mk_to_nat_mont_ll_comm_monoid n mu; SE.one = bn_mont_one #t #len n mu; SE.mul = bn_mont_mul #t #len n mu; SE.sqr = bn_mont_sqr #t #len n mu; } /////////////////////////////////////////////////////////////////////////////// //TODO: set _threshold properly and //add `bn_get_window_size` (consttime and vartime) inline_for_extraction noextract let bn_exp_mont_vartime_threshold = 200 inline_for_extraction noextract let bn_exp_mont_consttime_threshold = 200 noextract let bn_exp_mont_st (t:limb_t) (len:BN.bn_len t) = n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> aM:bn_mont_t n -> bBits:size_nat -> b:lbignum t (blocks0 bBits (bits t)){bn_v b < pow2 bBits} -> Pure (bn_mont_t n) (requires True) (ensures fun resM -> let k = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu) in bn_v resM == LE.pow k (bn_v aM) (bn_v b)) // no diff between vartime and consttime at the spec level val bn_exp_mont_bm_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_bm_vartime #t #len n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_rl_lemma k1 aM bBits (bn_v b); LE.exp_rl_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_rl k1 aM bBits (bn_v b) val bn_exp_mont_bm_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_bm_consttime #t #len n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_mont_ladder_swap_lemma k1 aM bBits (bn_v b); LE.exp_mont_ladder_swap_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); LE.exp_mont_ladder_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_mont_ladder_swap k1 aM bBits (bn_v b) val bn_exp_mont_fw: #t:limb_t -> #len:BN.bn_len t -> l:size_pos{l < bits t /\ pow2 l * len <= max_size_t} -> bn_exp_mont_st t len let bn_exp_mont_fw #t #len l n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_fw_lemma k1 aM bBits (bn_v b) l; LE.exp_fw_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b) l; SE.exp_fw k1 aM bBits (bn_v b) l val bn_exp_mont_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_exp_mont_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
[]
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_vartime
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_st t len
{ "end_col": 36, "end_line": 152, "start_col": 2, "start_line": 149 }
Prims.Tot
val bn_exp_mont_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_exp_mont_consttime #t #len n mu aM bBits b = if bBits < bn_exp_mont_consttime_threshold then bn_exp_mont_bm_consttime n mu aM bBits b else bn_exp_mont_fw 4 n mu aM bBits b
val bn_exp_mont_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_consttime #t #len n mu aM bBits b =
false
null
false
if bBits < bn_exp_mont_consttime_threshold then bn_exp_mont_bm_consttime n mu aM bBits b else bn_exp_mont_fw 4 n mu aM bBits b
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "Hacl.Spec.Bignum.MontExponentiation.bn_mont_t", "Lib.IntTypes.size_nat", "Hacl.Spec.Bignum.Definitions.blocks0", "Lib.IntTypes.bits", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.Bignum.Definitions.bn_v", "Prims.pow2", "Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_consttime_threshold", "Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_bm_consttime", "Prims.bool", "Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_fw" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_sqr #t #len n mu aM = BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM let mk_bn_mont_concrete_ops (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.concrete_ops (bn_mont_t n) = { SE.to = mk_to_nat_mont_ll_comm_monoid n mu; SE.one = bn_mont_one #t #len n mu; SE.mul = bn_mont_mul #t #len n mu; SE.sqr = bn_mont_sqr #t #len n mu; } /////////////////////////////////////////////////////////////////////////////// //TODO: set _threshold properly and //add `bn_get_window_size` (consttime and vartime) inline_for_extraction noextract let bn_exp_mont_vartime_threshold = 200 inline_for_extraction noextract let bn_exp_mont_consttime_threshold = 200 noextract let bn_exp_mont_st (t:limb_t) (len:BN.bn_len t) = n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> aM:bn_mont_t n -> bBits:size_nat -> b:lbignum t (blocks0 bBits (bits t)){bn_v b < pow2 bBits} -> Pure (bn_mont_t n) (requires True) (ensures fun resM -> let k = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu) in bn_v resM == LE.pow k (bn_v aM) (bn_v b)) // no diff between vartime and consttime at the spec level val bn_exp_mont_bm_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_bm_vartime #t #len n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_rl_lemma k1 aM bBits (bn_v b); LE.exp_rl_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_rl k1 aM bBits (bn_v b) val bn_exp_mont_bm_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_bm_consttime #t #len n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_mont_ladder_swap_lemma k1 aM bBits (bn_v b); LE.exp_mont_ladder_swap_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); LE.exp_mont_ladder_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_mont_ladder_swap k1 aM bBits (bn_v b) val bn_exp_mont_fw: #t:limb_t -> #len:BN.bn_len t -> l:size_pos{l < bits t /\ pow2 l * len <= max_size_t} -> bn_exp_mont_st t len let bn_exp_mont_fw #t #len l n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_fw_lemma k1 aM bBits (bn_v b) l; LE.exp_fw_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b) l; SE.exp_fw k1 aM bBits (bn_v b) l val bn_exp_mont_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_vartime #t #len n mu aM bBits b = if bBits < bn_exp_mont_vartime_threshold then bn_exp_mont_bm_vartime n mu aM bBits b else bn_exp_mont_fw 4 n mu aM bBits b val bn_exp_mont_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_exp_mont_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
[]
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_consttime
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_st t len
{ "end_col": 36, "end_line": 160, "start_col": 2, "start_line": 157 }
Prims.Tot
val bn_exp_mont_bm_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_exp_mont_bm_vartime #t #len n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_rl_lemma k1 aM bBits (bn_v b); LE.exp_rl_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_rl k1 aM bBits (bn_v b)
val bn_exp_mont_bm_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_bm_vartime #t #len n mu aM bBits b =
false
null
false
let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_rl_lemma k1 aM bBits (bn_v b); LE.exp_rl_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_rl k1 aM bBits (bn_v b)
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "Hacl.Spec.Bignum.MontExponentiation.bn_mont_t", "Lib.IntTypes.size_nat", "Hacl.Spec.Bignum.Definitions.blocks0", "Lib.IntTypes.bits", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.Bignum.Definitions.bn_v", "Prims.pow2", "Spec.Exponentiation.exp_rl", "Prims.unit", "Lib.Exponentiation.exp_rl_lemma", "Spec.Exponentiation.__proj__Mkto_comm_monoid__item__a_spec", "Spec.Exponentiation.__proj__Mkconcrete_ops__item__to", "Spec.Exponentiation.__proj__Mkto_comm_monoid__item__comm_monoid", "Spec.Exponentiation.exp_rl_lemma", "Spec.Exponentiation.concrete_ops", "Hacl.Spec.Bignum.MontExponentiation.mk_bn_mont_concrete_ops" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_sqr #t #len n mu aM = BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM let mk_bn_mont_concrete_ops (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.concrete_ops (bn_mont_t n) = { SE.to = mk_to_nat_mont_ll_comm_monoid n mu; SE.one = bn_mont_one #t #len n mu; SE.mul = bn_mont_mul #t #len n mu; SE.sqr = bn_mont_sqr #t #len n mu; } /////////////////////////////////////////////////////////////////////////////// //TODO: set _threshold properly and //add `bn_get_window_size` (consttime and vartime) inline_for_extraction noextract let bn_exp_mont_vartime_threshold = 200 inline_for_extraction noextract let bn_exp_mont_consttime_threshold = 200 noextract let bn_exp_mont_st (t:limb_t) (len:BN.bn_len t) = n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> aM:bn_mont_t n -> bBits:size_nat -> b:lbignum t (blocks0 bBits (bits t)){bn_v b < pow2 bBits} -> Pure (bn_mont_t n) (requires True) (ensures fun resM -> let k = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu) in bn_v resM == LE.pow k (bn_v aM) (bn_v b)) // no diff between vartime and consttime at the spec level
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_exp_mont_bm_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
[]
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_bm_vartime
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_st t len
{ "end_col": 32, "end_line": 122, "start_col": 52, "start_line": 118 }
Prims.Tot
val bn_exp_mont_bm_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_exp_mont_bm_consttime #t #len n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_mont_ladder_swap_lemma k1 aM bBits (bn_v b); LE.exp_mont_ladder_swap_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); LE.exp_mont_ladder_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_mont_ladder_swap k1 aM bBits (bn_v b)
val bn_exp_mont_bm_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_bm_consttime #t #len n mu aM bBits b =
false
null
false
let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_mont_ladder_swap_lemma k1 aM bBits (bn_v b); LE.exp_mont_ladder_swap_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); LE.exp_mont_ladder_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_mont_ladder_swap k1 aM bBits (bn_v b)
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "Hacl.Spec.Bignum.MontExponentiation.bn_mont_t", "Lib.IntTypes.size_nat", "Hacl.Spec.Bignum.Definitions.blocks0", "Lib.IntTypes.bits", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.Bignum.Definitions.bn_v", "Prims.pow2", "Spec.Exponentiation.exp_mont_ladder_swap", "Prims.unit", "Lib.Exponentiation.exp_mont_ladder_lemma", "Spec.Exponentiation.__proj__Mkto_comm_monoid__item__a_spec", "Spec.Exponentiation.__proj__Mkconcrete_ops__item__to", "Spec.Exponentiation.__proj__Mkto_comm_monoid__item__comm_monoid", "Lib.Exponentiation.exp_mont_ladder_swap_lemma", "Spec.Exponentiation.exp_mont_ladder_swap_lemma", "Spec.Exponentiation.concrete_ops", "Hacl.Spec.Bignum.MontExponentiation.mk_bn_mont_concrete_ops" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_sqr #t #len n mu aM = BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM let mk_bn_mont_concrete_ops (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.concrete_ops (bn_mont_t n) = { SE.to = mk_to_nat_mont_ll_comm_monoid n mu; SE.one = bn_mont_one #t #len n mu; SE.mul = bn_mont_mul #t #len n mu; SE.sqr = bn_mont_sqr #t #len n mu; } /////////////////////////////////////////////////////////////////////////////// //TODO: set _threshold properly and //add `bn_get_window_size` (consttime and vartime) inline_for_extraction noextract let bn_exp_mont_vartime_threshold = 200 inline_for_extraction noextract let bn_exp_mont_consttime_threshold = 200 noextract let bn_exp_mont_st (t:limb_t) (len:BN.bn_len t) = n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> aM:bn_mont_t n -> bBits:size_nat -> b:lbignum t (blocks0 bBits (bits t)){bn_v b < pow2 bBits} -> Pure (bn_mont_t n) (requires True) (ensures fun resM -> let k = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu) in bn_v resM == LE.pow k (bn_v aM) (bn_v b)) // no diff between vartime and consttime at the spec level val bn_exp_mont_bm_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_bm_vartime #t #len n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_rl_lemma k1 aM bBits (bn_v b); LE.exp_rl_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_rl k1 aM bBits (bn_v b)
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_exp_mont_bm_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len
[]
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_bm_consttime
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_st t len
{ "end_col": 46, "end_line": 131, "start_col": 54, "start_line": 126 }
Prims.Tot
val bn_exp_mont_fw: #t:limb_t -> #len:BN.bn_len t -> l:size_pos{l < bits t /\ pow2 l * len <= max_size_t} -> bn_exp_mont_st t len
[ { "abbrev": true, "full_module": "Hacl.Spec.Bignum.Montgomery", "short_module": "BM" }, { "abbrev": true, "full_module": "Hacl.Spec.Bignum", "short_module": "BN" }, { "abbrev": true, "full_module": "Hacl.Spec.Montgomery.Lemmas", "short_module": "M" }, { "abbrev": true, "full_module": "Hacl.Spec.Exponentiation.Lemmas", "short_module": "E" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum.Definitions", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "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": "Hacl.Spec.Bignum", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.Bignum", "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 bn_exp_mont_fw #t #len l n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_fw_lemma k1 aM bBits (bn_v b) l; LE.exp_fw_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b) l; SE.exp_fw k1 aM bBits (bn_v b) l
val bn_exp_mont_fw: #t:limb_t -> #len:BN.bn_len t -> l:size_pos{l < bits t /\ pow2 l * len <= max_size_t} -> bn_exp_mont_st t len let bn_exp_mont_fw #t #len l n mu aM bBits b =
false
null
false
let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_fw_lemma k1 aM bBits (bn_v b) l; LE.exp_fw_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b) l; SE.exp_fw k1 aM bBits (bn_v b) l
{ "checked_file": "Hacl.Spec.Bignum.MontExponentiation.fst.checked", "dependencies": [ "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.NatMod.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.Exponentiation.fsti.checked", "Hacl.Spec.Montgomery.Lemmas.fst.checked", "Hacl.Spec.Exponentiation.Lemmas.fst.checked", "Hacl.Spec.Bignum.Montgomery.fsti.checked", "Hacl.Spec.Bignum.Definitions.fst.checked", "Hacl.Spec.Bignum.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Hacl.Spec.Bignum.MontExponentiation.fst" }
[ "total" ]
[ "Hacl.Spec.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.bn_len", "Lib.IntTypes.size_pos", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.bits", "Prims.op_LessThanOrEqual", "FStar.Mul.op_Star", "Prims.pow2", "Lib.IntTypes.max_size_t", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre", "Hacl.Spec.Bignum.MontExponentiation.bn_mont_t", "Lib.IntTypes.size_nat", "Hacl.Spec.Bignum.Definitions.blocks0", "Hacl.Spec.Bignum.Definitions.bn_v", "Spec.Exponentiation.exp_fw", "Prims.unit", "Lib.Exponentiation.exp_fw_lemma", "Spec.Exponentiation.__proj__Mkto_comm_monoid__item__a_spec", "Spec.Exponentiation.__proj__Mkconcrete_ops__item__to", "Spec.Exponentiation.__proj__Mkto_comm_monoid__item__comm_monoid", "Spec.Exponentiation.exp_fw_lemma", "Spec.Exponentiation.concrete_ops", "Hacl.Spec.Bignum.MontExponentiation.mk_bn_mont_concrete_ops" ]
[]
module Hacl.Spec.Bignum.MontExponentiation open FStar.Mul open Lib.IntTypes open Lib.Sequence open Hacl.Spec.Bignum.Definitions module LE = Lib.Exponentiation module SE = Spec.Exponentiation module E = Hacl.Spec.Exponentiation.Lemmas module M = Hacl.Spec.Montgomery.Lemmas module BN = Hacl.Spec.Bignum module BM = Hacl.Spec.Bignum.Montgomery #reset-options "--z3rlimit 50 --fuel 0 --ifuel 0" // All operations are performed in the Montgomery domain! unfold let bn_mont_t (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) = x:lbignum t len{bn_v x < bn_v n} let mk_to_nat_mont_ll_comm_monoid (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.to_comm_monoid (bn_mont_t n) = { SE.a_spec = Lib.NatMod.nat_mod (bn_v n); SE.comm_monoid = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu); SE.refl = (fun (x:bn_mont_t n) -> bn_v x); } val bn_mont_one: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.one_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_one #t #len n mu _ = BM.bn_precomp_r2_mod_n_lemma 0 n; let r2 = BM.bn_precomp_r2_mod_n 0 n in BM.bn_mont_one_lemma n mu r2; BM.bn_mont_one n mu r2 val bn_mont_mul: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.mul_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_mul #t #len n mu aM bM = BM.bn_mont_mul_lemma n mu aM bM; BM.bn_mont_mul n mu aM bM val bn_mont_sqr: #t:limb_t -> #len:BN.bn_len t -> n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> SE.sqr_st (bn_mont_t n) (mk_to_nat_mont_ll_comm_monoid n mu) let bn_mont_sqr #t #len n mu aM = BM.bn_mont_sqr_lemma n mu aM; BM.bn_mont_sqr n mu aM let mk_bn_mont_concrete_ops (#t:limb_t) (#len:BN.bn_len t) (n:lbignum t len) (mu:limb t{BM.bn_mont_pre n mu}) : SE.concrete_ops (bn_mont_t n) = { SE.to = mk_to_nat_mont_ll_comm_monoid n mu; SE.one = bn_mont_one #t #len n mu; SE.mul = bn_mont_mul #t #len n mu; SE.sqr = bn_mont_sqr #t #len n mu; } /////////////////////////////////////////////////////////////////////////////// //TODO: set _threshold properly and //add `bn_get_window_size` (consttime and vartime) inline_for_extraction noextract let bn_exp_mont_vartime_threshold = 200 inline_for_extraction noextract let bn_exp_mont_consttime_threshold = 200 noextract let bn_exp_mont_st (t:limb_t) (len:BN.bn_len t) = n:lbignum t len -> mu:limb t{BM.bn_mont_pre n mu} -> aM:bn_mont_t n -> bBits:size_nat -> b:lbignum t (blocks0 bBits (bits t)){bn_v b < pow2 bBits} -> Pure (bn_mont_t n) (requires True) (ensures fun resM -> let k = E.mk_nat_mont_ll_comm_monoid (bits t) len (bn_v n) (v mu) in bn_v resM == LE.pow k (bn_v aM) (bn_v b)) // no diff between vartime and consttime at the spec level val bn_exp_mont_bm_vartime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_bm_vartime #t #len n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_rl_lemma k1 aM bBits (bn_v b); LE.exp_rl_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_rl k1 aM bBits (bn_v b) val bn_exp_mont_bm_consttime: #t:limb_t -> #len:BN.bn_len t -> bn_exp_mont_st t len let bn_exp_mont_bm_consttime #t #len n mu aM bBits b = let k1 = mk_bn_mont_concrete_ops n mu in SE.exp_mont_ladder_swap_lemma k1 aM bBits (bn_v b); LE.exp_mont_ladder_swap_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); LE.exp_mont_ladder_lemma k1.SE.to.SE.comm_monoid (bn_v aM) bBits (bn_v b); SE.exp_mont_ladder_swap k1 aM bBits (bn_v b) val bn_exp_mont_fw: #t:limb_t -> #len:BN.bn_len t -> l:size_pos{l < bits t /\ pow2 l * len <= max_size_t} -> bn_exp_mont_st t len
false
false
Hacl.Spec.Bignum.MontExponentiation.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 0, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bn_exp_mont_fw: #t:limb_t -> #len:BN.bn_len t -> l:size_pos{l < bits t /\ pow2 l * len <= max_size_t} -> bn_exp_mont_st t len
[]
Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_fw
{ "file_name": "code/bignum/Hacl.Spec.Bignum.MontExponentiation.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
l: Lib.IntTypes.size_pos{l < Lib.IntTypes.bits t /\ Prims.pow2 l * len <= Lib.IntTypes.max_size_t} -> Hacl.Spec.Bignum.MontExponentiation.bn_exp_mont_st t len
{ "end_col": 34, "end_line": 144, "start_col": 46, "start_line": 140 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind
let parse_deplen_payload_kind =
false
null
false
parse_bounded_vlgen_payload_kind
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "total" ]
[ "LowParse.Spec.VLGen.parse_bounded_vlgen_payload_kind" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *)
false
false
LowParse.Spec.DepLen.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 parse_deplen_payload_kind : min: Prims.nat -> max: Prims.nat{min <= max} -> k: LowParse.Spec.Base.parser_kind -> LowParse.Spec.Base.parser_kind
[]
LowParse.Spec.DepLen.parse_deplen_payload_kind
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max} -> k: LowParse.Spec.Base.parser_kind -> LowParse.Spec.Base.parser_kind
{ "end_col": 64, "end_line": 89, "start_col": 32, "start_line": 89 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind) (pk : parser_kind) = and_then_kind hk (parse_deplen_payload_kind min max pk)
let parse_deplen_kind (min: nat) (max: nat{min <= max /\ max < 4294967296}) (hk pk: parser_kind) =
false
null
false
and_then_kind hk (parse_deplen_payload_kind min max pk)
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "total" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Combinators.and_then_kind", "LowParse.Spec.DepLen.parse_deplen_payload_kind" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input (* metadata for dependent length parser @min : @max : integer bounds @hk : header metadata @pk : payload metadata *) let parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind)
false
false
LowParse.Spec.DepLen.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 parse_deplen_kind : min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> hk: LowParse.Spec.Base.parser_kind -> pk: LowParse.Spec.Base.parser_kind -> LowParse.Spec.Base.parser_kind
[]
LowParse.Spec.DepLen.parse_deplen_kind
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> hk: LowParse.Spec.Base.parser_kind -> pk: LowParse.Spec.Base.parser_kind -> LowParse.Spec.Base.parser_kind
{ "end_col": 57, "end_line": 172, "start_col": 2, "start_line": 172 }
Prims.GTot
val calc_tag_of_deplen_data (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (x: parse_deplen_data_t min max dlf ps) : GTot ht
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x
val calc_tag_of_deplen_data (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (x: parse_deplen_data_t min max dlf ps) : GTot ht let calc_tag_of_deplen_data (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (x: parse_deplen_data_t min max dlf ps) : GTot ht =
false
null
false
fst x
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "sometrivial" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Spec.DepLen.parse_deplen_data_t", "FStar.Pervasives.Native.fst" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps)
false
false
LowParse.Spec.DepLen.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 calc_tag_of_deplen_data (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (x: parse_deplen_data_t min max dlf ps) : GTot ht
[]
LowParse.Spec.DepLen.calc_tag_of_deplen_data
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> x: LowParse.Spec.DepLen.parse_deplen_data_t min max dlf ps -> Prims.GTot ht
{ "end_col": 7, "end_line": 67, "start_col": 2, "start_line": 67 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) }
let parse_deplen_data_t (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) =
false
null
false
x: (ht & pt){U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x))}
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "total" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "FStar.Pervasives.Native.tuple2", "Prims.eq2", "Prims.int", "Prims.l_or", "FStar.UInt.size", "FStar.UInt32.n", "Prims.op_GreaterThanOrEqual", "FStar.UInt32.v", "FStar.Pervasives.Native.fst", "FStar.Seq.Base.length", "LowParse.Bytes.byte", "LowParse.Spec.Base.serialize", "FStar.Pervasives.Native.snd" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt)
false
false
LowParse.Spec.DepLen.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 parse_deplen_data_t : min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> Type
[]
LowParse.Spec.DepLen.parse_deplen_data_t
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> Type
{ "end_col": 74, "end_line": 51, "start_col": 2, "start_line": 51 }
Prims.Tot
val parse_deplen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 parse_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) = parse_tagged_union hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps)
val parse_deplen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) let parse_deplen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) =
false
null
false
parse_tagged_union hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps)
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "total" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.serializer", "LowParse.Spec.Combinators.parse_tagged_union", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "LowParse.Spec.DepLen.parse_deplen_payload_kind", "LowParse.Spec.DepLen.parse_deplen_payload", "LowParse.Spec.DepLen.parse_deplen_kind" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input (* metadata for dependent length parser @min : @max : integer bounds @hk : header metadata @pk : payload metadata *) let parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind) (pk : parser_kind) = and_then_kind hk (parse_deplen_payload_kind min max pk) (* parse spec for dependent length structures *) let parse_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp)
false
false
LowParse.Spec.DepLen.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 parse_deplen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps))
[]
LowParse.Spec.DepLen.parse_deplen
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> hp: LowParse.Spec.Base.parser hk ht -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> LowParse.Spec.Base.parser (LowParse.Spec.DepLen.parse_deplen_kind min max hk pk) (LowParse.Spec.DepLen.parse_deplen_data_t min max dlf ps)
{ "end_col": 41, "end_line": 192, "start_col": 2, "start_line": 189 }
Prims.Tot
val serialize_deplen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp {hk.parser_kind_subkind == Some ParserStrong}) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (serializer (parse_deplen min max hp dlf ps))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 serialize_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp { hk.parser_kind_subkind == Some ParserStrong } ) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (serializer (parse_deplen min max hp dlf ps)) = serialize_tagged_union hs (calc_tag_of_deplen_data min max dlf ps) (serialize_deplen_payload min max dlf ps)
val serialize_deplen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp {hk.parser_kind_subkind == Some ParserStrong}) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (serializer (parse_deplen min max hp dlf ps)) let serialize_deplen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp {hk.parser_kind_subkind == Some ParserStrong}) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (serializer (parse_deplen min max hp dlf ps)) =
false
null
false
serialize_tagged_union hs (calc_tag_of_deplen_data min max dlf ps) (serialize_deplen_payload min max dlf ps)
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "total" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "Prims.eq2", "FStar.Pervasives.Native.option", "LowParse.Spec.Base.parser_subkind", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind", "FStar.Pervasives.Native.Some", "LowParse.Spec.Base.ParserStrong", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Combinators.serialize_tagged_union", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "LowParse.Spec.DepLen.parse_deplen_payload_kind", "LowParse.Spec.DepLen.parse_deplen_payload", "LowParse.Spec.DepLen.serialize_deplen_payload", "LowParse.Spec.DepLen.parse_deplen_kind", "LowParse.Spec.DepLen.parse_deplen" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input (* metadata for dependent length parser @min : @max : integer bounds @hk : header metadata @pk : payload metadata *) let parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind) (pk : parser_kind) = and_then_kind hk (parse_deplen_payload_kind min max pk) (* parse spec for dependent length structures *) let parse_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) = parse_tagged_union hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) (* This lemma says using the parser above is equivalent to using the header parser and then the deplen_payload parser *) let parse_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some(x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* a stronger version that further unfolds the payload *) let parse_deplen_unfold2 (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* serializer spec *) let synth_deplen_data_recip (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Tot (parse_fldata_strong_t ps (U32.v (dlf h))) = snd x let serialize_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (serializer (parse_deplen_payload min max dlf ps h)) = let sz = U32.v (dlf h) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_serializer (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) (fun _ -> ()) else serialize_weaken (parse_deplen_payload_kind min max pk) (serialize_synth (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) (serialize_fldata_strong ps sz) (synth_deplen_data_recip min max dlf ps h) () ) (* the lemma says serializing the payload from the data (header + payload) is the same as serializing only the payload *) let serialize_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Lemma (serialize (serialize_deplen_payload min max dlf ps h) input == serialize ps (synth_deplen_data_recip min max dlf ps h input)) = let sz = U32.v (dlf h) in serialize_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) (serialize_fldata_strong ps sz) (synth_deplen_data_recip min max dlf ps h) () input let serialize_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp { hk.parser_kind_subkind == Some ParserStrong } ) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp)
false
false
LowParse.Spec.DepLen.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 serialize_deplen (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp {hk.parser_kind_subkind == Some ParserStrong}) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (serializer (parse_deplen min max hp dlf ps))
[]
LowParse.Spec.DepLen.serialize_deplen
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> hs: LowParse.Spec.Base.serializer hp { Mkparser_kind'?.parser_kind_subkind hk == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong } -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> LowParse.Spec.Base.serializer (LowParse.Spec.DepLen.parse_deplen min max hp dlf ps)
{ "end_col": 45, "end_line": 382, "start_col": 2, "start_line": 379 }
FStar.Pervasives.Lemma
val serialize_deplen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp {hk.parser_kind_subkind == Some ParserStrong}) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: parse_deplen_data_t min max dlf ps) : Lemma (serialize (serialize_deplen min max hs dlf ps) input == (let sh = serialize hs (fst input) in let sp = serialize ps (snd input) in sh `Seq.append` sp))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 serialize_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp { hk.parser_kind_subkind == Some ParserStrong } ) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: parse_deplen_data_t min max dlf ps) : Lemma (serialize (serialize_deplen min max hs dlf ps) input == ( let sh = serialize hs (fst input) in let sp = serialize ps (snd input) in sh `Seq.append` sp )) = serialize_tagged_union_eq hs (calc_tag_of_deplen_data min max dlf ps) (serialize_deplen_payload min max dlf ps) input; let h : ht = calc_tag_of_deplen_data min max dlf ps input in serialize_deplen_payload_unfold min max dlf ps h input
val serialize_deplen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp {hk.parser_kind_subkind == Some ParserStrong}) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: parse_deplen_data_t min max dlf ps) : Lemma (serialize (serialize_deplen min max hs dlf ps) input == (let sh = serialize hs (fst input) in let sp = serialize ps (snd input) in sh `Seq.append` sp)) let serialize_deplen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp {hk.parser_kind_subkind == Some ParserStrong}) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: parse_deplen_data_t min max dlf ps) : Lemma (serialize (serialize_deplen min max hs dlf ps) input == (let sh = serialize hs (fst input) in let sp = serialize ps (snd input) in sh `Seq.append` sp)) =
false
null
true
serialize_tagged_union_eq hs (calc_tag_of_deplen_data min max dlf ps) (serialize_deplen_payload min max dlf ps) input; let h:ht = calc_tag_of_deplen_data min max dlf ps input in serialize_deplen_payload_unfold min max dlf ps h input
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "lemma" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "Prims.eq2", "FStar.Pervasives.Native.option", "LowParse.Spec.Base.parser_subkind", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind", "FStar.Pervasives.Native.Some", "LowParse.Spec.Base.ParserStrong", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.serialize_deplen_payload_unfold", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "Prims.unit", "LowParse.Spec.Combinators.serialize_tagged_union_eq", "LowParse.Spec.DepLen.parse_deplen_payload_kind", "LowParse.Spec.DepLen.parse_deplen_payload", "LowParse.Spec.DepLen.serialize_deplen_payload", "Prims.l_True", "Prims.squash", "FStar.Seq.Base.seq", "LowParse.Bytes.byte", "LowParse.Spec.Base.serialize", "LowParse.Spec.DepLen.parse_deplen_kind", "LowParse.Spec.DepLen.parse_deplen", "LowParse.Spec.DepLen.serialize_deplen", "FStar.Seq.Base.append", "LowParse.Bytes.bytes", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input (* metadata for dependent length parser @min : @max : integer bounds @hk : header metadata @pk : payload metadata *) let parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind) (pk : parser_kind) = and_then_kind hk (parse_deplen_payload_kind min max pk) (* parse spec for dependent length structures *) let parse_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) = parse_tagged_union hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) (* This lemma says using the parser above is equivalent to using the header parser and then the deplen_payload parser *) let parse_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some(x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* a stronger version that further unfolds the payload *) let parse_deplen_unfold2 (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* serializer spec *) let synth_deplen_data_recip (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Tot (parse_fldata_strong_t ps (U32.v (dlf h))) = snd x let serialize_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (serializer (parse_deplen_payload min max dlf ps h)) = let sz = U32.v (dlf h) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_serializer (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) (fun _ -> ()) else serialize_weaken (parse_deplen_payload_kind min max pk) (serialize_synth (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) (serialize_fldata_strong ps sz) (synth_deplen_data_recip min max dlf ps h) () ) (* the lemma says serializing the payload from the data (header + payload) is the same as serializing only the payload *) let serialize_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Lemma (serialize (serialize_deplen_payload min max dlf ps h) input == serialize ps (synth_deplen_data_recip min max dlf ps h input)) = let sz = U32.v (dlf h) in serialize_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) (serialize_fldata_strong ps sz) (synth_deplen_data_recip min max dlf ps h) () input let serialize_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp { hk.parser_kind_subkind == Some ParserStrong } ) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (serializer (parse_deplen min max hp dlf ps)) = serialize_tagged_union hs (calc_tag_of_deplen_data min max dlf ps) (serialize_deplen_payload min max dlf ps) (* the lemma says serializing the data is the same as first serializing the header then the payload *) let serialize_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp { hk.parser_kind_subkind == Some ParserStrong } ) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: parse_deplen_data_t min max dlf ps) : Lemma (serialize (serialize_deplen min max hs dlf ps) input == ( let sh = serialize hs (fst input) in let sp = serialize ps (snd input) in sh `Seq.append` sp
false
false
LowParse.Spec.DepLen.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 serialize_deplen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (#hp: parser hk ht) (hs: serializer hp {hk.parser_kind_subkind == Some ParserStrong}) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: parse_deplen_data_t min max dlf ps) : Lemma (serialize (serialize_deplen min max hs dlf ps) input == (let sh = serialize hs (fst input) in let sp = serialize ps (snd input) in sh `Seq.append` sp))
[]
LowParse.Spec.DepLen.serialize_deplen_unfold
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> hs: LowParse.Spec.Base.serializer hp { Mkparser_kind'?.parser_kind_subkind hk == FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong } -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> input: LowParse.Spec.DepLen.parse_deplen_data_t min max dlf ps -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.serialize (LowParse.Spec.DepLen.serialize_deplen min max hs dlf ps) input == (let sh = LowParse.Spec.Base.serialize hs (FStar.Pervasives.Native.fst input) in let sp = LowParse.Spec.Base.serialize ps (FStar.Pervasives.Native.snd input) in FStar.Seq.Base.append sh sp))
{ "end_col": 56, "end_line": 411, "start_col": 2, "start_line": 405 }
Prims.Tot
val parse_deplen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h)
val parse_deplen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) let parse_deplen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) =
false
null
false
let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || (match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) ((parse_fldata_strong ps sz) `parse_synth` (synth_deplen_data min max dlf ps h))
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "total" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Spec.Combinators.fail_parser", "LowParse.Spec.DepLen.parse_deplen_payload_kind", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "Prims.bool", "LowParse.Spec.Base.weaken", "LowParse.Spec.FLData.parse_fldata_kind", "LowParse.Spec.Combinators.parse_synth", "LowParse.Spec.FLData.parse_fldata_strong_t", "LowParse.Spec.FLData.parse_fldata_strong", "LowParse.Spec.DepLen.synth_deplen_data", "Prims.op_BarBar", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high", "FStar.UInt.uint_t", "FStar.UInt32.v" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht)
false
false
LowParse.Spec.DepLen.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 parse_deplen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h))
[]
LowParse.Spec.DepLen.parse_deplen_payload
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> h: ht -> LowParse.Spec.Base.parser (LowParse.Spec.DepLen.parse_deplen_payload_kind min max pk) (LowParse.Spec.Base.refine_with_tag (LowParse.Spec.DepLen.calc_tag_of_deplen_data min max dlf ps) h)
{ "end_col": 41, "end_line": 119, "start_col": 1, "start_line": 105 }
FStar.Pervasives.Lemma
val serialize_deplen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (input: refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Lemma (serialize (serialize_deplen_payload min max dlf ps h) input == serialize ps (synth_deplen_data_recip min max dlf ps h input))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 serialize_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Lemma (serialize (serialize_deplen_payload min max dlf ps h) input == serialize ps (synth_deplen_data_recip min max dlf ps h input)) = let sz = U32.v (dlf h) in serialize_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) (serialize_fldata_strong ps sz) (synth_deplen_data_recip min max dlf ps h) () input
val serialize_deplen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (input: refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Lemma (serialize (serialize_deplen_payload min max dlf ps h) input == serialize ps (synth_deplen_data_recip min max dlf ps h input)) let serialize_deplen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (input: refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Lemma (serialize (serialize_deplen_payload min max dlf ps h) input == serialize ps (synth_deplen_data_recip min max dlf ps h input)) =
false
null
true
let sz = U32.v (dlf h) in serialize_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) (serialize_fldata_strong ps sz) (synth_deplen_data_recip min max dlf ps h) () input
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "lemma" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "LowParse.Spec.Combinators.serialize_synth_eq", "LowParse.Spec.FLData.parse_fldata_kind", "LowParse.Spec.FLData.parse_fldata_strong_t", "LowParse.Spec.FLData.parse_fldata_strong", "LowParse.Spec.DepLen.synth_deplen_data", "LowParse.Spec.FLData.serialize_fldata_strong", "LowParse.Spec.DepLen.synth_deplen_data_recip", "FStar.UInt.uint_t", "FStar.UInt32.v", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "LowParse.Bytes.bytes", "LowParse.Spec.Base.serialize", "LowParse.Spec.DepLen.parse_deplen_payload_kind", "LowParse.Spec.DepLen.parse_deplen_payload", "LowParse.Spec.DepLen.serialize_deplen_payload", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input (* metadata for dependent length parser @min : @max : integer bounds @hk : header metadata @pk : payload metadata *) let parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind) (pk : parser_kind) = and_then_kind hk (parse_deplen_payload_kind min max pk) (* parse spec for dependent length structures *) let parse_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) = parse_tagged_union hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) (* This lemma says using the parser above is equivalent to using the header parser and then the deplen_payload parser *) let parse_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some(x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* a stronger version that further unfolds the payload *) let parse_deplen_unfold2 (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* serializer spec *) let synth_deplen_data_recip (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Tot (parse_fldata_strong_t ps (U32.v (dlf h))) = snd x let serialize_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (serializer (parse_deplen_payload min max dlf ps h)) = let sz = U32.v (dlf h) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_serializer (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) (fun _ -> ()) else serialize_weaken (parse_deplen_payload_kind min max pk) (serialize_synth (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) (serialize_fldata_strong ps sz) (synth_deplen_data_recip min max dlf ps h) () ) (* the lemma says serializing the payload from the data (header + payload) is the same as serializing only the payload *) let serialize_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Lemma
false
false
LowParse.Spec.DepLen.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 serialize_deplen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (input: refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Lemma (serialize (serialize_deplen_payload min max dlf ps h) input == serialize ps (synth_deplen_data_recip min max dlf ps h input))
[]
LowParse.Spec.DepLen.serialize_deplen_payload_unfold
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> h: ht -> input: LowParse.Spec.Base.refine_with_tag (LowParse.Spec.DepLen.calc_tag_of_deplen_data min max dlf ps) h -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.serialize (LowParse.Spec.DepLen.serialize_deplen_payload min max dlf ps h) input == LowParse.Spec.Base.serialize ps (LowParse.Spec.DepLen.synth_deplen_data_recip min max dlf ps h input))
{ "end_col": 9, "end_line": 364, "start_col": 1, "start_line": 357 }
Prims.Tot
val synth_deplen_data_recip (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (x: refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Tot (parse_fldata_strong_t ps (U32.v (dlf h)))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 synth_deplen_data_recip (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Tot (parse_fldata_strong_t ps (U32.v (dlf h))) = snd x
val synth_deplen_data_recip (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (x: refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Tot (parse_fldata_strong_t ps (U32.v (dlf h))) let synth_deplen_data_recip (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (x: refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Tot (parse_fldata_strong_t ps (U32.v (dlf h))) =
false
null
false
snd x
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "total" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "FStar.Pervasives.Native.snd", "LowParse.Spec.FLData.parse_fldata_strong_t", "FStar.UInt32.v" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input (* metadata for dependent length parser @min : @max : integer bounds @hk : header metadata @pk : payload metadata *) let parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind) (pk : parser_kind) = and_then_kind hk (parse_deplen_payload_kind min max pk) (* parse spec for dependent length structures *) let parse_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) = parse_tagged_union hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) (* This lemma says using the parser above is equivalent to using the header parser and then the deplen_payload parser *) let parse_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some(x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* a stronger version that further unfolds the payload *) let parse_deplen_unfold2 (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* serializer spec *) let synth_deplen_data_recip (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)
false
false
LowParse.Spec.DepLen.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 synth_deplen_data_recip (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (x: refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Tot (parse_fldata_strong_t ps (U32.v (dlf h)))
[]
LowParse.Spec.DepLen.synth_deplen_data_recip
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> h: ht -> x: LowParse.Spec.Base.refine_with_tag (LowParse.Spec.DepLen.calc_tag_of_deplen_data min max dlf ps) h -> LowParse.Spec.FLData.parse_fldata_strong_t ps (FStar.UInt32.v (dlf h))
{ "end_col": 7, "end_line": 309, "start_col": 2, "start_line": 309 }
Prims.Tot
val synth_deplen_data (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (x: parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x)
val synth_deplen_data (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (x: parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) let synth_deplen_data (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (x: parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) =
false
null
false
(h, x)
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "total" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Spec.FLData.parse_fldata_strong_t", "FStar.UInt32.v", "FStar.Pervasives.Native.Mktuple2", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h)))
false
false
LowParse.Spec.DepLen.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 synth_deplen_data (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (x: parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)
[]
LowParse.Spec.DepLen.synth_deplen_data
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> h: ht -> x: LowParse.Spec.FLData.parse_fldata_strong_t ps (FStar.UInt32.v (dlf h)) -> LowParse.Spec.Base.refine_with_tag (LowParse.Spec.DepLen.calc_tag_of_deplen_data min max dlf ps ) h
{ "end_col": 8, "end_line": 84, "start_col": 2, "start_line": 84 }
Prims.Tot
val serialize_deplen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) : Tot (serializer (parse_deplen_payload min max dlf ps h))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 serialize_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (serializer (parse_deplen_payload min max dlf ps h)) = let sz = U32.v (dlf h) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_serializer (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) (fun _ -> ()) else serialize_weaken (parse_deplen_payload_kind min max pk) (serialize_synth (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) (serialize_fldata_strong ps sz) (synth_deplen_data_recip min max dlf ps h) () )
val serialize_deplen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) : Tot (serializer (parse_deplen_payload min max dlf ps h)) let serialize_deplen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) : Tot (serializer (parse_deplen_payload min max dlf ps h)) =
false
null
false
let sz = U32.v (dlf h) in let bounds_off = pk.parser_kind_low > sz || (match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz) in if bounds_off then fail_serializer (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) (fun _ -> ()) else serialize_weaken (parse_deplen_payload_kind min max pk) (serialize_synth (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) (serialize_fldata_strong ps sz) (synth_deplen_data_recip min max dlf ps h) ())
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "total" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Spec.Combinators.fail_serializer", "LowParse.Spec.DepLen.parse_deplen_payload_kind", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "Prims.unit", "Prims.bool", "LowParse.Spec.Combinators.serialize_weaken", "LowParse.Spec.FLData.parse_fldata_kind", "LowParse.Spec.Combinators.parse_synth", "LowParse.Spec.FLData.parse_fldata_strong_t", "LowParse.Spec.FLData.parse_fldata_strong", "LowParse.Spec.DepLen.synth_deplen_data", "LowParse.Spec.Combinators.serialize_synth", "LowParse.Spec.FLData.serialize_fldata_strong", "LowParse.Spec.DepLen.synth_deplen_data_recip", "LowParse.Spec.DepLen.parse_deplen_payload", "Prims.op_BarBar", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high", "FStar.UInt.uint_t", "FStar.UInt32.v" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input (* metadata for dependent length parser @min : @max : integer bounds @hk : header metadata @pk : payload metadata *) let parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind) (pk : parser_kind) = and_then_kind hk (parse_deplen_payload_kind min max pk) (* parse spec for dependent length structures *) let parse_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) = parse_tagged_union hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) (* This lemma says using the parser above is equivalent to using the header parser and then the deplen_payload parser *) let parse_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some(x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* a stronger version that further unfolds the payload *) let parse_deplen_unfold2 (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* serializer spec *) let synth_deplen_data_recip (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) : Tot (parse_fldata_strong_t ps (U32.v (dlf h))) = snd x let serialize_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht)
false
false
LowParse.Spec.DepLen.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 serialize_deplen_payload (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) : Tot (serializer (parse_deplen_payload min max dlf ps h))
[]
LowParse.Spec.DepLen.serialize_deplen_payload
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> h: ht -> LowParse.Spec.Base.serializer (LowParse.Spec.DepLen.parse_deplen_payload min max dlf ps h)
{ "end_col": 7, "end_line": 340, "start_col": 1, "start_line": 322 }
FStar.Pervasives.Lemma
val parse_deplen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some (x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 parse_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some(x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz
val parse_deplen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some (x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None)) let parse_deplen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some (x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None)) =
false
null
true
parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "lemma" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.serializer", "LowParse.Bytes.bytes", "LowParse.Spec.Base.parse", "LowParse.Spec.Base.consumed_length", "FStar.Seq.Base.length", "LowParse.Bytes.byte", "Prims.op_Addition", "Prims.bool", "FStar.Seq.Properties.slice_slice", "Prims.unit", "FStar.UInt.uint_t", "FStar.UInt32.v", "LowParse.Spec.DepLen.parse_deplen_payload_unfold", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice", "LowParse.Spec.Combinators.parse_tagged_union_eq", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "LowParse.Spec.DepLen.parse_deplen_payload_kind", "LowParse.Spec.DepLen.parse_deplen_payload", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.DepLen.parse_deplen", "FStar.Pervasives.Native.None", "Prims.op_GreaterThan", "LowParse.Spec.Base.refine_with_tag", "Prims.op_Equality", "Prims.int", "Prims.l_or", "FStar.UInt.size", "FStar.UInt32.n", "Prims.op_GreaterThanOrEqual", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input (* metadata for dependent length parser @min : @max : integer bounds @hk : header metadata @pk : payload metadata *) let parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind) (pk : parser_kind) = and_then_kind hk (parse_deplen_payload_kind min max pk) (* parse spec for dependent length structures *) let parse_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) = parse_tagged_union hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) (* This lemma says using the parser above is equivalent to using the header parser and then the deplen_payload parser *) let parse_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some(x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None end)
false
false
LowParse.Spec.DepLen.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 parse_deplen_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some (x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None))
[]
LowParse.Spec.DepLen.parse_deplen_unfold
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> hp: LowParse.Spec.Base.parser hk ht -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.parse (LowParse.Spec.DepLen.parse_deplen min max hp dlf ps) input == (match LowParse.Spec.Base.parse hp input with | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ h consumed) -> (match FStar.UInt32.v (dlf h) + consumed > FStar.Seq.Base.length input with | true -> FStar.Pervasives.Native.None | _ -> let input' = FStar.Seq.Base.slice input consumed (FStar.Seq.Base.length input) in (match LowParse.Spec.Base.parse (LowParse.Spec.DepLen.parse_deplen_payload min max dlf ps h) input' with | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x consumed') -> (match consumed' = FStar.UInt32.v (dlf h) with | true -> FStar.Pervasives.Native.Some (x, consumed + FStar.UInt32.v (dlf h)) | _ -> FStar.Pervasives.Native.None) <: FStar.Pervasives.Native.option (LowParse.Spec.DepLen.parse_deplen_data_t min max dlf ps * LowParse.Spec.Base.consumed_length input)) <: FStar.Pervasives.Native.option (LowParse.Spec.DepLen.parse_deplen_data_t min max dlf ps * LowParse.Spec.Base.consumed_length input)) <: FStar.Pervasives.Native.option (LowParse.Spec.DepLen.parse_deplen_data_t min max dlf ps * LowParse.Spec.Base.consumed_length input)))
{ "end_col": 60, "end_line": 243, "start_col": 2, "start_line": 229 }
FStar.Pervasives.Lemma
val parse_deplen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed)))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input
val parse_deplen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) let parse_deplen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) =
false
null
true
let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || (match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "lemma" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Base.serializer", "LowParse.Bytes.bytes", "Prims.bool", "LowParse.Spec.Combinators.parse_synth_eq", "LowParse.Spec.FLData.parse_fldata_kind", "LowParse.Spec.FLData.parse_fldata_strong_t", "LowParse.Spec.Base.refine_with_tag", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "LowParse.Spec.FLData.parse_fldata_strong", "LowParse.Spec.DepLen.synth_deplen_data", "Prims.unit", "Prims.op_BarBar", "Prims.op_GreaterThan", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_low", "LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_high", "FStar.UInt.uint_t", "FStar.UInt32.v", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Base.consumed_length", "LowParse.Spec.Base.parse", "LowParse.Spec.DepLen.parse_deplen_payload", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None
false
false
LowParse.Spec.DepLen.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 parse_deplen_payload_unfold (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#ht #pt: Type) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pp: parser pk pt) (ps: serializer pp) (h: ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed)))
[]
LowParse.Spec.DepLen.parse_deplen_payload_unfold
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> h: ht -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.parse (LowParse.Spec.DepLen.parse_deplen_payload min max dlf ps h) input == (match LowParse.Spec.Base.parse (LowParse.Spec.FLData.parse_fldata_strong ps (FStar.UInt32.v (dlf h))) input with | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x consumed) -> FStar.Pervasives.Native.Some (LowParse.Spec.DepLen.synth_deplen_data min max dlf ps h x, consumed)))
{ "end_col": 12, "end_line": 157, "start_col": 2, "start_line": 143 }
FStar.Pervasives.Lemma
val parse_deplen_unfold2 (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None))
[ { "abbrev": true, "full_module": "FStar.Seq", "short_module": "Seq" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": false, "full_module": "LowParse.Spec.VLGen", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.AllIntegers", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec.Combinators", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "short_module": null }, { "abbrev": false, "full_module": "LowParse.Spec", "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 parse_deplen_unfold2 (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz
val parse_deplen_unfold2 (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None)) let parse_deplen_unfold2 (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None)) =
false
null
true
parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz
{ "checked_file": "LowParse.Spec.DepLen.fst.checked", "dependencies": [ "prims.fst.checked", "LowParse.Spec.VLGen.fst.checked", "LowParse.Spec.Combinators.fsti.checked", "LowParse.Spec.AllIntegers.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked" ], "interface_file": false, "source_file": "LowParse.Spec.DepLen.fst" }
[ "lemma" ]
[ "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.BoundedInt.bounded_int32", "LowParse.Spec.Base.serializer", "LowParse.Bytes.bytes", "LowParse.Spec.Base.parse", "LowParse.Spec.Base.consumed_length", "FStar.Seq.Base.length", "LowParse.Bytes.byte", "Prims.op_Addition", "Prims.bool", "FStar.Seq.Properties.slice_slice", "Prims.unit", "FStar.UInt.uint_t", "FStar.UInt32.v", "LowParse.Spec.DepLen.parse_deplen_payload_unfold", "FStar.Seq.Base.seq", "FStar.Seq.Base.slice", "LowParse.Spec.Combinators.parse_tagged_union_eq", "LowParse.Spec.DepLen.parse_deplen_data_t", "LowParse.Spec.DepLen.calc_tag_of_deplen_data", "LowParse.Spec.DepLen.parse_deplen_payload_kind", "LowParse.Spec.DepLen.parse_deplen_payload", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.DepLen.parse_deplen", "FStar.Pervasives.Native.None", "Prims.op_GreaterThan", "Prims.op_AmpAmp", "Prims.op_Equality", "Prims.int", "Prims.l_or", "Prims.op_GreaterThanOrEqual", "FStar.UInt.size", "FStar.UInt32.n", "LowParse.Spec.Base.serialize", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module LowParse.Spec.DepLen (* LowParse specification module for parsing structures with dependent length Example: struct { uint len; uint foo; uint buf[len]; }; *) include LowParse.Spec.Combinators include LowParse.Spec.AllIntegers include LowParse.Spec.VLGen module U32 = FStar.UInt32 module Seq = FStar.Seq (* arguments @min : @max : integer bounds @ht : header type @hk : header parser metadata @hp : header parser @h : header data @dlf : dependent length function @pt : payload type @pk : payload parser metadata @pp : payload parser @ps : payload serializer @x : data *) (* data type of the dependent length parser, which is a pair of the header and the payload *) let parse_deplen_data_t (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) = x:(ht & pt) {U32.v (dlf (fst x)) == Seq.length (serialize ps (snd x) ) } (* the tag for a piece of dependent length data is just its header *) let calc_tag_of_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (x : parse_deplen_data_t min max dlf ps) : GTot ht = fst x (* synth put the header and the payload together to get the data *) let synth_deplen_data (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (x : parse_fldata_strong_t ps (U32.v (dlf h))) : Tot (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) = (h, x) (* metadata of the payload, reuse bounded_vlgen_payload *) let parse_deplen_payload_kind = parse_bounded_vlgen_payload_kind (* parser spec for the dependent length payload which attaches the header to generate the data *) let parse_deplen_payload (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) : Tot (parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h)) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then fail_parser (parse_deplen_payload_kind min max pk) (refine_with_tag (calc_tag_of_deplen_data min max dlf ps) h) else weaken (parse_deplen_payload_kind min max pk) (parse_fldata_strong ps sz `parse_synth` synth_deplen_data min max dlf ps h) (* unfold is a more human readable version and do double-check of the definition This lemma says using the parser defined above is equivalent to using a fixed-length parser with the calculated size and then attach the header *) let parse_deplen_payload_unfold (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (#ht : Type) (#pt : Type) (dlf : ht -> Tot (bounded_int32 min max) ) (#pk : parser_kind) (#pp : parser pk pt) (ps : serializer pp) (h : ht) (input: bytes) : Lemma (parse (parse_deplen_payload min max dlf ps h) input == (match (parse (parse_fldata_strong ps (U32.v (dlf h))) input) with | None -> None | Some (x, consumed) -> Some (synth_deplen_data min max dlf ps h x, consumed))) = let sz = (U32.v (dlf h)) in let bounds_off = pk.parser_kind_low > sz || ( match pk.parser_kind_high with | None -> false | Some pkmax -> pkmax < sz ) in if bounds_off then () else parse_synth_eq (parse_fldata_strong ps sz) (synth_deplen_data min max dlf ps h) input (* metadata for dependent length parser @min : @max : integer bounds @hk : header metadata @pk : payload metadata *) let parse_deplen_kind (min : nat) (max : nat { min <= max /\ max < 4294967296 } ) (hk : parser_kind) (pk : parser_kind) = and_then_kind hk (parse_deplen_payload_kind min max pk) (* parse spec for dependent length structures *) let parse_deplen (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) : Tot (parser (parse_deplen_kind min max hk pk) (parse_deplen_data_t min max dlf ps)) = parse_tagged_union hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) (* This lemma says using the parser above is equivalent to using the header parser and then the deplen_payload parser *) let parse_deplen_unfold (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (Seq.length input) in match parse (parse_deplen_payload min max dlf ps h) input' with | None -> None | Some(x, consumed') -> if consumed' = U32.v (dlf h) then Some (x, consumed + (U32.v (dlf h))) else None end) ) = parse_tagged_union_eq hp (calc_tag_of_deplen_data min max dlf ps) (parse_deplen_payload min max dlf ps) input; match parse hp input with | None -> () | Some (h, consumed) -> let input' = Seq.slice input consumed (Seq.length input) in parse_deplen_payload_unfold min max dlf ps h input'; let sz = (U32.v (dlf h)) in if Seq.length input < consumed + sz then () else Seq.slice_slice input consumed (Seq.length input) 0 sz (* a stronger version that further unfolds the payload *) let parse_deplen_unfold2 (min: nat) (max: nat { min <= max /\ max < 4294967296 } ) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: ht -> Tot (bounded_int32 min max)) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input : bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> begin if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None end)
false
false
LowParse.Spec.DepLen.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 parse_deplen_unfold2 (min: nat) (max: nat{min <= max /\ max < 4294967296}) (#hk: parser_kind) (#ht: Type) (hp: parser hk ht) (dlf: (ht -> Tot (bounded_int32 min max))) (#pk: parser_kind) (#pt: Type) (#pp: parser pk pt) (ps: serializer pp) (input: bytes) : Lemma (parse (parse_deplen min max hp dlf ps) input == (match parse hp input with | None -> None | Some (h, consumed) -> if (U32.v (dlf h) + consumed) > (Seq.length input) then None else let input' = Seq.slice input consumed (U32.v (dlf h) + consumed) in match parse pp input' with | None -> None | Some (t, consumed') -> if consumed' = U32.v (dlf h) && Seq.length (serialize ps t) = consumed' then Some ((h, t), consumed + (U32.v (dlf h))) else None))
[]
LowParse.Spec.DepLen.parse_deplen_unfold2
{ "file_name": "src/lowparse/LowParse.Spec.DepLen.fst", "git_rev": "446a08ce38df905547cf20f28c43776b22b8087a", "git_url": "https://github.com/project-everest/everparse.git", "project_name": "everparse" }
min: Prims.nat -> max: Prims.nat{min <= max /\ max < 4294967296} -> hp: LowParse.Spec.Base.parser hk ht -> dlf: (_: ht -> LowParse.Spec.BoundedInt.bounded_int32 min max) -> ps: LowParse.Spec.Base.serializer pp -> input: LowParse.Bytes.bytes -> FStar.Pervasives.Lemma (ensures LowParse.Spec.Base.parse (LowParse.Spec.DepLen.parse_deplen min max hp dlf ps) input == (match LowParse.Spec.Base.parse hp input with | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ h consumed) -> (match FStar.UInt32.v (dlf h) + consumed > FStar.Seq.Base.length input with | true -> FStar.Pervasives.Native.None | _ -> let input' = FStar.Seq.Base.slice input consumed (FStar.UInt32.v (dlf h) + consumed) in (match LowParse.Spec.Base.parse pp input' with | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None | FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ t consumed') -> (match consumed' = FStar.UInt32.v (dlf h) && FStar.Seq.Base.length (LowParse.Spec.Base.serialize ps t) = consumed' with | true -> FStar.Pervasives.Native.Some (FStar.Pervasives.Native.Mktuple2 h t, consumed + FStar.UInt32.v (dlf h)) | _ -> FStar.Pervasives.Native.None) <: FStar.Pervasives.Native.option (LowParse.Spec.DepLen.parse_deplen_data_t min max dlf ps * LowParse.Spec.Base.consumed_length input)) <: FStar.Pervasives.Native.option (LowParse.Spec.DepLen.parse_deplen_data_t min max dlf ps * LowParse.Spec.Base.consumed_length input)) <: FStar.Pervasives.Native.option (LowParse.Spec.DepLen.parse_deplen_data_t min max dlf ps * LowParse.Spec.Base.consumed_length input)))
{ "end_col": 60, "end_line": 292, "start_col": 2, "start_line": 278 }
Prims.Tot
val repr (a:Type) (framed:bool) (pre:pre_t) (post:post_t a) (req:pure_pre) (ens:pure_post a) : Type u#2
[ { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Common", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "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 repr a framed pre post req ens : Type u#2 = Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ v _ -> ens v)
val repr (a:Type) (framed:bool) (pre:pre_t) (post:post_t a) (req:pure_pre) (ens:pure_post a) : Type u#2 let repr a framed pre post req ens : Type u#2 =
false
null
false
Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ v _ -> ens v)
{ "checked_file": "Steel.ST.Effect.fst.checked", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.Effect.Common.fsti.checked", "Steel.Effect.fst.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.Sugar.fsti.checked" ], "interface_file": true, "source_file": "Steel.ST.Effect.fst" }
[ "total" ]
[ "Prims.bool", "Steel.Effect.Common.pre_t", "Steel.Effect.Common.post_t", "Prims.pure_pre", "Prims.pure_post", "Steel.Effect.repr", "Steel.Effect.Common.rmem" ]
[]
(* 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.Effect friend Steel.Effect open Steel.Memory open FStar.Ghost module Mem = Steel.Memory module T = FStar.Tactics include Steel.Effect.Common open Steel.Effect #set-options "--warn_error -330" //turn off the experimental feature warning #set-options "--ide_id_info_off"
false
false
Steel.ST.Effect.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 repr (a:Type) (framed:bool) (pre:pre_t) (post:post_t a) (req:pure_pre) (ens:pure_post a) : Type u#2
[]
Steel.ST.Effect.repr
{ "file_name": "lib/steel/Steel.ST.Effect.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
a: Type -> framed: Prims.bool -> pre: Steel.Effect.Common.pre_t -> post: Steel.Effect.Common.post_t a -> req: Prims.pure_pre -> ens: Prims.pure_post a -> Type
{ "end_col": 73, "end_line": 29, "start_col": 2, "start_line": 29 }
FStar.Pervasives.Lemma
val equiv_star_emp_r (p: vprop) : Lemma ((p `star` emp) `equiv` p)
[ { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Common", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Common", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "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 equiv_star_emp_r (p:vprop) : Lemma ((p `star` emp) `equiv` p) = cm_identity p; assert ((emp `star` p) `equiv` p); star_commutative p emp; equiv_trans (p `star` emp) (emp `star` p) p
val equiv_star_emp_r (p: vprop) : Lemma ((p `star` emp) `equiv` p) let equiv_star_emp_r (p: vprop) : Lemma ((p `star` emp) `equiv` p) =
false
null
true
cm_identity p; assert ((emp `star` p) `equiv` p); star_commutative p emp; equiv_trans (p `star` emp) (emp `star` p) p
{ "checked_file": "Steel.ST.Effect.fst.checked", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.Effect.Common.fsti.checked", "Steel.Effect.fst.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.Sugar.fsti.checked" ], "interface_file": true, "source_file": "Steel.ST.Effect.fst" }
[ "lemma" ]
[ "Steel.Effect.Common.vprop", "Steel.Effect.Common.equiv_trans", "Steel.Effect.Common.star", "Steel.Effect.Common.emp", "Prims.unit", "Steel.Effect.Common.star_commutative", "Prims._assert", "Steel.Effect.Common.equiv", "Steel.Effect.Common.cm_identity", "Prims.l_True", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
(* 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.Effect friend Steel.Effect open Steel.Memory open FStar.Ghost module Mem = Steel.Memory module T = FStar.Tactics include Steel.Effect.Common open Steel.Effect #set-options "--warn_error -330" //turn off the experimental feature warning #set-options "--ide_id_info_off" let repr a framed pre post req ens : Type u#2 = Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ v _ -> ens v) let equiv_star_emp_r (p:vprop)
false
false
Steel.ST.Effect.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 equiv_star_emp_r (p: vprop) : Lemma ((p `star` emp) `equiv` p)
[]
Steel.ST.Effect.equiv_star_emp_r
{ "file_name": "lib/steel/Steel.ST.Effect.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
p: Steel.Effect.Common.vprop -> FStar.Pervasives.Lemma (ensures Steel.Effect.Common.equiv (Steel.Effect.Common.star p Steel.Effect.Common.emp) p)
{ "end_col": 47, "end_line": 36, "start_col": 4, "start_line": 33 }
Prims.Tot
val return_ (a:Type) (x:a) (#[@@@ framing_implicit] p:a -> vprop) : repr a true (return_pre (p x)) p True (fun v -> v == x)
[ { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Common", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "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 return_ (a:Type) (x:a) (#[@@@ framing_implicit] p:a -> vprop) : Tot (repr a true (return_pre (p x)) p True (fun v -> v == x)) = let k : Steel.Effect.repr a true (p x) p (fun _ -> True) (return_ens a x p) = Steel.Effect.return_ a x #p in weaken_repr _ _ _ _ _ _ _ _ k () ()
val return_ (a:Type) (x:a) (#[@@@ framing_implicit] p:a -> vprop) : repr a true (return_pre (p x)) p True (fun v -> v == x) let return_ (a: Type) (x: a) (#[@@@ framing_implicit]p: (a -> vprop)) : Tot (repr a true (return_pre (p x)) p True (fun v -> v == x)) =
false
null
false
let k:Steel.Effect.repr a true (p x) p (fun _ -> True) (return_ens a x p) = Steel.Effect.return_ a x #p in weaken_repr _ _ _ _ _ _ _ _ k () ()
{ "checked_file": "Steel.ST.Effect.fst.checked", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.Effect.Common.fsti.checked", "Steel.Effect.fst.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.Sugar.fsti.checked" ], "interface_file": true, "source_file": "Steel.ST.Effect.fst" }
[ "total" ]
[ "Steel.Effect.Common.vprop", "Steel.ST.Effect.weaken_repr", "Steel.Effect.Common.rmem'", "Steel.Effect.Common.valid_rmem", "Prims.l_True", "Steel.Effect.Common.rmem", "Steel.Effect.Common.return_pre", "Prims.l_and", "Prims.eq2", "FStar.Tactics.Effect.rewrite_with_tactic", "Steel.Effect.Common.frame_vc_norm", "Steel.Effect.Common.frame_equalities'", "Steel.Effect.Common.focus_rmem", "Steel.Effect.repr", "Steel.Effect.return_", "Steel.ST.Effect.repr" ]
[]
(* 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.Effect friend Steel.Effect open Steel.Memory open FStar.Ghost module Mem = Steel.Memory module T = FStar.Tactics include Steel.Effect.Common open Steel.Effect #set-options "--warn_error -330" //turn off the experimental feature warning #set-options "--ide_id_info_off" let repr a framed pre post req ens : Type u#2 = Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ v _ -> ens v) let equiv_star_emp_r (p:vprop) : Lemma ((p `star` emp) `equiv` p) = cm_identity p; assert ((emp `star` p) `equiv` p); star_commutative p emp; equiv_trans (p `star` emp) (emp `star` p) p let weaken_repr a framed (pre:pre_t) (post:post_t a) (req req':req_t pre) (ens ens':ens_t pre a post) (f:Steel.Effect.repr a framed pre post req ens) (_:squash (forall (h0:hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0))) (_:squash (forall (h0:hmem pre) x (h1:hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1))) : Tot (Steel.Effect.repr a framed pre post req' ens') = let focus_rmem_refl (r:vprop) (h:rmem r) : Lemma (ensures focus_rmem #r h r == h) [SMTPat (focus_rmem #r h r)] = focus_rmem_refl r h in let equiv_trans (x y z:vprop) : Lemma (requires equiv x y /\ equiv y z) (ensures equiv x z) [SMTPat (equiv x z); SMTPat (equiv x y)] = equiv_trans x y z in let cbs (p:vprop) : Lemma (p `can_be_split` (p `star` emp)) [SMTPat (p `can_be_split` (p `star` emp))] = star_commutative p emp; cm_identity p; equiv_sym (p `star` emp) p; equiv_can_be_split p (p `star` emp) in let epost () : Lemma (equiv_forall post (fun x -> star (post x) emp)) = introduce forall x. post x `equiv` (post x `star` emp) with ( equiv_star_emp_r (post x); equiv_sym (post x `star` emp) (post x) ); equiv_forall_elim post (fun x -> star (post x) emp) in epost (); Steel.Effect.subcomp_opaque a #framed #framed #pre #post #req #ens #pre #post #req' #ens' #emp #True #() #() #() f let return_ (a:Type) (x:a) (#[@@@ framing_implicit] p:a -> vprop)
false
false
Steel.ST.Effect.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 return_ (a:Type) (x:a) (#[@@@ framing_implicit] p:a -> vprop) : repr a true (return_pre (p x)) p True (fun v -> v == x)
[]
Steel.ST.Effect.return_
{ "file_name": "lib/steel/Steel.ST.Effect.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
a: Type -> x: a -> Steel.ST.Effect.repr a true (Steel.Effect.Common.return_pre (p x)) p Prims.l_True (fun v -> v == x)
{ "end_col": 39, "end_line": 107, "start_col": 3, "start_line": 100 }
Prims.Tot
val weaken_repr: a: _ -> framed: _ -> pre: pre_t -> post: post_t a -> req: req_t pre -> req': req_t pre -> ens: ens_t pre a post -> ens': ens_t pre a post -> f: Steel.Effect.repr a framed pre post req ens -> squash (forall (h0: hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0)) -> squash (forall (h0: hmem pre) x (h1: hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1)) -> Tot (Steel.Effect.repr a framed pre post req' ens')
[ { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Common", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Common", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "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 weaken_repr a framed (pre:pre_t) (post:post_t a) (req req':req_t pre) (ens ens':ens_t pre a post) (f:Steel.Effect.repr a framed pre post req ens) (_:squash (forall (h0:hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0))) (_:squash (forall (h0:hmem pre) x (h1:hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1))) : Tot (Steel.Effect.repr a framed pre post req' ens') = let focus_rmem_refl (r:vprop) (h:rmem r) : Lemma (ensures focus_rmem #r h r == h) [SMTPat (focus_rmem #r h r)] = focus_rmem_refl r h in let equiv_trans (x y z:vprop) : Lemma (requires equiv x y /\ equiv y z) (ensures equiv x z) [SMTPat (equiv x z); SMTPat (equiv x y)] = equiv_trans x y z in let cbs (p:vprop) : Lemma (p `can_be_split` (p `star` emp)) [SMTPat (p `can_be_split` (p `star` emp))] = star_commutative p emp; cm_identity p; equiv_sym (p `star` emp) p; equiv_can_be_split p (p `star` emp) in let epost () : Lemma (equiv_forall post (fun x -> star (post x) emp)) = introduce forall x. post x `equiv` (post x `star` emp) with ( equiv_star_emp_r (post x); equiv_sym (post x `star` emp) (post x) ); equiv_forall_elim post (fun x -> star (post x) emp) in epost (); Steel.Effect.subcomp_opaque a #framed #framed #pre #post #req #ens #pre #post #req' #ens' #emp #True #() #() #() f
val weaken_repr: a: _ -> framed: _ -> pre: pre_t -> post: post_t a -> req: req_t pre -> req': req_t pre -> ens: ens_t pre a post -> ens': ens_t pre a post -> f: Steel.Effect.repr a framed pre post req ens -> squash (forall (h0: hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0)) -> squash (forall (h0: hmem pre) x (h1: hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1)) -> Tot (Steel.Effect.repr a framed pre post req' ens') let weaken_repr a framed (pre: pre_t) (post: post_t a) (req: req_t pre) (req': req_t pre) (ens: ens_t pre a post) (ens': ens_t pre a post) (f: Steel.Effect.repr a framed pre post req ens) (_: squash (forall (h0: hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0))) (_: squash (forall (h0: hmem pre) x (h1: hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1))) : Tot (Steel.Effect.repr a framed pre post req' ens') =
false
null
false
let focus_rmem_refl (r: vprop) (h: rmem r) : Lemma (ensures focus_rmem #r h r == h) [SMTPat (focus_rmem #r h r)] = focus_rmem_refl r h in let equiv_trans (x y z: vprop) : Lemma (requires equiv x y /\ equiv y z) (ensures equiv x z) [SMTPat (equiv x z); SMTPat (equiv x y)] = equiv_trans x y z in let cbs (p: vprop) : Lemma (p `can_be_split` (p `star` emp)) [SMTPat (p `can_be_split` (p `star` emp))] = star_commutative p emp; cm_identity p; equiv_sym (p `star` emp) p; equiv_can_be_split p (p `star` emp) in let epost () : Lemma (equiv_forall post (fun x -> star (post x) emp)) = introduce forall x . (post x) `equiv` ((post x) `star` emp) with (equiv_star_emp_r (post x); equiv_sym ((post x) `star` emp) (post x)); equiv_forall_elim post (fun x -> star (post x) emp) in epost (); Steel.Effect.subcomp_opaque a #framed #framed #pre #post #req #ens #pre #post #req' #ens' #emp #True #() #() #() f
{ "checked_file": "Steel.ST.Effect.fst.checked", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.Effect.Common.fsti.checked", "Steel.Effect.fst.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.Sugar.fsti.checked" ], "interface_file": true, "source_file": "Steel.ST.Effect.fst" }
[ "total" ]
[ "Prims.bool", "Steel.Effect.Common.pre_t", "Steel.Effect.Common.post_t", "Steel.Effect.Common.req_t", "Steel.Effect.Common.ens_t", "Steel.Effect.repr", "Prims.squash", "Prims.l_Forall", "Steel.Effect.Common.hmem", "Prims.l_imp", "Steel.Effect.Common.mk_rmem", "Steel.Effect.subcomp_opaque", "Steel.Effect.Common.emp", "Prims.l_True", "Prims.unit", "Steel.Effect.Common.equiv_forall", "Steel.Effect.Common.star", "Steel.Effect.Common.vprop", "Prims.Nil", "FStar.Pervasives.pattern", "Steel.Effect.Common.equiv_forall_elim", "FStar.Classical.Sugar.forall_intro", "Steel.Effect.Common.equiv", "Steel.Effect.Common.equiv_sym", "Steel.ST.Effect.equiv_star_emp_r", "Steel.Effect.Common.can_be_split", "Prims.Cons", "FStar.Pervasives.smt_pat", "Steel.Effect.Common.equiv_can_be_split", "Steel.Effect.Common.cm_identity", "Steel.Effect.Common.star_commutative", "Prims.l_and", "Prims.prop", "Steel.Effect.Common.equiv_trans", "Steel.Effect.Common.rmem'", "Steel.Effect.Common.valid_rmem", "Prims.eq2", "Steel.Effect.Common.focus_rmem", "Steel.Effect.Common.rmem", "Steel.Effect.Common.focus_rmem_refl" ]
[]
(* 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.Effect friend Steel.Effect open Steel.Memory open FStar.Ghost module Mem = Steel.Memory module T = FStar.Tactics include Steel.Effect.Common open Steel.Effect #set-options "--warn_error -330" //turn off the experimental feature warning #set-options "--ide_id_info_off" let repr a framed pre post req ens : Type u#2 = Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ v _ -> ens v) let equiv_star_emp_r (p:vprop) : Lemma ((p `star` emp) `equiv` p) = cm_identity p; assert ((emp `star` p) `equiv` p); star_commutative p emp; equiv_trans (p `star` emp) (emp `star` p) p let weaken_repr a framed (pre:pre_t) (post:post_t a) (req req':req_t pre) (ens ens':ens_t pre a post) (f:Steel.Effect.repr a framed pre post req ens) (_:squash (forall (h0:hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0))) (_:squash (forall (h0:hmem pre) x (h1:hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1)))
false
false
Steel.ST.Effect.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 weaken_repr: a: _ -> framed: _ -> pre: pre_t -> post: post_t a -> req: req_t pre -> req': req_t pre -> ens: ens_t pre a post -> ens': ens_t pre a post -> f: Steel.Effect.repr a framed pre post req ens -> squash (forall (h0: hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0)) -> squash (forall (h0: hmem pre) x (h1: hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1)) -> Tot (Steel.Effect.repr a framed pre post req' ens')
[]
Steel.ST.Effect.weaken_repr
{ "file_name": "lib/steel/Steel.ST.Effect.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
a: Type -> framed: Prims.bool -> pre: Steel.Effect.Common.pre_t -> post: Steel.Effect.Common.post_t a -> req: Steel.Effect.Common.req_t pre -> req': Steel.Effect.Common.req_t pre -> ens: Steel.Effect.Common.ens_t pre a post -> ens': Steel.Effect.Common.ens_t pre a post -> f: Steel.Effect.repr a framed pre post req ens -> _: Prims.squash (forall (h0: Steel.Effect.Common.hmem pre). req' (Steel.Effect.Common.mk_rmem pre h0) ==> req (Steel.Effect.Common.mk_rmem pre h0)) -> _: Prims.squash (forall (h0: Steel.Effect.Common.hmem pre) (x: a) (h1: Steel.Effect.Common.hmem (post x)). ens (Steel.Effect.Common.mk_rmem pre h0) x (Steel.Effect.Common.mk_rmem (post x) h1) ==> ens' (Steel.Effect.Common.mk_rmem pre h0) x (Steel.Effect.Common.mk_rmem (post x) h1)) -> Steel.Effect.repr a framed pre post req' ens'
{ "end_col": 26, "end_line": 93, "start_col": 3, "start_line": 53 }
Prims.Pure
val subcomp (a:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:pure_pre) (#[@@@ framing_implicit] ens_f:pure_post a) (#[@@@ framing_implicit] pre_g:pre_t) (#[@@@ framing_implicit] post_g:post_t a) (#[@@@ framing_implicit] req_g:pure_pre) (#[@@@ framing_implicit] ens_g:pure_post a) (#[@@@ framing_implicit] frame:vprop) (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame)) (#[@@@ framing_implicit] p1:squash (can_be_split pre_g (pre_f `star` frame))) (#[@@@ framing_implicit] p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame))) (f:repr a framed_f pre_f post_f req_f ens_f) : Pure (repr a framed_g pre_g post_g req_g ens_g) (requires req_g ==> (req_f /\ (forall x. ens_f x ==> ens_g x))) (ensures fun _ -> True)
[ { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Common", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "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 subcomp (a:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:Type0) (#[@@@ framing_implicit] ens_f:a -> Type0) (#[@@@ framing_implicit] pre_g:pre_t) (#[@@@ framing_implicit] post_g:post_t a) (#[@@@ framing_implicit] req_g:Type0) (#[@@@ framing_implicit] ens_g:a -> Type0) (#[@@@ framing_implicit] frame:vprop) (#[@@@ framing_implicit] _x1 : squash (maybe_emp framed_f frame)) (#[@@@ framing_implicit] p1:squash ( can_be_split pre_g (pre_f `star` frame))) (#[@@@ framing_implicit] p2:squash ( equiv_forall post_g (fun x -> post_f x `star` frame))) (f:repr a framed_f pre_f post_f req_f ens_f) : Pure (repr a framed_g pre_g post_g req_g ens_g) (requires req_g ==> (req_f /\ (forall x. ens_f x ==> ens_g x))) (ensures fun _ -> True) = weaken_repr _ _ _ _ _ _ _ _ (Steel.Effect.subcomp a #framed_f #framed_g #pre_f #post_f #(fun _ -> req_f) #(fun _ x _ -> ens_f x) #pre_g #post_g #(fun _ -> req_g) #(fun _ x _ -> ens_g x) #frame #_x1 #True #p1 #p2 f) () ()
val subcomp (a:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:pure_pre) (#[@@@ framing_implicit] ens_f:pure_post a) (#[@@@ framing_implicit] pre_g:pre_t) (#[@@@ framing_implicit] post_g:post_t a) (#[@@@ framing_implicit] req_g:pure_pre) (#[@@@ framing_implicit] ens_g:pure_post a) (#[@@@ framing_implicit] frame:vprop) (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame)) (#[@@@ framing_implicit] p1:squash (can_be_split pre_g (pre_f `star` frame))) (#[@@@ framing_implicit] p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame))) (f:repr a framed_f pre_f post_f req_f ens_f) : Pure (repr a framed_g pre_g post_g req_g ens_g) (requires req_g ==> (req_f /\ (forall x. ens_f x ==> ens_g x))) (ensures fun _ -> True) let subcomp (a: Type) (#framed_f #framed_g: eqtype_as_type bool) (#[@@@ framing_implicit]pre_f: pre_t) (#[@@@ framing_implicit]post_f: post_t a) (#[@@@ framing_implicit]req_f: Type0) (#[@@@ framing_implicit]ens_f: (a -> Type0)) (#[@@@ framing_implicit]pre_g: pre_t) (#[@@@ framing_implicit]post_g: post_t a) (#[@@@ framing_implicit]req_g: Type0) (#[@@@ framing_implicit]ens_g: (a -> Type0)) (#[@@@ framing_implicit]frame: vprop) (#[@@@ framing_implicit]_x1: squash (maybe_emp framed_f frame)) (#[@@@ framing_implicit]p1: squash (can_be_split pre_g (pre_f `star` frame))) (#[@@@ framing_implicit]p2: squash (equiv_forall post_g (fun x -> (post_f x) `star` frame))) (f: repr a framed_f pre_f post_f req_f ens_f) : Pure (repr a framed_g pre_g post_g req_g ens_g) (requires req_g ==> (req_f /\ (forall x. ens_f x ==> ens_g x))) (ensures fun _ -> True) =
false
null
false
weaken_repr _ _ _ _ _ _ _ _ (Steel.Effect.subcomp a #framed_f #framed_g #pre_f #post_f #(fun _ -> req_f) #(fun _ x _ -> ens_f x) #pre_g #post_g #(fun _ -> req_g) #(fun _ x _ -> ens_g x) #frame #_x1 #True #p1 #p2 f) () ()
{ "checked_file": "Steel.ST.Effect.fst.checked", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.Effect.Common.fsti.checked", "Steel.Effect.fst.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.Sugar.fsti.checked" ], "interface_file": true, "source_file": "Steel.ST.Effect.fst" }
[]
[ "FStar.Pervasives.eqtype_as_type", "Prims.bool", "Steel.Effect.Common.pre_t", "Steel.Effect.Common.post_t", "Steel.Effect.Common.vprop", "Prims.squash", "Steel.Effect.Common.maybe_emp", "Steel.Effect.Common.can_be_split", "Steel.Effect.Common.star", "Steel.Effect.Common.equiv_forall", "Steel.ST.Effect.repr", "Steel.ST.Effect.weaken_repr", "Steel.Effect.Common.rmem", "Steel.Effect.subcomp", "Prims.l_True", "Prims.l_imp", "Prims.l_and", "Prims.l_Forall" ]
[]
(* 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.Effect friend Steel.Effect open Steel.Memory open FStar.Ghost module Mem = Steel.Memory module T = FStar.Tactics include Steel.Effect.Common open Steel.Effect #set-options "--warn_error -330" //turn off the experimental feature warning #set-options "--ide_id_info_off" let repr a framed pre post req ens : Type u#2 = Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ v _ -> ens v) let equiv_star_emp_r (p:vprop) : Lemma ((p `star` emp) `equiv` p) = cm_identity p; assert ((emp `star` p) `equiv` p); star_commutative p emp; equiv_trans (p `star` emp) (emp `star` p) p let weaken_repr a framed (pre:pre_t) (post:post_t a) (req req':req_t pre) (ens ens':ens_t pre a post) (f:Steel.Effect.repr a framed pre post req ens) (_:squash (forall (h0:hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0))) (_:squash (forall (h0:hmem pre) x (h1:hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1))) : Tot (Steel.Effect.repr a framed pre post req' ens') = let focus_rmem_refl (r:vprop) (h:rmem r) : Lemma (ensures focus_rmem #r h r == h) [SMTPat (focus_rmem #r h r)] = focus_rmem_refl r h in let equiv_trans (x y z:vprop) : Lemma (requires equiv x y /\ equiv y z) (ensures equiv x z) [SMTPat (equiv x z); SMTPat (equiv x y)] = equiv_trans x y z in let cbs (p:vprop) : Lemma (p `can_be_split` (p `star` emp)) [SMTPat (p `can_be_split` (p `star` emp))] = star_commutative p emp; cm_identity p; equiv_sym (p `star` emp) p; equiv_can_be_split p (p `star` emp) in let epost () : Lemma (equiv_forall post (fun x -> star (post x) emp)) = introduce forall x. post x `equiv` (post x `star` emp) with ( equiv_star_emp_r (post x); equiv_sym (post x `star` emp) (post x) ); equiv_forall_elim post (fun x -> star (post x) emp) in epost (); Steel.Effect.subcomp_opaque a #framed #framed #pre #post #req #ens #pre #post #req' #ens' #emp #True #() #() #() f let return_ (a:Type) (x:a) (#[@@@ framing_implicit] p:a -> vprop) : Tot (repr a true (return_pre (p x)) p True (fun v -> v == x)) = let k : Steel.Effect.repr a true (p x) p (fun _ -> True) (return_ens a x p) = Steel.Effect.return_ a x #p in weaken_repr _ _ _ _ _ _ _ _ k () () let bind (a:Type) (b:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:Type0) (#[@@@ framing_implicit] ens_f:a -> Type0) (#[@@@ framing_implicit] pre_g:a -> pre_t) (#[@@@ framing_implicit] post_g:a -> post_t b) (#[@@@ framing_implicit] req_g:(a -> Type0)) (#[@@@ framing_implicit] ens_g:(a -> b -> Type0)) (#[@@@ framing_implicit] frame_f:vprop) (#[@@@ framing_implicit] frame_g:a -> vprop) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] _x1: squash (maybe_emp framed_f frame_f)) (#[@@@ framing_implicit] _x2: squash (maybe_emp_dep framed_g frame_g)) (#[@@@ framing_implicit] pr:a -> prop) (#[@@@ framing_implicit] p1:squash (can_be_split_forall_dep pr (fun x -> post_f x `star` frame_f) (fun x -> pre_g x `star` frame_g x))) (#[@@@ framing_implicit] p2:squash (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post)) (f:repr a framed_f pre_f post_f req_f ens_f) (g:(x:a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x))) = let c = Steel.Effect.bind a b #framed_f #framed_g #pre_f #post_f #(fun _ -> req_f) #(fun _ x _ -> ens_f x) #pre_g #post_g #(fun x _ -> req_g x) #(fun x _ y _ -> ens_g x y) #frame_f #frame_g #post #_x1 #_x2 #pr #p1 #p2 f g in weaken_repr _ _ _ _ _ _ _ _ c () () let subcomp (a:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:Type0) (#[@@@ framing_implicit] ens_f:a -> Type0) (#[@@@ framing_implicit] pre_g:pre_t) (#[@@@ framing_implicit] post_g:post_t a) (#[@@@ framing_implicit] req_g:Type0) (#[@@@ framing_implicit] ens_g:a -> Type0) (#[@@@ framing_implicit] frame:vprop) (#[@@@ framing_implicit] _x1 : squash (maybe_emp framed_f frame)) (#[@@@ framing_implicit] p1:squash ( can_be_split pre_g (pre_f `star` frame))) (#[@@@ framing_implicit] p2:squash ( equiv_forall post_g (fun x -> post_f x `star` frame))) (f:repr a framed_f pre_f post_f req_f ens_f) : Pure (repr a framed_g pre_g post_g req_g ens_g) (requires req_g ==> (req_f /\ (forall x. ens_f x ==> ens_g x)))
false
false
Steel.ST.Effect.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 subcomp (a:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:pure_pre) (#[@@@ framing_implicit] ens_f:pure_post a) (#[@@@ framing_implicit] pre_g:pre_t) (#[@@@ framing_implicit] post_g:post_t a) (#[@@@ framing_implicit] req_g:pure_pre) (#[@@@ framing_implicit] ens_g:pure_post a) (#[@@@ framing_implicit] frame:vprop) (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame)) (#[@@@ framing_implicit] p1:squash (can_be_split pre_g (pre_f `star` frame))) (#[@@@ framing_implicit] p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame))) (f:repr a framed_f pre_f post_f req_f ens_f) : Pure (repr a framed_g pre_g post_g req_g ens_g) (requires req_g ==> (req_f /\ (forall x. ens_f x ==> ens_g x))) (ensures fun _ -> True)
[]
Steel.ST.Effect.subcomp
{ "file_name": "lib/steel/Steel.ST.Effect.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
a: Type -> f: Steel.ST.Effect.repr a framed_f pre_f post_f req_f ens_f -> Prims.Pure (Steel.ST.Effect.repr a framed_g pre_g post_g req_g ens_g)
{ "end_col": 27, "end_line": 196, "start_col": 6, "start_line": 177 }
Prims.Tot
val bind_pure_st_ (a:Type) (b:Type) (#[@@@ framing_implicit] wp:pure_wp a) (#framed:eqtype_as_type bool) (#[@@@ framing_implicit] pre:pre_t) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] req:a -> pure_pre) (#[@@@ framing_implicit] ens:a -> pure_post b) (f:eqtype_as_type unit -> PURE a wp) (g:(x:a -> repr b framed pre post (req x) (ens x))) : repr b framed pre post (bind_pure_st_req wp req) (bind_pure_st_ens wp ens)
[ { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Common", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "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 bind_pure_st_ (a:Type) (b:Type) (#[@@@ framing_implicit] wp:pure_wp a) (#framed:eqtype_as_type bool) (#[@@@ framing_implicit] pre:pre_t) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] req:a -> Type0) (#[@@@ framing_implicit] ens:a -> b -> Type0) (f:eqtype_as_type unit -> PURE a wp) (g:(x:a -> repr b framed pre post (req x) (ens x))) : repr b framed pre post (bind_pure_st_req wp req) (bind_pure_st_ens wp ens) = let c : Steel.Effect.repr b framed pre post (bind_pure_steel__req wp (fun x _ -> req x)) (bind_pure_steel__ens wp (fun x _ y _ -> ens x y)) =(Steel.Effect.bind_pure_steel_ a b #wp #framed #pre #post #(fun x _ -> req x) #(fun x _ y _ -> ens x y) f g) in FStar.Monotonic.Pure.elim_pure_wp_monotonicity #a wp; weaken_repr _ _ _ _ _ _ _ _ c () ()
val bind_pure_st_ (a:Type) (b:Type) (#[@@@ framing_implicit] wp:pure_wp a) (#framed:eqtype_as_type bool) (#[@@@ framing_implicit] pre:pre_t) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] req:a -> pure_pre) (#[@@@ framing_implicit] ens:a -> pure_post b) (f:eqtype_as_type unit -> PURE a wp) (g:(x:a -> repr b framed pre post (req x) (ens x))) : repr b framed pre post (bind_pure_st_req wp req) (bind_pure_st_ens wp ens) let bind_pure_st_ (a b: Type) (#[@@@ framing_implicit]wp: pure_wp a) (#framed: eqtype_as_type bool) (#[@@@ framing_implicit]pre: pre_t) (#[@@@ framing_implicit]post: post_t b) (#[@@@ framing_implicit]req: (a -> Type0)) (#[@@@ framing_implicit]ens: (a -> b -> Type0)) (f: (eqtype_as_type unit -> PURE a wp)) (g: (x: a -> repr b framed pre post (req x) (ens x))) : repr b framed pre post (bind_pure_st_req wp req) (bind_pure_st_ens wp ens) =
false
null
false
let c:Steel.Effect.repr b framed pre post (bind_pure_steel__req wp (fun x _ -> req x)) (bind_pure_steel__ens wp (fun x _ y _ -> ens x y)) = (Steel.Effect.bind_pure_steel_ a b #wp #framed #pre #post #(fun x _ -> req x) #(fun x _ y _ -> ens x y) f g) in FStar.Monotonic.Pure.elim_pure_wp_monotonicity #a wp; weaken_repr _ _ _ _ _ _ _ _ c () ()
{ "checked_file": "Steel.ST.Effect.fst.checked", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.Effect.Common.fsti.checked", "Steel.Effect.fst.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.Sugar.fsti.checked" ], "interface_file": true, "source_file": "Steel.ST.Effect.fst" }
[ "total" ]
[ "Prims.pure_wp", "FStar.Pervasives.eqtype_as_type", "Prims.bool", "Steel.Effect.Common.pre_t", "Steel.Effect.Common.post_t", "Prims.unit", "Steel.ST.Effect.repr", "Steel.ST.Effect.weaken_repr", "Steel.Effect.Common.rmem'", "Steel.Effect.Common.valid_rmem", "Prims.l_True", "Steel.Effect.Common.rmem", "Steel.ST.Effect.bind_pure_st_req", "Prims.l_and", "Prims.l_Exists", "Prims.l_not", "Prims.eq2", "Steel.ST.Effect.bind_pure_st_ens", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "Steel.Effect.repr", "Steel.Effect.bind_pure_steel_" ]
[]
(* 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.Effect friend Steel.Effect open Steel.Memory open FStar.Ghost module Mem = Steel.Memory module T = FStar.Tactics include Steel.Effect.Common open Steel.Effect #set-options "--warn_error -330" //turn off the experimental feature warning #set-options "--ide_id_info_off" let repr a framed pre post req ens : Type u#2 = Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ v _ -> ens v) let equiv_star_emp_r (p:vprop) : Lemma ((p `star` emp) `equiv` p) = cm_identity p; assert ((emp `star` p) `equiv` p); star_commutative p emp; equiv_trans (p `star` emp) (emp `star` p) p let weaken_repr a framed (pre:pre_t) (post:post_t a) (req req':req_t pre) (ens ens':ens_t pre a post) (f:Steel.Effect.repr a framed pre post req ens) (_:squash (forall (h0:hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0))) (_:squash (forall (h0:hmem pre) x (h1:hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1))) : Tot (Steel.Effect.repr a framed pre post req' ens') = let focus_rmem_refl (r:vprop) (h:rmem r) : Lemma (ensures focus_rmem #r h r == h) [SMTPat (focus_rmem #r h r)] = focus_rmem_refl r h in let equiv_trans (x y z:vprop) : Lemma (requires equiv x y /\ equiv y z) (ensures equiv x z) [SMTPat (equiv x z); SMTPat (equiv x y)] = equiv_trans x y z in let cbs (p:vprop) : Lemma (p `can_be_split` (p `star` emp)) [SMTPat (p `can_be_split` (p `star` emp))] = star_commutative p emp; cm_identity p; equiv_sym (p `star` emp) p; equiv_can_be_split p (p `star` emp) in let epost () : Lemma (equiv_forall post (fun x -> star (post x) emp)) = introduce forall x. post x `equiv` (post x `star` emp) with ( equiv_star_emp_r (post x); equiv_sym (post x `star` emp) (post x) ); equiv_forall_elim post (fun x -> star (post x) emp) in epost (); Steel.Effect.subcomp_opaque a #framed #framed #pre #post #req #ens #pre #post #req' #ens' #emp #True #() #() #() f let return_ (a:Type) (x:a) (#[@@@ framing_implicit] p:a -> vprop) : Tot (repr a true (return_pre (p x)) p True (fun v -> v == x)) = let k : Steel.Effect.repr a true (p x) p (fun _ -> True) (return_ens a x p) = Steel.Effect.return_ a x #p in weaken_repr _ _ _ _ _ _ _ _ k () () let bind (a:Type) (b:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:Type0) (#[@@@ framing_implicit] ens_f:a -> Type0) (#[@@@ framing_implicit] pre_g:a -> pre_t) (#[@@@ framing_implicit] post_g:a -> post_t b) (#[@@@ framing_implicit] req_g:(a -> Type0)) (#[@@@ framing_implicit] ens_g:(a -> b -> Type0)) (#[@@@ framing_implicit] frame_f:vprop) (#[@@@ framing_implicit] frame_g:a -> vprop) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] _x1: squash (maybe_emp framed_f frame_f)) (#[@@@ framing_implicit] _x2: squash (maybe_emp_dep framed_g frame_g)) (#[@@@ framing_implicit] pr:a -> prop) (#[@@@ framing_implicit] p1:squash (can_be_split_forall_dep pr (fun x -> post_f x `star` frame_f) (fun x -> pre_g x `star` frame_g x))) (#[@@@ framing_implicit] p2:squash (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post)) (f:repr a framed_f pre_f post_f req_f ens_f) (g:(x:a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x))) = let c = Steel.Effect.bind a b #framed_f #framed_g #pre_f #post_f #(fun _ -> req_f) #(fun _ x _ -> ens_f x) #pre_g #post_g #(fun x _ -> req_g x) #(fun x _ y _ -> ens_g x y) #frame_f #frame_g #post #_x1 #_x2 #pr #p1 #p2 f g in weaken_repr _ _ _ _ _ _ _ _ c () () let subcomp (a:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:Type0) (#[@@@ framing_implicit] ens_f:a -> Type0) (#[@@@ framing_implicit] pre_g:pre_t) (#[@@@ framing_implicit] post_g:post_t a) (#[@@@ framing_implicit] req_g:Type0) (#[@@@ framing_implicit] ens_g:a -> Type0) (#[@@@ framing_implicit] frame:vprop) (#[@@@ framing_implicit] _x1 : squash (maybe_emp framed_f frame)) (#[@@@ framing_implicit] p1:squash ( can_be_split pre_g (pre_f `star` frame))) (#[@@@ framing_implicit] p2:squash ( equiv_forall post_g (fun x -> post_f x `star` frame))) (f:repr a framed_f pre_f post_f req_f ens_f) : Pure (repr a framed_g pre_g post_g req_g ens_g) (requires req_g ==> (req_f /\ (forall x. ens_f x ==> ens_g x))) (ensures fun _ -> True) = weaken_repr _ _ _ _ _ _ _ _ (Steel.Effect.subcomp a #framed_f #framed_g #pre_f #post_f #(fun _ -> req_f) #(fun _ x _ -> ens_f x) #pre_g #post_g #(fun _ -> req_g) #(fun _ x _ -> ens_g x) #frame #_x1 #True #p1 #p2 f) () () let bind_pure_st_ (a:Type) (b:Type) (#[@@@ framing_implicit] wp:pure_wp a) (#framed:eqtype_as_type bool) (#[@@@ framing_implicit] pre:pre_t) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] req:a -> Type0) (#[@@@ framing_implicit] ens:a -> b -> Type0) (f:eqtype_as_type unit -> PURE a wp) (g:(x:a -> repr b framed pre post (req x) (ens x))) : repr b framed pre post (bind_pure_st_req wp req)
false
false
Steel.ST.Effect.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 bind_pure_st_ (a:Type) (b:Type) (#[@@@ framing_implicit] wp:pure_wp a) (#framed:eqtype_as_type bool) (#[@@@ framing_implicit] pre:pre_t) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] req:a -> pure_pre) (#[@@@ framing_implicit] ens:a -> pure_post b) (f:eqtype_as_type unit -> PURE a wp) (g:(x:a -> repr b framed pre post (req x) (ens x))) : repr b framed pre post (bind_pure_st_req wp req) (bind_pure_st_ens wp ens)
[]
Steel.ST.Effect.bind_pure_st_
{ "file_name": "lib/steel/Steel.ST.Effect.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
a: Type -> b: Type -> f: (_: FStar.Pervasives.eqtype_as_type Prims.unit -> Prims.PURE a) -> g: (x: a -> Steel.ST.Effect.repr b framed pre post (req x) (ens x)) -> Steel.ST.Effect.repr b framed pre post (Steel.ST.Effect.bind_pure_st_req wp req) (Steel.ST.Effect.bind_pure_st_ens wp ens)
{ "end_col": 39, "end_line": 231, "start_col": 3, "start_line": 213 }
Prims.Tot
val bind (a:Type) (b:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:pure_pre) (#[@@@ framing_implicit] ens_f:pure_post a) (#[@@@ framing_implicit] pre_g:a -> pre_t) (#[@@@ framing_implicit] post_g:a -> post_t b) (#[@@@ framing_implicit] req_g:a -> pure_pre) (#[@@@ framing_implicit] ens_g:(a -> pure_post b)) (#[@@@ framing_implicit] frame_f:vprop) (#[@@@ framing_implicit] frame_g:a -> vprop) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame_f)) (#[@@@ framing_implicit] _ : squash (maybe_emp_dep framed_g frame_g)) (#[@@@ framing_implicit] pr:a -> prop) (#[@@@ framing_implicit] p1:squash (can_be_split_forall_dep pr (fun x -> post_f x `star` frame_f) (fun x -> pre_g x `star` frame_g x))) (#[@@@ framing_implicit] p2:squash (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post)) (f:repr a framed_f pre_f post_f req_f ens_f) (g:(x:a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x))) : repr b true (pre_f `star` frame_f) post (bind_req a req_f ens_f pr req_g) (bind_ens a b ens_f ens_g)
[ { "abbrev": false, "full_module": "Steel.Effect", "short_module": null }, { "abbrev": false, "full_module": "Steel.Effect.Common", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics", "short_module": "T" }, { "abbrev": true, "full_module": "Steel.Memory", "short_module": "Mem" }, { "abbrev": false, "full_module": "FStar.Ghost", "short_module": null }, { "abbrev": false, "full_module": "Steel.Memory", "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 bind (a:Type) (b:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:Type0) (#[@@@ framing_implicit] ens_f:a -> Type0) (#[@@@ framing_implicit] pre_g:a -> pre_t) (#[@@@ framing_implicit] post_g:a -> post_t b) (#[@@@ framing_implicit] req_g:(a -> Type0)) (#[@@@ framing_implicit] ens_g:(a -> b -> Type0)) (#[@@@ framing_implicit] frame_f:vprop) (#[@@@ framing_implicit] frame_g:a -> vprop) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] _x1: squash (maybe_emp framed_f frame_f)) (#[@@@ framing_implicit] _x2: squash (maybe_emp_dep framed_g frame_g)) (#[@@@ framing_implicit] pr:a -> prop) (#[@@@ framing_implicit] p1:squash (can_be_split_forall_dep pr (fun x -> post_f x `star` frame_f) (fun x -> pre_g x `star` frame_g x))) (#[@@@ framing_implicit] p2:squash (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post)) (f:repr a framed_f pre_f post_f req_f ens_f) (g:(x:a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x))) = let c = Steel.Effect.bind a b #framed_f #framed_g #pre_f #post_f #(fun _ -> req_f) #(fun _ x _ -> ens_f x) #pre_g #post_g #(fun x _ -> req_g x) #(fun x _ y _ -> ens_g x y) #frame_f #frame_g #post #_x1 #_x2 #pr #p1 #p2 f g in weaken_repr _ _ _ _ _ _ _ _ c () ()
val bind (a:Type) (b:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:pure_pre) (#[@@@ framing_implicit] ens_f:pure_post a) (#[@@@ framing_implicit] pre_g:a -> pre_t) (#[@@@ framing_implicit] post_g:a -> post_t b) (#[@@@ framing_implicit] req_g:a -> pure_pre) (#[@@@ framing_implicit] ens_g:(a -> pure_post b)) (#[@@@ framing_implicit] frame_f:vprop) (#[@@@ framing_implicit] frame_g:a -> vprop) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame_f)) (#[@@@ framing_implicit] _ : squash (maybe_emp_dep framed_g frame_g)) (#[@@@ framing_implicit] pr:a -> prop) (#[@@@ framing_implicit] p1:squash (can_be_split_forall_dep pr (fun x -> post_f x `star` frame_f) (fun x -> pre_g x `star` frame_g x))) (#[@@@ framing_implicit] p2:squash (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post)) (f:repr a framed_f pre_f post_f req_f ens_f) (g:(x:a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x))) : repr b true (pre_f `star` frame_f) post (bind_req a req_f ens_f pr req_g) (bind_ens a b ens_f ens_g) let bind (a b: Type) (#framed_f #framed_g: eqtype_as_type bool) (#[@@@ framing_implicit]pre_f: pre_t) (#[@@@ framing_implicit]post_f: post_t a) (#[@@@ framing_implicit]req_f: Type0) (#[@@@ framing_implicit]ens_f: (a -> Type0)) (#[@@@ framing_implicit]pre_g: (a -> pre_t)) (#[@@@ framing_implicit]post_g: (a -> post_t b)) (#[@@@ framing_implicit]req_g: (a -> Type0)) (#[@@@ framing_implicit]ens_g: (a -> b -> Type0)) (#[@@@ framing_implicit]frame_f: vprop) (#[@@@ framing_implicit]frame_g: (a -> vprop)) (#[@@@ framing_implicit]post: post_t b) (#[@@@ framing_implicit]_x1: squash (maybe_emp framed_f frame_f)) (#[@@@ framing_implicit]_x2: squash (maybe_emp_dep framed_g frame_g)) (#[@@@ framing_implicit]pr: (a -> prop)) (#[@@@ framing_implicit]p1: squash (can_be_split_forall_dep pr (fun x -> (post_f x) `star` frame_f) (fun x -> (pre_g x) `star` (frame_g x)))) (#[@@@ framing_implicit]p2: squash (can_be_split_post (fun x y -> (post_g x y) `star` (frame_g x)) post)) (f: repr a framed_f pre_f post_f req_f ens_f) (g: (x: a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x))) =
false
null
false
let c = Steel.Effect.bind a b #framed_f #framed_g #pre_f #post_f #(fun _ -> req_f) #(fun _ x _ -> ens_f x) #pre_g #post_g #(fun x _ -> req_g x) #(fun x _ y _ -> ens_g x y) #frame_f #frame_g #post #_x1 #_x2 #pr #p1 #p2 f g in weaken_repr _ _ _ _ _ _ _ _ c () ()
{ "checked_file": "Steel.ST.Effect.fst.checked", "dependencies": [ "Steel.Memory.fsti.checked", "Steel.Effect.Common.fsti.checked", "Steel.Effect.fst.checked", "prims.fst.checked", "FStar.Tactics.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Monotonic.Pure.fst.checked", "FStar.Ghost.fsti.checked", "FStar.Classical.Sugar.fsti.checked" ], "interface_file": true, "source_file": "Steel.ST.Effect.fst" }
[ "total" ]
[ "FStar.Pervasives.eqtype_as_type", "Prims.bool", "Steel.Effect.Common.pre_t", "Steel.Effect.Common.post_t", "Steel.Effect.Common.vprop", "Prims.squash", "Steel.Effect.Common.maybe_emp", "Steel.Effect.Common.maybe_emp_dep", "Prims.prop", "Steel.Effect.Common.can_be_split_forall_dep", "Steel.Effect.Common.star", "Steel.Effect.Common.can_be_split_post", "Steel.ST.Effect.repr", "Steel.ST.Effect.weaken_repr", "Steel.Effect.bind_req", "Steel.Effect.Common.rmem", "Steel.ST.Effect.bind_req", "Steel.Effect.bind_ens", "Steel.ST.Effect.bind_ens", "Steel.Effect.repr", "Steel.Effect.Common.rmem'", "Steel.Effect.Common.valid_rmem", "Prims.l_and", "Prims.l_Forall", "Steel.Effect.Common.hmem", "Prims.l_imp", "FStar.Tactics.Effect.rewrite_with_tactic", "Steel.Effect.Common.frame_vc_norm", "Steel.Effect.Common.frame_equalities'", "Steel.Effect.Common.focus_rmem", "Steel.Effect.Common.mk_rmem", "Prims.l_Exists", "Steel.Effect.bind" ]
[]
(* 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.Effect friend Steel.Effect open Steel.Memory open FStar.Ghost module Mem = Steel.Memory module T = FStar.Tactics include Steel.Effect.Common open Steel.Effect #set-options "--warn_error -330" //turn off the experimental feature warning #set-options "--ide_id_info_off" let repr a framed pre post req ens : Type u#2 = Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ v _ -> ens v) let equiv_star_emp_r (p:vprop) : Lemma ((p `star` emp) `equiv` p) = cm_identity p; assert ((emp `star` p) `equiv` p); star_commutative p emp; equiv_trans (p `star` emp) (emp `star` p) p let weaken_repr a framed (pre:pre_t) (post:post_t a) (req req':req_t pre) (ens ens':ens_t pre a post) (f:Steel.Effect.repr a framed pre post req ens) (_:squash (forall (h0:hmem pre). req' (mk_rmem _ h0) ==> req (mk_rmem _ h0))) (_:squash (forall (h0:hmem pre) x (h1:hmem (post x)). ens (mk_rmem _ h0) x (mk_rmem _ h1) ==> ens' (mk_rmem _ h0) x (mk_rmem _ h1))) : Tot (Steel.Effect.repr a framed pre post req' ens') = let focus_rmem_refl (r:vprop) (h:rmem r) : Lemma (ensures focus_rmem #r h r == h) [SMTPat (focus_rmem #r h r)] = focus_rmem_refl r h in let equiv_trans (x y z:vprop) : Lemma (requires equiv x y /\ equiv y z) (ensures equiv x z) [SMTPat (equiv x z); SMTPat (equiv x y)] = equiv_trans x y z in let cbs (p:vprop) : Lemma (p `can_be_split` (p `star` emp)) [SMTPat (p `can_be_split` (p `star` emp))] = star_commutative p emp; cm_identity p; equiv_sym (p `star` emp) p; equiv_can_be_split p (p `star` emp) in let epost () : Lemma (equiv_forall post (fun x -> star (post x) emp)) = introduce forall x. post x `equiv` (post x `star` emp) with ( equiv_star_emp_r (post x); equiv_sym (post x `star` emp) (post x) ); equiv_forall_elim post (fun x -> star (post x) emp) in epost (); Steel.Effect.subcomp_opaque a #framed #framed #pre #post #req #ens #pre #post #req' #ens' #emp #True #() #() #() f let return_ (a:Type) (x:a) (#[@@@ framing_implicit] p:a -> vprop) : Tot (repr a true (return_pre (p x)) p True (fun v -> v == x)) = let k : Steel.Effect.repr a true (p x) p (fun _ -> True) (return_ens a x p) = Steel.Effect.return_ a x #p in weaken_repr _ _ _ _ _ _ _ _ k () () let bind (a:Type) (b:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:Type0) (#[@@@ framing_implicit] ens_f:a -> Type0) (#[@@@ framing_implicit] pre_g:a -> pre_t) (#[@@@ framing_implicit] post_g:a -> post_t b) (#[@@@ framing_implicit] req_g:(a -> Type0)) (#[@@@ framing_implicit] ens_g:(a -> b -> Type0)) (#[@@@ framing_implicit] frame_f:vprop) (#[@@@ framing_implicit] frame_g:a -> vprop) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] _x1: squash (maybe_emp framed_f frame_f)) (#[@@@ framing_implicit] _x2: squash (maybe_emp_dep framed_g frame_g)) (#[@@@ framing_implicit] pr:a -> prop) (#[@@@ framing_implicit] p1:squash (can_be_split_forall_dep pr (fun x -> post_f x `star` frame_f) (fun x -> pre_g x `star` frame_g x))) (#[@@@ framing_implicit] p2:squash (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post)) (f:repr a framed_f pre_f post_f req_f ens_f)
false
false
Steel.ST.Effect.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 bind (a:Type) (b:Type) (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool) (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a) (#[@@@ framing_implicit] req_f:pure_pre) (#[@@@ framing_implicit] ens_f:pure_post a) (#[@@@ framing_implicit] pre_g:a -> pre_t) (#[@@@ framing_implicit] post_g:a -> post_t b) (#[@@@ framing_implicit] req_g:a -> pure_pre) (#[@@@ framing_implicit] ens_g:(a -> pure_post b)) (#[@@@ framing_implicit] frame_f:vprop) (#[@@@ framing_implicit] frame_g:a -> vprop) (#[@@@ framing_implicit] post:post_t b) (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame_f)) (#[@@@ framing_implicit] _ : squash (maybe_emp_dep framed_g frame_g)) (#[@@@ framing_implicit] pr:a -> prop) (#[@@@ framing_implicit] p1:squash (can_be_split_forall_dep pr (fun x -> post_f x `star` frame_f) (fun x -> pre_g x `star` frame_g x))) (#[@@@ framing_implicit] p2:squash (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post)) (f:repr a framed_f pre_f post_f req_f ens_f) (g:(x:a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x))) : repr b true (pre_f `star` frame_f) post (bind_req a req_f ens_f pr req_g) (bind_ens a b ens_f ens_g)
[]
Steel.ST.Effect.bind
{ "file_name": "lib/steel/Steel.ST.Effect.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
a: Type -> b: Type -> f: Steel.ST.Effect.repr a framed_f pre_f post_f req_f ens_f -> g: (x: a -> Steel.ST.Effect.repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x)) -> Steel.ST.Effect.repr b true (Steel.Effect.Common.star pre_f frame_f) post (Steel.ST.Effect.bind_req a req_f ens_f pr req_g) (Steel.ST.Effect.bind_ens a b ens_f ens_g)
{ "end_col": 41, "end_line": 153, "start_col": 5, "start_line": 134 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t))
let mk_abs ty t =
false
null
false
let open RT in mk_abs (elab_term ty) T.Q_Explicit (elab_term t)
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Syntax.Base.term", "FStar.Reflection.Typing.mk_abs", "Pulse.Elaborate.Pure.elab_term", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Reflection.Types.term" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g)
false
true
Pulse.Checker.Base.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_abs : ty: Pulse.Syntax.Base.term -> t: Pulse.Syntax.Base.term -> FStar.Reflection.Types.term
[]
Pulse.Checker.Base.mk_abs
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
ty: Pulse.Syntax.Base.term -> t: Pulse.Syntax.Base.term -> FStar.Reflection.Types.term
{ "end_col": 71, "end_line": 34, "start_col": 18, "start_line": 34 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
let mk_arrow ty t =
false
null
false
RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t)
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Syntax.Base.term", "FStar.Reflection.Typing.mk_arrow", "Pulse.Elaborate.Pure.elab_term", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Reflection.Types.term" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g)
false
true
Pulse.Checker.Base.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_arrow : ty: Pulse.Syntax.Base.term -> t: Pulse.Syntax.Base.term -> FStar.Reflection.Types.term
[]
Pulse.Checker.Base.mk_arrow
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
ty: Pulse.Syntax.Base.term -> t: Pulse.Syntax.Base.term -> FStar.Reflection.Types.term
{ "end_col": 73, "end_line": 33, "start_col": 20, "start_line": 33 }
Prims.Tot
val k_elab_equiv (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term) (k:continuation_elaborator g1 ctxt1 g2 ctxt2) (d1:vprop_equiv g1 ctxt1 ctxt1') (d2:vprop_equiv g2 ctxt2 ctxt2') : continuation_elaborator g1 ctxt1' g2 ctxt2'
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 k_elab_equiv (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term) (k:continuation_elaborator g1 ctxt1 g2 ctxt2) (d1:vprop_equiv g1 ctxt1 ctxt1') (d2:vprop_equiv g2 ctxt2 ctxt2') : continuation_elaborator g1 ctxt1' g2 ctxt2' = let k : continuation_elaborator g1 ctxt1 g2 ctxt2' = k_elab_equiv_continuation k d2 in let k : continuation_elaborator g1 ctxt1' g2 ctxt2' = k_elab_equiv_prefix k d1 in k
val k_elab_equiv (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term) (k:continuation_elaborator g1 ctxt1 g2 ctxt2) (d1:vprop_equiv g1 ctxt1 ctxt1') (d2:vprop_equiv g2 ctxt2 ctxt2') : continuation_elaborator g1 ctxt1' g2 ctxt2' let k_elab_equiv (#g1: env) (#g2: env{g2 `env_extends` g1}) (#ctxt1 #ctxt1' #ctxt2 #ctxt2': term) (k: continuation_elaborator g1 ctxt1 g2 ctxt2) (d1: vprop_equiv g1 ctxt1 ctxt1') (d2: vprop_equiv g2 ctxt2 ctxt2') : continuation_elaborator g1 ctxt1' g2 ctxt2' =
false
null
false
let k:continuation_elaborator g1 ctxt1 g2 ctxt2' = k_elab_equiv_continuation k d2 in let k:continuation_elaborator g1 ctxt1' g2 ctxt2' = k_elab_equiv_prefix k d1 in k
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Typing.Env.env_extends", "Pulse.Syntax.Base.term", "Pulse.Checker.Base.continuation_elaborator", "Pulse.Typing.vprop_equiv", "Pulse.Checker.Base.k_elab_equiv_prefix", "Pulse.Checker.Base.k_elab_equiv_continuation" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing let comp_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre} let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) = if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv #push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0" let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term) (k:continuation_elaborator g1 ctxt g2 ctxt1) (d:vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 = fun post_hint res -> let (| st, c, st_d |) = res in let st_d : st_typing g2 st c = st_d in assert (comp_pre c == ctxt2); let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in k post_hint (| st, _, st_d' |) #pop-options let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g ctxt p) : tot_typing g p tm_vprop = let fwd, _ = vprop_equiv_typing d in fwd ctxt_typing #push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0" let k_elab_equiv_prefix (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term) (k:continuation_elaborator g1 ctxt1 g2 ctxt) (d:vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt = fun post_hint res -> let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 = let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in (| tm_emp, emp_typing, d |) in let res = k post_hint res in let (| st, c, st_d |) = res in assert (comp_pre c == ctxt1); (| _, _, st_equiv_pre st_d _ d |) #pop-options let k_elab_equiv (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term) (k:continuation_elaborator g1 ctxt1 g2 ctxt2) (d1:vprop_equiv g1 ctxt1 ctxt1')
false
false
Pulse.Checker.Base.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 k_elab_equiv (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term) (k:continuation_elaborator g1 ctxt1 g2 ctxt2) (d1:vprop_equiv g1 ctxt1 ctxt1') (d2:vprop_equiv g2 ctxt2 ctxt2') : continuation_elaborator g1 ctxt1' g2 ctxt2'
[]
Pulse.Checker.Base.k_elab_equiv
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
k: Pulse.Checker.Base.continuation_elaborator g1 ctxt1 g2 ctxt2 -> d1: Pulse.Typing.vprop_equiv g1 ctxt1 ctxt1' -> d2: Pulse.Typing.vprop_equiv g2 ctxt2 ctxt2' -> Pulse.Checker.Base.continuation_elaborator g1 ctxt1' g2 ctxt2'
{ "end_col": 3, "end_line": 222, "start_col": 49, "start_line": 216 }
Prims.Tot
val vprop_equiv_typing_bk (#g: env) (#ctxt: _) (ctxt_typing: tot_typing g ctxt tm_vprop) (#p: _) (d: vprop_equiv g p ctxt) : tot_typing g p tm_vprop
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing
val vprop_equiv_typing_bk (#g: env) (#ctxt: _) (ctxt_typing: tot_typing g ctxt tm_vprop) (#p: _) (d: vprop_equiv g p ctxt) : tot_typing g p tm_vprop let vprop_equiv_typing_bk (#g: env) (#ctxt: _) (ctxt_typing: tot_typing g ctxt tm_vprop) (#p: _) (d: vprop_equiv g p ctxt) : tot_typing g p tm_vprop =
false
null
false
let _, bk = vprop_equiv_typing d in bk ctxt_typing
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.term", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.tm_vprop", "Pulse.Typing.vprop_equiv", "FStar.Pervasives.Native.tuple2", "Pulse.Typing.Combinators.vprop_equiv_typing" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt)
false
false
Pulse.Checker.Base.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 vprop_equiv_typing_bk (#g: env) (#ctxt: _) (ctxt_typing: tot_typing g ctxt tm_vprop) (#p: _) (d: vprop_equiv g p ctxt) : tot_typing g p tm_vprop
[]
Pulse.Checker.Base.vprop_equiv_typing_bk
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
ctxt_typing: Pulse.Typing.tot_typing g ctxt Pulse.Syntax.Base.tm_vprop -> d: Pulse.Typing.vprop_equiv g p ctxt -> Pulse.Typing.tot_typing g p Pulse.Syntax.Base.tm_vprop
{ "end_col": 18, "end_line": 151, "start_col": 3, "start_line": 150 }
Prims.Tot
val ve_unit_r (g: _) (p: term) : vprop_equiv g (tm_star p tm_emp) p
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
val ve_unit_r (g: _) (p: term) : vprop_equiv g (tm_star p tm_emp) p let ve_unit_r g (p: term) : vprop_equiv g (tm_star p tm_emp) p =
false
null
false
VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.term", "Pulse.Typing.VE_Trans", "Pulse.Syntax.Base.tm_star", "Pulse.Syntax.Base.tm_emp", "Pulse.Typing.VE_Comm", "Pulse.Typing.VE_Unit", "Pulse.Typing.vprop_equiv" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post}
false
false
Pulse.Checker.Base.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 ve_unit_r (g: _) (p: term) : vprop_equiv g (tm_star p tm_emp) p
[]
Pulse.Checker.Base.ve_unit_r
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
g: Pulse.Typing.Env.env -> p: Pulse.Syntax.Base.term -> Pulse.Typing.vprop_equiv g (Pulse.Syntax.Base.tm_star p Pulse.Syntax.Base.tm_emp) p
{ "end_col": 48, "end_line": 89, "start_col": 2, "start_line": 89 }
Prims.Tot
val vprop_equiv_typing_fwd (#g: env) (#ctxt: _) (ctxt_typing: tot_typing g ctxt tm_vprop) (#p: _) (d: vprop_equiv g ctxt p) : tot_typing g p tm_vprop
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g ctxt p) : tot_typing g p tm_vprop = let fwd, _ = vprop_equiv_typing d in fwd ctxt_typing
val vprop_equiv_typing_fwd (#g: env) (#ctxt: _) (ctxt_typing: tot_typing g ctxt tm_vprop) (#p: _) (d: vprop_equiv g ctxt p) : tot_typing g p tm_vprop let vprop_equiv_typing_fwd (#g: env) (#ctxt: _) (ctxt_typing: tot_typing g ctxt tm_vprop) (#p: _) (d: vprop_equiv g ctxt p) : tot_typing g p tm_vprop =
false
null
false
let fwd, _ = vprop_equiv_typing d in fwd ctxt_typing
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.term", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.tm_vprop", "Pulse.Typing.vprop_equiv", "FStar.Pervasives.Native.tuple2", "Pulse.Typing.Combinators.vprop_equiv_typing" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing let comp_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre} let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) = if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv #push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0" let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term) (k:continuation_elaborator g1 ctxt g2 ctxt1) (d:vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 = fun post_hint res -> let (| st, c, st_d |) = res in let st_d : st_typing g2 st c = st_d in assert (comp_pre c == ctxt2); let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in k post_hint (| st, _, st_d' |) #pop-options let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g ctxt p)
false
false
Pulse.Checker.Base.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 vprop_equiv_typing_fwd (#g: env) (#ctxt: _) (ctxt_typing: tot_typing g ctxt tm_vprop) (#p: _) (d: vprop_equiv g ctxt p) : tot_typing g p tm_vprop
[]
Pulse.Checker.Base.vprop_equiv_typing_fwd
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
ctxt_typing: Pulse.Typing.tot_typing g ctxt Pulse.Syntax.Base.tm_vprop -> d: Pulse.Typing.vprop_equiv g ctxt p -> Pulse.Typing.tot_typing g p Pulse.Syntax.Base.tm_vprop
{ "end_col": 19, "end_line": 192, "start_col": 3, "start_line": 191 }
FStar.Tactics.Effect.Tac
val format_failed_goal (g:env) (ctxt:list term) (goal:list term) : T.Tac string
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g)
val format_failed_goal (g:env) (ctxt:list term) (goal:list term) : T.Tac string let format_failed_goal (g: env) (ctxt goal: list term) =
true
null
false
let terms_to_strings (ts: list term) = T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i + 1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts: list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n %s\nThe remaining conjuncts in the separation logic context available for use are:\n %s\nThe typing context is:\n %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g)
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[]
[ "Pulse.Typing.Env.env", "Prims.list", "Pulse.Syntax.Base.term", "Prims.string", "FStar.Printf.sprintf", "Pulse.Typing.Env.env_to_string", "Prims.int", "FStar.String.concat", "FStar.List.Tot.Base.rev", "FStar.Pervasives.Native.tuple2", "FStar.Tactics.Util.fold_left", "FStar.Pervasives.Native.Mktuple2", "Prims.op_Addition", "Prims.Cons", "Prims.Nil", "FStar.Tactics.Util.map", "Pulse.Syntax.Printer.term_to_string" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory
false
false
Pulse.Checker.Base.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 format_failed_goal (g:env) (ctxt:list term) (goal:list term) : T.Tac string
[]
Pulse.Checker.Base.format_failed_goal
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
g: Pulse.Typing.Env.env -> ctxt: Prims.list Pulse.Syntax.Base.term -> goal: Prims.list Pulse.Syntax.Base.term -> FStar.Tactics.Effect.Tac Prims.string
{ "end_col": 21, "end_line": 30, "start_col": 66, "start_line": 14 }
Prims.Tot
val post_hint_from_comp_typing (#g:env) (#c:comp_st) (ct:Metatheory.comp_typing_u g c) : post_hint_for_env g
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p
val post_hint_from_comp_typing (#g:env) (#c:comp_st) (ct:Metatheory.comp_typing_u g c) : post_hint_for_env g let post_hint_from_comp_typing #g #c ct =
false
null
false
let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing , pre_typing , x , post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p:post_hint_t = { g = g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u = comp_u c; ty_typing = ty_typing; post = comp_post c; post_typing = post_typing_as_abstraction post_typing } in p
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.comp_st", "Pulse.Typing.Metatheory.Base.comp_typing_u", "Pulse.Typing.universe_of", "Pulse.Syntax.Base.__proj__Mkst_comp__item__res", "Pulse.Syntax.Base.st_comp_of_comp", "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.Syntax.Base.var", "Pulse.Typing.fresh_wrt", "Pulse.Syntax.Naming.freevars", "Pulse.Syntax.Base.__proj__Mkst_comp__item__post", "Pulse.Typing.Env.push_binding", "Pulse.Syntax.Base.ppname_default", "Pulse.Syntax.Naming.open_term", "Pulse.Typing.post_hint_t", "Pulse.Typing.Mkpost_hint_t", "FStar.Pervasives.Native.Some", "Pulse.Syntax.Base.ctag", "Pulse.Syntax.Base.ctag_of_comp_st", "Pulse.Syntax.Base.comp_res", "Pulse.Syntax.Base.comp_u", "Pulse.Syntax.Base.comp_post", "Pulse.Checker.Base.post_typing_as_abstraction", "Pulse.Typing.post_hint_for_env", "FStar.Pervasives.dtuple4", "Pulse.Typing.Metatheory.Base.st_comp_typing_inversion", "Pulse.Typing.st_comp_typing", "Pulse.Typing.Metatheory.Base.comp_typing_inversion" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing }
false
false
Pulse.Checker.Base.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 post_hint_from_comp_typing (#g:env) (#c:comp_st) (ct:Metatheory.comp_typing_u g c) : post_hint_for_env g
[]
Pulse.Checker.Base.post_hint_from_comp_typing
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
ct: Pulse.Typing.Metatheory.Base.comp_typing_u g c -> Pulse.Typing.post_hint_for_env g
{ "end_col": 3, "end_line": 68, "start_col": 41, "start_line": 57 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre}
let comp_with_pre (c: comp_st) (pre: term) =
false
null
false
match c with | C_ST st -> C_ST ({ st with pre = pre }) | C_STGhost i st -> C_STGhost i ({ st with pre = pre }) | C_STAtomic i st -> C_STAtomic i ({ st with pre = pre })
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Syntax.Base.comp_st", "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.st_comp", "Pulse.Syntax.Base.C_ST", "Pulse.Syntax.Base.Mkst_comp", "Pulse.Syntax.Base.__proj__Mkst_comp__item__u", "Pulse.Syntax.Base.__proj__Mkst_comp__item__res", "Pulse.Syntax.Base.__proj__Mkst_comp__item__post", "Pulse.Syntax.Base.C_STGhost", "Pulse.Syntax.Base.C_STAtomic", "Pulse.Syntax.Base.comp" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing
false
true
Pulse.Checker.Base.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 comp_with_pre : c: Pulse.Syntax.Base.comp_st -> pre: Pulse.Syntax.Base.term -> Pulse.Syntax.Base.comp
[]
Pulse.Checker.Base.comp_with_pre
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
c: Pulse.Syntax.Base.comp_st -> pre: Pulse.Syntax.Base.term -> Pulse.Syntax.Base.comp
{ "end_col": 49, "end_line": 157, "start_col": 2, "start_line": 154 }
Prims.Tot
val t_equiv (#g #st #c: _) (d: st_typing g st c) (#c': comp) (eq: st_equiv g c c') : st_typing g st c'
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq
val t_equiv (#g #st #c: _) (d: st_typing g st c) (#c': comp) (eq: st_equiv g c c') : st_typing g st c' let t_equiv #g #st #c (d: st_typing g st c) (#c': comp) (eq: st_equiv g c c') : st_typing g st c' =
false
null
false
match d with | T_Equiv _ _ _ _ d0 eq' -> (match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'') | _ -> T_Equiv _ _ _ _ d eq
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.st_term", "Pulse.Syntax.Base.comp", "Pulse.Typing.st_typing", "Pulse.Typing.st_equiv", "Pulse.Checker.Base.st_equiv_trans", "Pulse.Typing.T_Equiv" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')
false
false
Pulse.Checker.Base.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 t_equiv (#g #st #c: _) (d: st_typing g st c) (#c': comp) (eq: st_equiv g c c') : st_typing g st c'
[]
Pulse.Checker.Base.t_equiv
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
d: Pulse.Typing.st_typing g st c -> eq: Pulse.Typing.st_equiv g c c' -> Pulse.Typing.st_typing g st c'
{ "end_col": 31, "end_line": 112, "start_col": 4, "start_line": 106 }
Prims.Tot
val check_equiv_emp (g:env) (vp:term) : option (vprop_equiv g vp tm_emp)
[ { "abbrev": true, "full_module": "Pulse.Typing.LN", "short_module": "LN" }, { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 check_equiv_emp (g:env) (vp:term) : option (vprop_equiv g vp tm_emp) = match vp.t with | Tm_Emp -> Some (VE_Refl _ _) | Tm_Star vp1 vp2 -> (match check_equiv_emp g vp1, check_equiv_emp g vp2 with | Some d1, Some d2 -> let d3 : vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp) = VE_Ctxt _ _ _ _ _ d1 d2 in let d4 : vprop_equiv g (tm_star tm_emp tm_emp) tm_emp = VE_Unit _ _ in Some (VE_Trans _ _ _ _ d3 d4) | _, _ -> None) | _ -> None
val check_equiv_emp (g:env) (vp:term) : option (vprop_equiv g vp tm_emp) let rec check_equiv_emp (g: env) (vp: term) : option (vprop_equiv g vp tm_emp) =
false
null
false
match vp.t with | Tm_Emp -> Some (VE_Refl _ _) | Tm_Star vp1 vp2 -> (match check_equiv_emp g vp1, check_equiv_emp g vp2 with | Some d1, Some d2 -> let d3:vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp) = VE_Ctxt _ _ _ _ _ d1 d2 in let d4:vprop_equiv g (tm_star tm_emp tm_emp) tm_emp = VE_Unit _ _ in Some (VE_Trans _ _ _ _ d3 d4) | _, _ -> None) | _ -> None
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.__proj__Mkterm__item__t", "FStar.Pervasives.Native.Some", "Pulse.Typing.vprop_equiv", "Pulse.Syntax.Base.tm_emp", "Pulse.Typing.VE_Refl", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.option", "Pulse.Checker.Base.check_equiv_emp", "Pulse.Typing.VE_Trans", "Pulse.Syntax.Base.tm_star", "Pulse.Typing.VE_Unit", "Pulse.Typing.VE_Ctxt", "FStar.Pervasives.Native.None", "Pulse.Syntax.Base.term'" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing let comp_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre} let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) = if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv #push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0" let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term) (k:continuation_elaborator g1 ctxt g2 ctxt1) (d:vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 = fun post_hint res -> let (| st, c, st_d |) = res in let st_d : st_typing g2 st c = st_d in assert (comp_pre c == ctxt2); let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in k post_hint (| st, _, st_d' |) #pop-options let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g ctxt p) : tot_typing g p tm_vprop = let fwd, _ = vprop_equiv_typing d in fwd ctxt_typing #push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0" let k_elab_equiv_prefix (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term) (k:continuation_elaborator g1 ctxt1 g2 ctxt) (d:vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt = fun post_hint res -> let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 = let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in (| tm_emp, emp_typing, d |) in let res = k post_hint res in let (| st, c, st_d |) = res in assert (comp_pre c == ctxt1); (| _, _, st_equiv_pre st_d _ d |) #pop-options let k_elab_equiv (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term) (k:continuation_elaborator g1 ctxt1 g2 ctxt2) (d1:vprop_equiv g1 ctxt1 ctxt1') (d2:vprop_equiv g2 ctxt2 ctxt2') : continuation_elaborator g1 ctxt1' g2 ctxt2' = let k : continuation_elaborator g1 ctxt1 g2 ctxt2' = k_elab_equiv_continuation k d2 in let k : continuation_elaborator g1 ctxt1' g2 ctxt2' = k_elab_equiv_prefix k d1 in k #push-options "--query_stats --fuel 2 --ifuel 2 --split_queries no --z3rlimit_factor 20" let continuation_elaborator_with_bind (#g:env) (ctxt:term) (#c1:comp{stateful_comp c1}) (#e1:st_term) (e1_typing:st_typing g e1 c1) (ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop) (x:nvar { None? (lookup g (snd x)) }) : T.Tac (continuation_elaborator g (tm_star ctxt (comp_pre c1)) (push_binding g (snd x) (fst x) (comp_res c1)) (tm_star (open_term (comp_post c1) (snd x)) ctxt)) = let pre1 = comp_pre c1 in let res1 = comp_res c1 in let post1 = comp_post c1 in let ctxt_typing = star_typing_inversion_l ctxt_pre1_typing in // let p_prop = Metatheory.pure_typing_inversion pure_typing in let v_eq = VE_Comm g ctxt pre1 in let framing_token : frame_for_req_in_ctxt g (tm_star ctxt pre1) pre1 = (| ctxt, ctxt_typing, VE_Comm g pre1 ctxt |) in let (| c1, e1_typing |) = apply_frame ctxt_pre1_typing e1_typing framing_token in let (| u_of_1, pre_typing, _, _ |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness e1_typing))) in let b = res1 in let ppname, x = x in let g' = push_binding g x ppname b in let post1_opened = open_term_nv post1 (v_as_nv x) in let k : continuation_elaborator g (tm_star ctxt pre1) g' (tm_star post1_opened ctxt) = fun post_hint res -> let (| e2, c2, e2_typing |) = res in let e2_typing : st_typing g' e2 c2 = e2_typing in let e2_closed = close_st_term e2 x in assume (open_st_term e2_closed x == e2); assert (comp_pre c1 == (tm_star ctxt pre1)); assert (comp_post c1 == tm_star post1 ctxt); assert (comp_pre c2 == tm_star post1_opened ctxt); assert (open_term (comp_post c1) x == tm_star post1_opened (open_term ctxt x)); // ctxt is well-typed, hence ln assume (open_term ctxt x == ctxt); assert (open_term (comp_post c1) x == comp_pre c2); // we closed e2 with x assume (~ (x `Set.mem` freevars_st e2_closed)); if x `Set.mem` freevars (comp_post c2) then fail g' None "Impossible: freevar clash when constructing continuation elaborator for bind, please file a bug-report" else ( let t_typing, post_typing = Pulse.Typing.Combinators.bind_res_and_post_typing g (st_comp_of_comp c2) x post_hint in let (| e, c, e_typing |) = Pulse.Typing.Combinators.mk_bind g (tm_star ctxt pre1) e1 e2_closed c1 c2 (ppname, x) e1_typing u_of_1 e2_typing t_typing post_typing in (| e, c, e_typing |) ) in k #pop-options module LN = Pulse.Typing.LN #push-options "--z3rlimit_factor 4 --fuel 1 --ifuel 1" let continuation_elaborator_with_let (#g:env) (#ctxt:term) (ctxt_typing:tot_typing g ctxt tm_vprop) (#e1:term) (#eff1:T.tot_or_ghost) (#t1:term) (b:binder{b.binder_ty == t1}) (e1_typing:typing g e1 eff1 t1) (x:nvar { None? (lookup g (snd x)) }) : T.Tac (continuation_elaborator g ctxt (push_binding g (snd x) (fst x) t1) ctxt) = assert ((push_binding g (snd x) (fst x) t1) `env_extends` g); fun post_hint (| e2, c2, d2 |) -> if eff1 = T.E_Ghost && not (C_STGhost? c2) then fail g (Some e1.range) (Printf.sprintf "Cannot bind ghost expression %s with %s computation" (P.term_to_string e1) (P.comp_to_string c2)); let ppname, x = x in let e2_closed = close_st_term e2 x in assume (open_st_term (close_st_term e2 x) x == e2); let e = wr c2 (Tm_TotBind {binder=b; head=e1;body=e2_closed}) in let c = open_comp_with (close_comp c2 x) e1 in // we just closed assume (~ (x `Set.mem` freevars_st e2_closed)); let d : st_typing g e c = if eff1 = T.E_Total then T_TotBind g e1 e2_closed t1 c2 b x e1_typing d2 else let token = CP.is_non_informative (push_binding g x ppname t1) c2 in match token with | None -> fail g None (Printf.sprintf "Impossible! Non-informative for %s returned None" (P.comp_to_string c2)) | Some token -> let token = FStar.Squash.return_squash token in T_GhostBind g e1 e2_closed t1 c2 b x e1_typing d2 (E (RT.Non_informative_token _ _ token)) in let _ = match post_hint with | None -> () | Some post_hint -> // // The post_hint is well-typed in g // so it should not have x free // // c2 matches post hint, so it should also not have x free // so closing with x, and opening with e1 should be identity // assume (comp_post c == comp_post c2 /\ comp_res c == comp_res c2 /\ comp_u c == comp_u c2) in FV.tot_typing_freevars ctxt_typing; close_with_non_freevar ctxt x 0; LN.tot_typing_ln ctxt_typing; open_with_gt_ln ctxt (-1) e1 0; (| e, c, d |) let rec check_equiv_emp (g:env) (vp:term)
false
false
Pulse.Checker.Base.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 1, "initial_ifuel": 1, "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": 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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val check_equiv_emp (g:env) (vp:term) : option (vprop_equiv g vp tm_emp)
[ "recursion" ]
Pulse.Checker.Base.check_equiv_emp
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
g: Pulse.Typing.Env.env -> vp: Pulse.Syntax.Base.term -> FStar.Pervasives.Native.option (Pulse.Typing.vprop_equiv g vp Pulse.Syntax.Base.tm_emp)
{ "end_col": 16, "end_line": 369, "start_col": 4, "start_line": 358 }
Prims.Tot
val k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r
val k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt let k_elab_unit (g: env) (ctxt: term) : continuation_elaborator g ctxt g ctxt =
false
null
false
fun p r -> r
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.term", "Pulse.Typing.post_hint_opt", "Pulse.Typing.Combinators.st_typing_in_ctxt", "Pulse.Checker.Base.continuation_elaborator" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term)
false
false
Pulse.Checker.Base.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 k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt
[]
Pulse.Checker.Base.k_elab_unit
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
g: Pulse.Typing.Env.env -> ctxt: Pulse.Syntax.Base.term -> Pulse.Checker.Base.continuation_elaborator g ctxt g ctxt
{ "end_col": 16, "end_line": 72, "start_col": 4, "start_line": 72 }
Prims.Tot
val k_elab_equiv_prefix (#g1: env) (#g2: env{g2 `env_extends` g1}) (#ctxt1 #ctxt2 #ctxt: term) (k: continuation_elaborator g1 ctxt1 g2 ctxt) (d: vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 k_elab_equiv_prefix (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term) (k:continuation_elaborator g1 ctxt1 g2 ctxt) (d:vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt = fun post_hint res -> let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 = let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in (| tm_emp, emp_typing, d |) in let res = k post_hint res in let (| st, c, st_d |) = res in assert (comp_pre c == ctxt1); (| _, _, st_equiv_pre st_d _ d |)
val k_elab_equiv_prefix (#g1: env) (#g2: env{g2 `env_extends` g1}) (#ctxt1 #ctxt2 #ctxt: term) (k: continuation_elaborator g1 ctxt1 g2 ctxt) (d: vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt let k_elab_equiv_prefix (#g1: env) (#g2: env{g2 `env_extends` g1}) (#ctxt1 #ctxt2 #ctxt: term) (k: continuation_elaborator g1 ctxt1 g2 ctxt) (d: vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt =
false
null
false
fun post_hint res -> let framing_token:frame_for_req_in_ctxt g1 ctxt2 ctxt1 = let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in (| tm_emp, emp_typing, d |) in let res = k post_hint res in let (| st , c , st_d |) = res in assert (comp_pre c == ctxt1); (| _, _, st_equiv_pre st_d _ d |)
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Typing.Env.env_extends", "Pulse.Syntax.Base.term", "Pulse.Checker.Base.continuation_elaborator", "Pulse.Typing.vprop_equiv", "Pulse.Typing.post_hint_opt", "Pulse.Typing.Combinators.st_typing_in_ctxt", "Pulse.Syntax.Base.st_term", "Pulse.Syntax.Base.comp_st", "Prims.l_and", "Prims.eq2", "Pulse.Syntax.Base.vprop", "Pulse.Syntax.Base.comp_pre", "Pulse.Typing.comp_post_matches_hint", "Pulse.Typing.st_typing", "FStar.Pervasives.Mkdtuple3", "Pulse.Checker.Base.comp_with_pre", "Pulse.Checker.Base.st_equiv_pre", "Prims.unit", "Prims._assert", "Pulse.Typing.Combinators.frame_for_req_in_ctxt", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.tm_vprop", "Pulse.Syntax.Base.tm_star", "Pulse.Syntax.Base.tm_emp", "Pulse.Typing.emp_typing", "Pulse.Typing.VE_Trans", "Pulse.Typing.VE_Comm", "Pulse.Typing.VE_Unit" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing let comp_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre} let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) = if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv #push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0" let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term) (k:continuation_elaborator g1 ctxt g2 ctxt1) (d:vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 = fun post_hint res -> let (| st, c, st_d |) = res in let st_d : st_typing g2 st c = st_d in assert (comp_pre c == ctxt2); let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in k post_hint (| st, _, st_d' |) #pop-options let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g ctxt p) : tot_typing g p tm_vprop = let fwd, _ = vprop_equiv_typing d in fwd ctxt_typing #push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0" let k_elab_equiv_prefix (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term) (k:continuation_elaborator g1 ctxt1 g2 ctxt) (d:vprop_equiv g1 ctxt1 ctxt2)
false
false
Pulse.Checker.Base.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 1, "max_fuel": 0, "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": 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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val k_elab_equiv_prefix (#g1: env) (#g2: env{g2 `env_extends` g1}) (#ctxt1 #ctxt2 #ctxt: term) (k: continuation_elaborator g1 ctxt1 g2 ctxt) (d: vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt
[]
Pulse.Checker.Base.k_elab_equiv_prefix
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
k: Pulse.Checker.Base.continuation_elaborator g1 ctxt1 g2 ctxt -> d: Pulse.Typing.vprop_equiv g1 ctxt1 ctxt2 -> Pulse.Checker.Base.continuation_elaborator g1 ctxt2 g2 ctxt
{ "end_col": 35, "end_line": 208, "start_col": 2, "start_line": 200 }
Prims.Tot
val k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res)
val k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 let k_elab_trans (#g0: env) (#g1: env{g1 `env_extends` g0}) (#g2: env{g2 `env_extends` g1}) (#ctxt0 #ctxt1 #ctxt2: term) (k0: continuation_elaborator g0 ctxt0 g1 ctxt1) (k1: continuation_elaborator g1 ctxt1 g2 ctxt2 {g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 =
false
null
false
fun post_hint res -> k0 post_hint (k1 post_hint res)
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Typing.Env.env_extends", "Pulse.Syntax.Base.term", "Pulse.Checker.Base.continuation_elaborator", "Pulse.Typing.post_hint_opt", "Pulse.Typing.Combinators.st_typing_in_ctxt" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0})
false
false
Pulse.Checker.Base.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 k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2
[]
Pulse.Checker.Base.k_elab_trans
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
k0: Pulse.Checker.Base.continuation_elaborator g0 ctxt0 g1 ctxt1 -> k1: Pulse.Checker.Base.continuation_elaborator g1 ctxt1 g2 ctxt2 {Pulse.Typing.Env.env_extends g1 g0} -> Pulse.Checker.Base.continuation_elaborator g0 ctxt0 g2 ctxt2
{ "end_col": 57, "end_line": 79, "start_col": 5, "start_line": 79 }
Prims.Tot
val comp_st_with_post (c: comp_st) (post: term) : c': comp_st{st_comp_of_comp c' == ({ st_comp_of_comp c with post = post } <: st_comp)}
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post}
val comp_st_with_post (c: comp_st) (post: term) : c': comp_st{st_comp_of_comp c' == ({ st_comp_of_comp c with post = post } <: st_comp)} let comp_st_with_post (c: comp_st) (post: term) : c': comp_st{st_comp_of_comp c' == ({ st_comp_of_comp c with post = post } <: st_comp)} =
false
null
false
match c with | C_ST st -> C_ST ({ st with post = post }) | C_STGhost i st -> C_STGhost i ({ st with post = post }) | C_STAtomic i st -> C_STAtomic i ({ st with post = post })
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Syntax.Base.comp_st", "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.st_comp", "Pulse.Syntax.Base.C_ST", "Pulse.Syntax.Base.Mkst_comp", "Pulse.Syntax.Base.__proj__Mkst_comp__item__u", "Pulse.Syntax.Base.__proj__Mkst_comp__item__res", "Pulse.Syntax.Base.__proj__Mkst_comp__item__pre", "Pulse.Syntax.Base.C_STGhost", "Pulse.Syntax.Base.C_STAtomic", "Prims.eq2", "Pulse.Syntax.Base.st_comp_of_comp" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term)
false
false
Pulse.Checker.Base.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 comp_st_with_post (c: comp_st) (post: term) : c': comp_st{st_comp_of_comp c' == ({ st_comp_of_comp c with post = post } <: st_comp)}
[]
Pulse.Checker.Base.comp_st_with_post
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
c: Pulse.Syntax.Base.comp_st -> post: Pulse.Syntax.Base.term -> c': Pulse.Syntax.Base.comp_st { Pulse.Syntax.Base.st_comp_of_comp c' == (let _ = Pulse.Syntax.Base.st_comp_of_comp c in Pulse.Syntax.Base.Mkst_comp (Mkst_comp?.u _) (Mkst_comp?.res _) (Mkst_comp?.pre _) post) }
{ "end_col": 50, "end_line": 86, "start_col": 2, "start_line": 83 }
Prims.Tot
val st_equiv_trans (#g: env) (#c0 #c1 #c2: comp) (d01: st_equiv g c0 c1) (d12: st_equiv g c1 c2) : option (st_equiv g c0 c2)
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None
val st_equiv_trans (#g: env) (#c0 #c1 #c2: comp) (d01: st_equiv g c0 c1) (d12: st_equiv g c1 c2) : option (st_equiv g c0 c2) let st_equiv_trans (#g: env) (#c0 #c1 #c2: comp) (d01: st_equiv g c0 c1) (d12: st_equiv g c1 c2) : option (st_equiv g c0 c2) =
false
null
false
let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some (ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12)) else None
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.comp", "Pulse.Typing.st_equiv", "Pulse.Syntax.Base.comp_st", "Pulse.Typing.st_equiv_pre", "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.comp_post", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.comp_pre", "Pulse.Syntax.Base.tm_vprop", "Pulse.Syntax.Base.comp_res", "Pulse.Syntax.Pure.tm_type", "Pulse.Syntax.Base.comp_u", "Pulse.Typing.Env.push_binding", "Pulse.Syntax.Base.ppname_default", "Pulse.Syntax.Naming.open_term", "FStar.Reflection.Typing.equiv", "Pulse.Typing.elab_env", "Pulse.Elaborate.Pure.elab_term", "Pulse.Typing.vprop_equiv", "Prims.op_AmpAmp", "Prims.op_Equality", "Prims.l_or", "Pulse.Syntax.Base.eq_tm", "FStar.Pervasives.Native.Some", "Pulse.Typing.ST_VPropEquiv", "FStar.Reflection.Typing.Rel_trans", "FStar.Reflection.Typing.R_Eq", "Pulse.Typing.VE_Trans", "Prims.bool", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)
false
false
Pulse.Checker.Base.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 st_equiv_trans (#g: env) (#c0 #c1 #c2: comp) (d01: st_equiv g c0 c1) (d12: st_equiv g c1 c2) : option (st_equiv g c0 c2)
[]
Pulse.Checker.Base.st_equiv_trans
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
d01: Pulse.Typing.st_equiv g c0 c1 -> d12: Pulse.Typing.st_equiv g c1 c2 -> FStar.Pervasives.Native.option (Pulse.Typing.st_equiv g c0 c2)
{ "end_col": 13, "end_line": 102, "start_col": 3, "start_line": 93 }
Prims.Tot
val k_elab_equiv_continuation (#g1: env) (#g2: env{g2 `env_extends` g1}) (#ctxt #ctxt1 #ctxt2: term) (k: continuation_elaborator g1 ctxt g2 ctxt1) (d: vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term) (k:continuation_elaborator g1 ctxt g2 ctxt1) (d:vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 = fun post_hint res -> let (| st, c, st_d |) = res in let st_d : st_typing g2 st c = st_d in assert (comp_pre c == ctxt2); let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in k post_hint (| st, _, st_d' |)
val k_elab_equiv_continuation (#g1: env) (#g2: env{g2 `env_extends` g1}) (#ctxt #ctxt1 #ctxt2: term) (k: continuation_elaborator g1 ctxt g2 ctxt1) (d: vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 let k_elab_equiv_continuation (#g1: env) (#g2: env{g2 `env_extends` g1}) (#ctxt #ctxt1 #ctxt2: term) (k: continuation_elaborator g1 ctxt g2 ctxt1) (d: vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 =
false
null
false
fun post_hint res -> let (| st , c , st_d |) = res in let st_d:st_typing g2 st c = st_d in assert (comp_pre c == ctxt2); let st_d':st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in k post_hint (| st, _, st_d' |)
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Typing.Env.env_extends", "Pulse.Syntax.Base.term", "Pulse.Checker.Base.continuation_elaborator", "Pulse.Typing.vprop_equiv", "Pulse.Typing.post_hint_opt", "Pulse.Typing.Combinators.st_typing_in_ctxt", "Pulse.Syntax.Base.st_term", "Pulse.Syntax.Base.comp_st", "Prims.l_and", "Prims.eq2", "Pulse.Syntax.Base.vprop", "Pulse.Syntax.Base.comp_pre", "Pulse.Typing.comp_post_matches_hint", "Pulse.Typing.st_typing", "FStar.Pervasives.Mkdtuple3", "Pulse.Checker.Base.comp_with_pre", "Pulse.Checker.Base.st_equiv_pre", "Pulse.Typing.VE_Sym", "Prims.unit", "Prims._assert" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing let comp_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre} let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) = if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv #push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0" let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term) (k:continuation_elaborator g1 ctxt g2 ctxt1) (d:vprop_equiv g2 ctxt1 ctxt2)
false
false
Pulse.Checker.Base.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 0, "initial_ifuel": 2, "max_fuel": 0, "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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val k_elab_equiv_continuation (#g1: env) (#g2: env{g2 `env_extends` g1}) (#ctxt #ctxt1 #ctxt2: term) (k: continuation_elaborator g1 ctxt g2 ctxt1) (d: vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2
[]
Pulse.Checker.Base.k_elab_equiv_continuation
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
k: Pulse.Checker.Base.continuation_elaborator g1 ctxt g2 ctxt1 -> d: Pulse.Typing.vprop_equiv g2 ctxt1 ctxt2 -> Pulse.Checker.Base.continuation_elaborator g1 ctxt g2 ctxt2
{ "end_col": 34, "end_line": 185, "start_col": 2, "start_line": 180 }
FStar.Tactics.Effect.Tac
val apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g) (r:checker_result_t g ctxt (Some post_hint)) (res_ppname:ppname) : T.Tac (st_typing_in_ctxt g ctxt (Some post_hint))
[ { "abbrev": true, "full_module": "Pulse.Typing.LN", "short_module": "LN" }, { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g) (r:checker_result_t g ctxt (Some post_hint)) (res_ppname:ppname) : T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) = // TODO: FIXME add to checker result type? let (| y, g1, (| u_ty, ty_y, d_ty_y |), (| pre', _ |), k |) = r in let (| u_ty_y, d_ty_y |) = Pulse.Checker.Pure.check_universe g1 ty_y in let d : st_typing_in_ctxt g1 pre' (Some post_hint) = return_in_ctxt g1 y res_ppname u_ty_y ty_y pre' d_ty_y (Some post_hint) in k (Some post_hint) d
val apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g) (r:checker_result_t g ctxt (Some post_hint)) (res_ppname:ppname) : T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) let apply_checker_result_k (#g: env) (#ctxt: vprop) (#post_hint: post_hint_for_env g) (r: checker_result_t g ctxt (Some post_hint)) (res_ppname: ppname) : T.Tac (st_typing_in_ctxt g ctxt (Some post_hint)) =
true
null
false
let (| y , g1 , (| u_ty , ty_y , d_ty_y |) , (| pre' , _ |) , k |) = r in let (| u_ty_y , d_ty_y |) = Pulse.Checker.Pure.check_universe g1 ty_y in let d:st_typing_in_ctxt g1 pre' (Some post_hint) = return_in_ctxt g1 y res_ppname u_ty_y ty_y pre' d_ty_y (Some post_hint) in k (Some post_hint) d
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.vprop", "Pulse.Typing.post_hint_for_env", "Pulse.Checker.Base.checker_result_t", "FStar.Pervasives.Native.Some", "Pulse.Typing.post_hint_t", "Pulse.Syntax.Base.ppname", "Pulse.Syntax.Base.var", "Pulse.Typing.Env.env_extends", "Pulse.Syntax.Base.universe", "Pulse.Syntax.Base.typ", "Pulse.Typing.universe_of", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.tm_vprop", "Pulse.Checker.Base.continuation_elaborator", "FStar.Pervasives.dfst", "Prims.Mkdtuple2", "Pulse.Checker.Base.checker_result_inv", "FStar.Pervasives.Mkdtuple3", "Pulse.Typing.Combinators.st_typing_in_ctxt", "Pulse.Checker.Base.return_in_ctxt", "Prims.dtuple2", "Pulse.Checker.Pure.check_universe" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing let comp_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre} let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) = if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv #push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0" let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term) (k:continuation_elaborator g1 ctxt g2 ctxt1) (d:vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 = fun post_hint res -> let (| st, c, st_d |) = res in let st_d : st_typing g2 st c = st_d in assert (comp_pre c == ctxt2); let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in k post_hint (| st, _, st_d' |) #pop-options let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g ctxt p) : tot_typing g p tm_vprop = let fwd, _ = vprop_equiv_typing d in fwd ctxt_typing #push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0" let k_elab_equiv_prefix (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term) (k:continuation_elaborator g1 ctxt1 g2 ctxt) (d:vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt = fun post_hint res -> let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 = let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in (| tm_emp, emp_typing, d |) in let res = k post_hint res in let (| st, c, st_d |) = res in assert (comp_pre c == ctxt1); (| _, _, st_equiv_pre st_d _ d |) #pop-options let k_elab_equiv (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term) (k:continuation_elaborator g1 ctxt1 g2 ctxt2) (d1:vprop_equiv g1 ctxt1 ctxt1') (d2:vprop_equiv g2 ctxt2 ctxt2') : continuation_elaborator g1 ctxt1' g2 ctxt2' = let k : continuation_elaborator g1 ctxt1 g2 ctxt2' = k_elab_equiv_continuation k d2 in let k : continuation_elaborator g1 ctxt1' g2 ctxt2' = k_elab_equiv_prefix k d1 in k #push-options "--query_stats --fuel 2 --ifuel 2 --split_queries no --z3rlimit_factor 20" let continuation_elaborator_with_bind (#g:env) (ctxt:term) (#c1:comp{stateful_comp c1}) (#e1:st_term) (e1_typing:st_typing g e1 c1) (ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop) (x:nvar { None? (lookup g (snd x)) }) : T.Tac (continuation_elaborator g (tm_star ctxt (comp_pre c1)) (push_binding g (snd x) (fst x) (comp_res c1)) (tm_star (open_term (comp_post c1) (snd x)) ctxt)) = let pre1 = comp_pre c1 in let res1 = comp_res c1 in let post1 = comp_post c1 in let ctxt_typing = star_typing_inversion_l ctxt_pre1_typing in // let p_prop = Metatheory.pure_typing_inversion pure_typing in let v_eq = VE_Comm g ctxt pre1 in let framing_token : frame_for_req_in_ctxt g (tm_star ctxt pre1) pre1 = (| ctxt, ctxt_typing, VE_Comm g pre1 ctxt |) in let (| c1, e1_typing |) = apply_frame ctxt_pre1_typing e1_typing framing_token in let (| u_of_1, pre_typing, _, _ |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness e1_typing))) in let b = res1 in let ppname, x = x in let g' = push_binding g x ppname b in let post1_opened = open_term_nv post1 (v_as_nv x) in let k : continuation_elaborator g (tm_star ctxt pre1) g' (tm_star post1_opened ctxt) = fun post_hint res -> let (| e2, c2, e2_typing |) = res in let e2_typing : st_typing g' e2 c2 = e2_typing in let e2_closed = close_st_term e2 x in assume (open_st_term e2_closed x == e2); assert (comp_pre c1 == (tm_star ctxt pre1)); assert (comp_post c1 == tm_star post1 ctxt); assert (comp_pre c2 == tm_star post1_opened ctxt); assert (open_term (comp_post c1) x == tm_star post1_opened (open_term ctxt x)); // ctxt is well-typed, hence ln assume (open_term ctxt x == ctxt); assert (open_term (comp_post c1) x == comp_pre c2); // we closed e2 with x assume (~ (x `Set.mem` freevars_st e2_closed)); if x `Set.mem` freevars (comp_post c2) then fail g' None "Impossible: freevar clash when constructing continuation elaborator for bind, please file a bug-report" else ( let t_typing, post_typing = Pulse.Typing.Combinators.bind_res_and_post_typing g (st_comp_of_comp c2) x post_hint in let (| e, c, e_typing |) = Pulse.Typing.Combinators.mk_bind g (tm_star ctxt pre1) e1 e2_closed c1 c2 (ppname, x) e1_typing u_of_1 e2_typing t_typing post_typing in (| e, c, e_typing |) ) in k #pop-options module LN = Pulse.Typing.LN #push-options "--z3rlimit_factor 4 --fuel 1 --ifuel 1" let continuation_elaborator_with_let (#g:env) (#ctxt:term) (ctxt_typing:tot_typing g ctxt tm_vprop) (#e1:term) (#eff1:T.tot_or_ghost) (#t1:term) (b:binder{b.binder_ty == t1}) (e1_typing:typing g e1 eff1 t1) (x:nvar { None? (lookup g (snd x)) }) : T.Tac (continuation_elaborator g ctxt (push_binding g (snd x) (fst x) t1) ctxt) = assert ((push_binding g (snd x) (fst x) t1) `env_extends` g); fun post_hint (| e2, c2, d2 |) -> if eff1 = T.E_Ghost && not (C_STGhost? c2) then fail g (Some e1.range) (Printf.sprintf "Cannot bind ghost expression %s with %s computation" (P.term_to_string e1) (P.comp_to_string c2)); let ppname, x = x in let e2_closed = close_st_term e2 x in assume (open_st_term (close_st_term e2 x) x == e2); let e = wr c2 (Tm_TotBind {binder=b; head=e1;body=e2_closed}) in let c = open_comp_with (close_comp c2 x) e1 in // we just closed assume (~ (x `Set.mem` freevars_st e2_closed)); let d : st_typing g e c = if eff1 = T.E_Total then T_TotBind g e1 e2_closed t1 c2 b x e1_typing d2 else let token = CP.is_non_informative (push_binding g x ppname t1) c2 in match token with | None -> fail g None (Printf.sprintf "Impossible! Non-informative for %s returned None" (P.comp_to_string c2)) | Some token -> let token = FStar.Squash.return_squash token in T_GhostBind g e1 e2_closed t1 c2 b x e1_typing d2 (E (RT.Non_informative_token _ _ token)) in let _ = match post_hint with | None -> () | Some post_hint -> // // The post_hint is well-typed in g // so it should not have x free // // c2 matches post hint, so it should also not have x free // so closing with x, and opening with e1 should be identity // assume (comp_post c == comp_post c2 /\ comp_res c == comp_res c2 /\ comp_u c == comp_u c2) in FV.tot_typing_freevars ctxt_typing; close_with_non_freevar ctxt x 0; LN.tot_typing_ln ctxt_typing; open_with_gt_ln ctxt (-1) e1 0; (| e, c, d |) let rec check_equiv_emp (g:env) (vp:term) : option (vprop_equiv g vp tm_emp) = match vp.t with | Tm_Emp -> Some (VE_Refl _ _) | Tm_Star vp1 vp2 -> (match check_equiv_emp g vp1, check_equiv_emp g vp2 with | Some d1, Some d2 -> let d3 : vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp) = VE_Ctxt _ _ _ _ _ d1 d2 in let d4 : vprop_equiv g (tm_star tm_emp tm_emp) tm_emp = VE_Unit _ _ in Some (VE_Trans _ _ _ _ d3 d4) | _, _ -> None) | _ -> None let intro_comp_typing (g:env) (c:comp_st) (pre_typing:tot_typing g (comp_pre c) tm_vprop) (res_typing:universe_of g (comp_res c) (comp_u c)) (x:var { fresh_wrt x g (freevars (comp_post c)) }) (post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop) : T.Tac (comp_typing g c (comp_u c)) = let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\ comp_pre c == st.pre /\ comp_res c == st.res /\ comp_post c == st.post } ) : T.Tac (st_comp_typing g st) = STC g st x res_typing pre_typing post_typing in match c with | C_ST st -> let stc = intro_st_comp_typing st in CT_ST _ _ stc | C_STAtomic i st -> let stc = intro_st_comp_typing st in let (| ty, i_typing |) = CP.core_check_tot_term g i in if not (eq_tm ty tm_inames) then fail g None (Printf.sprintf "ill-typed inames term %s" (P.term_to_string i)) else CT_STAtomic _ _ _ i_typing stc | C_STGhost i st -> let stc = intro_st_comp_typing st in let (| ty, i_typing |) = CP.core_check_tot_term g i in if not (eq_tm ty tm_inames) then fail g None (Printf.sprintf "ill-typed inames term %s" (P.term_to_string i)) else CT_STGhost _ _ _ i_typing stc let return_in_ctxt (g:env) (y:var) (y_ppname:ppname) (u:universe) (ty:term) (ctxt:vprop) (ty_typing:universe_of g ty u) (post_hint0:post_hint_opt g { Some? post_hint0 /\ checker_res_matches_post_hint g post_hint0 y ty ctxt}) : Pure (st_typing_in_ctxt g ctxt post_hint0) (requires lookup g y == Some ty) (ensures fun _ -> True) = let Some post_hint = post_hint0 in let x = fresh g in assume (~ (x `Set.mem` freevars post_hint.post)); let ctag = match post_hint.ctag_hint with | None -> STT | Some ctag -> ctag in let y_tm = tm_var {nm_index=y;nm_ppname=y_ppname} in let d = T_Return g ctag false u ty y_tm post_hint.post x ty_typing (magic ()) // that null_var y is well typed at ty in g, we know since lookup g y == Some ty (magic ()) // typing of (open post x) in (g, x) ... post_hint is well-typed, so should get in let t = wtag (Some ctag) (Tm_Return {ctag=ctag;insert_eq=false;term=y_tm}) in let c = comp_return ctag false u ty y_tm post_hint.post x in let d : st_typing g t c = d in let _ :squash (comp_pre c == ctxt /\ comp_post_matches_hint c (Some post_hint)) = match post_hint0 with | Some post_hint -> // this u should follow from equality of t assume (comp_u c == post_hint.u) in (| _, _, d |) let match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post_hint:post_hint_opt g) : T.Tac (t':st_term & c':comp_st & st_typing g t' c') = match post_hint with | None -> (| t, c, d |) | Some { ret_ty } -> let cres = comp_res c in if eq_tm cres ret_ty then (| t, c, d |) else match Pulse.Checker.Pure.check_equiv g cres ret_ty with | None -> fail g (Some t.range) (Printf.sprintf "Could not prove equiv for computed type %s and expected type %s" (P.term_to_string cres) (P.term_to_string ret_ty)) | Some tok -> let d_equiv : RT.equiv _ (elab_term cres) (elab_term ret_ty) = RT.Rel_eq_token _ _ _ (FStar.Squash.return_squash tok) in let c' = with_st_comp c {(st_comp_of_comp c) with res = ret_ty } in let (| cres_typing, cpre_typing, x, cpost_typing |) = st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d)) in let d_stequiv : st_equiv g c c' = ST_VPropEquiv _ c c' _ cpre_typing cres_typing cpost_typing d_equiv (VE_Refl _ _) (VE_Refl _ _) in (| t, c', T_Equiv _ _ _ _ d d_stequiv |) let apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g) (r:checker_result_t g ctxt (Some post_hint))
false
false
Pulse.Checker.Base.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 1, "initial_ifuel": 1, "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": 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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val apply_checker_result_k (#g:env) (#ctxt:vprop) (#post_hint:post_hint_for_env g) (r:checker_result_t g ctxt (Some post_hint)) (res_ppname:ppname) : T.Tac (st_typing_in_ctxt g ctxt (Some post_hint))
[]
Pulse.Checker.Base.apply_checker_result_k
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
r: Pulse.Checker.Base.checker_result_t g ctxt (FStar.Pervasives.Native.Some post_hint) -> res_ppname: Pulse.Syntax.Base.ppname -> FStar.Tactics.Effect.Tac (Pulse.Typing.Combinators.st_typing_in_ctxt g ctxt (FStar.Pervasives.Native.Some post_hint))
{ "end_col": 22, "end_line": 482, "start_col": 55, "start_line": 472 }
Prims.Tot
val simplify_post (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (post: term{comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post)
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
val simplify_post (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (post: term{comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) let simplify_post (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (post: term{comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) =
false
null
false
st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x))
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.st_term", "Pulse.Syntax.Base.comp_st", "Pulse.Typing.st_typing", "Pulse.Syntax.Base.term", "Prims.eq2", "Pulse.Syntax.Base.comp_post", "Pulse.Syntax.Base.tm_star", "Pulse.Syntax.Base.tm_emp", "Pulse.Checker.Base.st_equiv_post", "Pulse.Syntax.Base.var", "Pulse.Typing.fresh_wrt", "Pulse.Syntax.Naming.freevars", "Pulse.Checker.Base.ve_unit_r", "Pulse.Typing.Env.push_binding", "Pulse.Syntax.Base.ppname_default", "Pulse.Syntax.Base.comp_res", "Pulse.Syntax.Naming.open_term", "Pulse.Typing.vprop_equiv", "Pulse.Checker.Base.comp_st_with_post" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp})
false
false
Pulse.Checker.Base.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 simplify_post (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (post: term{comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post)
[]
Pulse.Checker.Base.simplify_post
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
d: Pulse.Typing.st_typing g t c -> post: Pulse.Syntax.Base.term {Pulse.Syntax.Base.comp_post c == Pulse.Syntax.Base.tm_star post Pulse.Syntax.Base.tm_emp} -> Pulse.Typing.st_typing g t (Pulse.Checker.Base.comp_st_with_post c post)
{ "end_col": 111, "end_line": 134, "start_col": 4, "start_line": 134 }
Prims.Tot
val st_equiv_pre (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (pre: term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre)
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) = if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv
val st_equiv_pre (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (pre: term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) let st_equiv_pre (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (pre: term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) =
false
null
false
if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of , pre_typing , x , post_typing |) = let open Metatheory in st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d)) in let st_equiv:st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.st_term", "Pulse.Syntax.Base.comp_st", "Pulse.Typing.st_typing", "Pulse.Syntax.Base.term", "Pulse.Typing.vprop_equiv", "Pulse.Syntax.Base.comp_pre", "Pulse.Syntax.Base.eq_tm", "Prims.bool", "Pulse.Typing.universe_of", "Pulse.Syntax.Base.__proj__Mkst_comp__item__res", "Pulse.Syntax.Base.st_comp_of_comp", "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.Syntax.Base.var", "Pulse.Typing.fresh_wrt", "Pulse.Syntax.Naming.freevars", "Pulse.Syntax.Base.__proj__Mkst_comp__item__post", "Pulse.Typing.Env.push_binding", "Pulse.Syntax.Base.ppname_default", "Pulse.Syntax.Naming.open_term", "Pulse.Checker.Base.t_equiv", "Pulse.Typing.st_equiv", "Pulse.Typing.ST_VPropEquiv", "FStar.Reflection.Typing.Rel_refl", "Pulse.Typing.elab_env", "Pulse.Elaborate.Pure.elab_term", "Pulse.Syntax.Base.comp_res", "FStar.Reflection.Typing.R_Eq", "Pulse.Typing.VE_Refl", "Pulse.Syntax.Base.comp_post", "Pulse.Checker.Base.comp_with_pre", "FStar.Pervasives.dtuple4", "Pulse.Typing.Metatheory.Base.st_comp_typing_inversion", "Pulse.Typing.Metatheory.Base.comp_typing_inversion", "Pulse.Typing.Metatheory.Base.st_typing_correctness", "Pulse.Syntax.Base.comp" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing let comp_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre} let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre)
false
false
Pulse.Checker.Base.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 st_equiv_pre (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (pre: term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre)
[]
Pulse.Checker.Base.st_equiv_pre
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
d: Pulse.Typing.st_typing g t c -> pre: Pulse.Syntax.Base.term -> veq: Pulse.Typing.vprop_equiv g (Pulse.Syntax.Base.comp_pre c) pre -> Pulse.Typing.st_typing g t (Pulse.Checker.Base.comp_with_pre c pre)
{ "end_col": 24, "end_line": 172, "start_col": 4, "start_line": 164 }
Prims.Tot
val st_equiv_post (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (post: term{(freevars post) `Set.subset` (freevars (comp_post c))}) (veq: (x: var{fresh_wrt x g (freevars (comp_post c))} -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post)
[ { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv
val st_equiv_post (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (post: term{(freevars post) `Set.subset` (freevars (comp_post c))}) (veq: (x: var{fresh_wrt x g (freevars (comp_post c))} -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) let st_equiv_post (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (post: term{(freevars post) `Set.subset` (freevars (comp_post c))}) (veq: (x: var{fresh_wrt x g (freevars (comp_post c))} -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) =
false
null
false
if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of , pre_typing , x , post_typing |) = let open Metatheory in st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d)) in let veq = veq x in let st_equiv:st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[ "total" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.st_term", "Pulse.Syntax.Base.comp_st", "Pulse.Typing.st_typing", "Pulse.Syntax.Base.term", "FStar.Set.subset", "Pulse.Syntax.Base.var", "Pulse.Syntax.Naming.freevars", "Pulse.Syntax.Base.comp_post", "Pulse.Typing.fresh_wrt", "Pulse.Typing.vprop_equiv", "Pulse.Typing.Env.push_binding", "Pulse.Syntax.Base.ppname_default", "Pulse.Syntax.Base.comp_res", "Pulse.Syntax.Naming.open_term", "Pulse.Syntax.Base.eq_tm", "Prims.bool", "Pulse.Typing.universe_of", "Pulse.Syntax.Base.__proj__Mkst_comp__item__res", "Pulse.Syntax.Base.st_comp_of_comp", "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.Syntax.Base.__proj__Mkst_comp__item__post", "Pulse.Checker.Base.t_equiv", "Pulse.Typing.st_equiv", "Pulse.Typing.ST_VPropEquiv", "FStar.Reflection.Typing.Rel_refl", "Pulse.Typing.elab_env", "Pulse.Elaborate.Pure.elab_term", "FStar.Reflection.Typing.R_Eq", "Pulse.Typing.VE_Refl", "Pulse.Syntax.Base.comp_pre", "Pulse.Checker.Base.comp_st_with_post", "FStar.Pervasives.dtuple4", "Pulse.Typing.Metatheory.Base.st_comp_typing_inversion", "Pulse.Typing.Metatheory.Base.comp_typing_inversion", "Pulse.Typing.Metatheory.Base.st_typing_correctness", "Prims.eq2", "Pulse.Syntax.Base.st_comp", "Pulse.Syntax.Base.Mkst_comp" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x)))
false
false
Pulse.Checker.Base.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 st_equiv_post (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (post: term{(freevars post) `Set.subset` (freevars (comp_post c))}) (veq: (x: var{fresh_wrt x g (freevars (comp_post c))} -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post)
[]
Pulse.Checker.Base.st_equiv_post
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
d: Pulse.Typing.st_typing g t c -> post: Pulse.Syntax.Base.term { FStar.Set.subset (Pulse.Syntax.Naming.freevars post) (Pulse.Syntax.Naming.freevars (Pulse.Syntax.Base.comp_post c)) } -> veq: ( x: Pulse.Syntax.Base.var { Pulse.Typing.fresh_wrt x g (Pulse.Syntax.Naming.freevars (Pulse.Syntax.Base.comp_post c)) } -> Pulse.Typing.vprop_equiv (Pulse.Typing.Env.push_binding g x Pulse.Syntax.Base.ppname_default (Pulse.Syntax.Base.comp_res c)) (Pulse.Syntax.Naming.open_term (Pulse.Syntax.Base.comp_post c) x) (Pulse.Syntax.Naming.open_term post x)) -> Pulse.Typing.st_typing g t (Pulse.Checker.Base.comp_st_with_post c post)
{ "end_col": 24, "end_line": 129, "start_col": 4, "start_line": 121 }
FStar.Tactics.Effect.Tac
val intro_comp_typing (g:env) (c:comp_st) (pre_typing:tot_typing g (comp_pre c) tm_vprop) (res_typing:universe_of g (comp_res c) (comp_u c)) (x:var { fresh_wrt x g (freevars (comp_post c)) }) (post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop) : T.Tac (comp_typing g c (comp_u c))
[ { "abbrev": true, "full_module": "Pulse.Typing.LN", "short_module": "LN" }, { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 intro_comp_typing (g:env) (c:comp_st) (pre_typing:tot_typing g (comp_pre c) tm_vprop) (res_typing:universe_of g (comp_res c) (comp_u c)) (x:var { fresh_wrt x g (freevars (comp_post c)) }) (post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop) : T.Tac (comp_typing g c (comp_u c)) = let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\ comp_pre c == st.pre /\ comp_res c == st.res /\ comp_post c == st.post } ) : T.Tac (st_comp_typing g st) = STC g st x res_typing pre_typing post_typing in match c with | C_ST st -> let stc = intro_st_comp_typing st in CT_ST _ _ stc | C_STAtomic i st -> let stc = intro_st_comp_typing st in let (| ty, i_typing |) = CP.core_check_tot_term g i in if not (eq_tm ty tm_inames) then fail g None (Printf.sprintf "ill-typed inames term %s" (P.term_to_string i)) else CT_STAtomic _ _ _ i_typing stc | C_STGhost i st -> let stc = intro_st_comp_typing st in let (| ty, i_typing |) = CP.core_check_tot_term g i in if not (eq_tm ty tm_inames) then fail g None (Printf.sprintf "ill-typed inames term %s" (P.term_to_string i)) else CT_STGhost _ _ _ i_typing stc
val intro_comp_typing (g:env) (c:comp_st) (pre_typing:tot_typing g (comp_pre c) tm_vprop) (res_typing:universe_of g (comp_res c) (comp_u c)) (x:var { fresh_wrt x g (freevars (comp_post c)) }) (post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop) : T.Tac (comp_typing g c (comp_u c)) let intro_comp_typing (g: env) (c: comp_st) (pre_typing: tot_typing g (comp_pre c) tm_vprop) (res_typing: universe_of g (comp_res c) (comp_u c)) (x: var{fresh_wrt x g (freevars (comp_post c))}) (post_typing: tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop) : T.Tac (comp_typing g c (comp_u c)) =
true
null
false
let intro_st_comp_typing (st: st_comp { comp_u c == st.u /\ comp_pre c == st.pre /\ comp_res c == st.res /\ comp_post c == st.post }) : T.Tac (st_comp_typing g st) = STC g st x res_typing pre_typing post_typing in match c with | C_ST st -> let stc = intro_st_comp_typing st in CT_ST _ _ stc | C_STAtomic i st -> let stc = intro_st_comp_typing st in let (| ty , i_typing |) = CP.core_check_tot_term g i in if not (eq_tm ty tm_inames) then fail g None (Printf.sprintf "ill-typed inames term %s" (P.term_to_string i)) else CT_STAtomic _ _ _ i_typing stc | C_STGhost i st -> let stc = intro_st_comp_typing st in let (| ty , i_typing |) = CP.core_check_tot_term g i in if not (eq_tm ty tm_inames) then fail g None (Printf.sprintf "ill-typed inames term %s" (P.term_to_string i)) else CT_STGhost _ _ _ i_typing stc
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.comp_st", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.comp_pre", "Pulse.Syntax.Base.tm_vprop", "Pulse.Typing.universe_of", "Pulse.Syntax.Base.comp_res", "Pulse.Syntax.Base.comp_u", "Pulse.Syntax.Base.var", "Pulse.Typing.fresh_wrt", "Pulse.Syntax.Naming.freevars", "Pulse.Syntax.Base.comp_post", "Pulse.Typing.Env.push_binding", "Pulse.Syntax.Base.ppname_default", "Pulse.Syntax.Naming.open_term", "Pulse.Syntax.Base.st_comp", "Pulse.Typing.CT_ST", "Pulse.Typing.comp_typing", "Pulse.Typing.st_comp_typing", "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.typ", "Prims.op_Negation", "Pulse.Syntax.Base.eq_tm", "Pulse.Syntax.Base.tm_inames", "Pulse.Typing.Env.fail", "FStar.Pervasives.Native.None", "Pulse.Syntax.Base.range", "Prims.string", "FStar.Printf.sprintf", "Pulse.Syntax.Printer.term_to_string", "Prims.bool", "Pulse.Typing.CT_STAtomic", "Prims.dtuple2", "Pulse.Checker.Pure.core_check_tot_term", "Pulse.Typing.CT_STGhost", "Prims.l_and", "Prims.eq2", "Pulse.Syntax.Base.universe", "Pulse.Syntax.Base.__proj__Mkst_comp__item__u", "Pulse.Syntax.Base.vprop", "Pulse.Syntax.Base.__proj__Mkst_comp__item__pre", "Pulse.Syntax.Base.__proj__Mkst_comp__item__res", "Pulse.Syntax.Base.__proj__Mkst_comp__item__post", "Pulse.Typing.STC" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing let comp_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre} let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) = if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv #push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0" let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term) (k:continuation_elaborator g1 ctxt g2 ctxt1) (d:vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 = fun post_hint res -> let (| st, c, st_d |) = res in let st_d : st_typing g2 st c = st_d in assert (comp_pre c == ctxt2); let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in k post_hint (| st, _, st_d' |) #pop-options let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g ctxt p) : tot_typing g p tm_vprop = let fwd, _ = vprop_equiv_typing d in fwd ctxt_typing #push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0" let k_elab_equiv_prefix (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term) (k:continuation_elaborator g1 ctxt1 g2 ctxt) (d:vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt = fun post_hint res -> let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 = let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in (| tm_emp, emp_typing, d |) in let res = k post_hint res in let (| st, c, st_d |) = res in assert (comp_pre c == ctxt1); (| _, _, st_equiv_pre st_d _ d |) #pop-options let k_elab_equiv (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term) (k:continuation_elaborator g1 ctxt1 g2 ctxt2) (d1:vprop_equiv g1 ctxt1 ctxt1') (d2:vprop_equiv g2 ctxt2 ctxt2') : continuation_elaborator g1 ctxt1' g2 ctxt2' = let k : continuation_elaborator g1 ctxt1 g2 ctxt2' = k_elab_equiv_continuation k d2 in let k : continuation_elaborator g1 ctxt1' g2 ctxt2' = k_elab_equiv_prefix k d1 in k #push-options "--query_stats --fuel 2 --ifuel 2 --split_queries no --z3rlimit_factor 20" let continuation_elaborator_with_bind (#g:env) (ctxt:term) (#c1:comp{stateful_comp c1}) (#e1:st_term) (e1_typing:st_typing g e1 c1) (ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop) (x:nvar { None? (lookup g (snd x)) }) : T.Tac (continuation_elaborator g (tm_star ctxt (comp_pre c1)) (push_binding g (snd x) (fst x) (comp_res c1)) (tm_star (open_term (comp_post c1) (snd x)) ctxt)) = let pre1 = comp_pre c1 in let res1 = comp_res c1 in let post1 = comp_post c1 in let ctxt_typing = star_typing_inversion_l ctxt_pre1_typing in // let p_prop = Metatheory.pure_typing_inversion pure_typing in let v_eq = VE_Comm g ctxt pre1 in let framing_token : frame_for_req_in_ctxt g (tm_star ctxt pre1) pre1 = (| ctxt, ctxt_typing, VE_Comm g pre1 ctxt |) in let (| c1, e1_typing |) = apply_frame ctxt_pre1_typing e1_typing framing_token in let (| u_of_1, pre_typing, _, _ |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness e1_typing))) in let b = res1 in let ppname, x = x in let g' = push_binding g x ppname b in let post1_opened = open_term_nv post1 (v_as_nv x) in let k : continuation_elaborator g (tm_star ctxt pre1) g' (tm_star post1_opened ctxt) = fun post_hint res -> let (| e2, c2, e2_typing |) = res in let e2_typing : st_typing g' e2 c2 = e2_typing in let e2_closed = close_st_term e2 x in assume (open_st_term e2_closed x == e2); assert (comp_pre c1 == (tm_star ctxt pre1)); assert (comp_post c1 == tm_star post1 ctxt); assert (comp_pre c2 == tm_star post1_opened ctxt); assert (open_term (comp_post c1) x == tm_star post1_opened (open_term ctxt x)); // ctxt is well-typed, hence ln assume (open_term ctxt x == ctxt); assert (open_term (comp_post c1) x == comp_pre c2); // we closed e2 with x assume (~ (x `Set.mem` freevars_st e2_closed)); if x `Set.mem` freevars (comp_post c2) then fail g' None "Impossible: freevar clash when constructing continuation elaborator for bind, please file a bug-report" else ( let t_typing, post_typing = Pulse.Typing.Combinators.bind_res_and_post_typing g (st_comp_of_comp c2) x post_hint in let (| e, c, e_typing |) = Pulse.Typing.Combinators.mk_bind g (tm_star ctxt pre1) e1 e2_closed c1 c2 (ppname, x) e1_typing u_of_1 e2_typing t_typing post_typing in (| e, c, e_typing |) ) in k #pop-options module LN = Pulse.Typing.LN #push-options "--z3rlimit_factor 4 --fuel 1 --ifuel 1" let continuation_elaborator_with_let (#g:env) (#ctxt:term) (ctxt_typing:tot_typing g ctxt tm_vprop) (#e1:term) (#eff1:T.tot_or_ghost) (#t1:term) (b:binder{b.binder_ty == t1}) (e1_typing:typing g e1 eff1 t1) (x:nvar { None? (lookup g (snd x)) }) : T.Tac (continuation_elaborator g ctxt (push_binding g (snd x) (fst x) t1) ctxt) = assert ((push_binding g (snd x) (fst x) t1) `env_extends` g); fun post_hint (| e2, c2, d2 |) -> if eff1 = T.E_Ghost && not (C_STGhost? c2) then fail g (Some e1.range) (Printf.sprintf "Cannot bind ghost expression %s with %s computation" (P.term_to_string e1) (P.comp_to_string c2)); let ppname, x = x in let e2_closed = close_st_term e2 x in assume (open_st_term (close_st_term e2 x) x == e2); let e = wr c2 (Tm_TotBind {binder=b; head=e1;body=e2_closed}) in let c = open_comp_with (close_comp c2 x) e1 in // we just closed assume (~ (x `Set.mem` freevars_st e2_closed)); let d : st_typing g e c = if eff1 = T.E_Total then T_TotBind g e1 e2_closed t1 c2 b x e1_typing d2 else let token = CP.is_non_informative (push_binding g x ppname t1) c2 in match token with | None -> fail g None (Printf.sprintf "Impossible! Non-informative for %s returned None" (P.comp_to_string c2)) | Some token -> let token = FStar.Squash.return_squash token in T_GhostBind g e1 e2_closed t1 c2 b x e1_typing d2 (E (RT.Non_informative_token _ _ token)) in let _ = match post_hint with | None -> () | Some post_hint -> // // The post_hint is well-typed in g // so it should not have x free // // c2 matches post hint, so it should also not have x free // so closing with x, and opening with e1 should be identity // assume (comp_post c == comp_post c2 /\ comp_res c == comp_res c2 /\ comp_u c == comp_u c2) in FV.tot_typing_freevars ctxt_typing; close_with_non_freevar ctxt x 0; LN.tot_typing_ln ctxt_typing; open_with_gt_ln ctxt (-1) e1 0; (| e, c, d |) let rec check_equiv_emp (g:env) (vp:term) : option (vprop_equiv g vp tm_emp) = match vp.t with | Tm_Emp -> Some (VE_Refl _ _) | Tm_Star vp1 vp2 -> (match check_equiv_emp g vp1, check_equiv_emp g vp2 with | Some d1, Some d2 -> let d3 : vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp) = VE_Ctxt _ _ _ _ _ d1 d2 in let d4 : vprop_equiv g (tm_star tm_emp tm_emp) tm_emp = VE_Unit _ _ in Some (VE_Trans _ _ _ _ d3 d4) | _, _ -> None) | _ -> None let intro_comp_typing (g:env) (c:comp_st) (pre_typing:tot_typing g (comp_pre c) tm_vprop) (res_typing:universe_of g (comp_res c) (comp_u c)) (x:var { fresh_wrt x g (freevars (comp_post c)) }) (post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)
false
false
Pulse.Checker.Base.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 1, "initial_ifuel": 1, "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": 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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val intro_comp_typing (g:env) (c:comp_st) (pre_typing:tot_typing g (comp_pre c) tm_vprop) (res_typing:universe_of g (comp_res c) (comp_u c)) (x:var { fresh_wrt x g (freevars (comp_post c)) }) (post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop) : T.Tac (comp_typing g c (comp_u c))
[]
Pulse.Checker.Base.intro_comp_typing
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
g: Pulse.Typing.Env.env -> c: Pulse.Syntax.Base.comp_st -> pre_typing: Pulse.Typing.tot_typing g (Pulse.Syntax.Base.comp_pre c) Pulse.Syntax.Base.tm_vprop -> res_typing: Pulse.Typing.universe_of g (Pulse.Syntax.Base.comp_res c) (Pulse.Syntax.Base.comp_u c) -> x: Pulse.Syntax.Base.var {Pulse.Typing.fresh_wrt x g (Pulse.Syntax.Naming.freevars (Pulse.Syntax.Base.comp_post c))} -> post_typing: Pulse.Typing.tot_typing (Pulse.Typing.Env.push_binding g x Pulse.Syntax.Base.ppname_default (Pulse.Syntax.Base.comp_res c)) (Pulse.Syntax.Naming.open_term (Pulse.Syntax.Base.comp_post c) x) Pulse.Syntax.Base.tm_vprop -> FStar.Tactics.Effect.Tac (Pulse.Typing.comp_typing g c (Pulse.Syntax.Base.comp_u c))
{ "end_col": 40, "end_line": 400, "start_col": 3, "start_line": 378 }
FStar.Tactics.Effect.Tac
val match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post_hint:post_hint_opt g) : T.Tac (t':st_term & c':comp_st & st_typing g t' c')
[ { "abbrev": true, "full_module": "Pulse.Typing.LN", "short_module": "LN" }, { "abbrev": false, "full_module": "Pulse.Typing.Metatheory", "short_module": null }, { "abbrev": true, "full_module": "Pulse.Syntax.Printer", "short_module": "P" }, { "abbrev": true, "full_module": "Pulse.Checker.Pure", "short_module": "CP" }, { "abbrev": true, "full_module": "Pulse.Typing.Metatheory", "short_module": "Metatheory" }, { "abbrev": true, "full_module": "Pulse.RuntimeUtils", "short_module": "RU" }, { "abbrev": true, "full_module": "Pulse.Typing.FV", "short_module": "FV" }, { "abbrev": false, "full_module": "Pulse.Typing.Combinators", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "FStar.List.Tot", "short_module": null }, { "abbrev": true, "full_module": "FStar.Tactics.V2", "short_module": "T" }, { "abbrev": true, "full_module": "FStar.List.Tot", "short_module": "L" }, { "abbrev": true, "full_module": "FStar.Reflection.V2", "short_module": "R" }, { "abbrev": true, "full_module": "FStar.Reflection.Typing", "short_module": "RT" }, { "abbrev": false, "full_module": "Pulse.Checker", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Checker", "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 match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post_hint:post_hint_opt g) : T.Tac (t':st_term & c':comp_st & st_typing g t' c') = match post_hint with | None -> (| t, c, d |) | Some { ret_ty } -> let cres = comp_res c in if eq_tm cres ret_ty then (| t, c, d |) else match Pulse.Checker.Pure.check_equiv g cres ret_ty with | None -> fail g (Some t.range) (Printf.sprintf "Could not prove equiv for computed type %s and expected type %s" (P.term_to_string cres) (P.term_to_string ret_ty)) | Some tok -> let d_equiv : RT.equiv _ (elab_term cres) (elab_term ret_ty) = RT.Rel_eq_token _ _ _ (FStar.Squash.return_squash tok) in let c' = with_st_comp c {(st_comp_of_comp c) with res = ret_ty } in let (| cres_typing, cpre_typing, x, cpost_typing |) = st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d)) in let d_stequiv : st_equiv g c c' = ST_VPropEquiv _ c c' _ cpre_typing cres_typing cpost_typing d_equiv (VE_Refl _ _) (VE_Refl _ _) in (| t, c', T_Equiv _ _ _ _ d d_stequiv |)
val match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post_hint:post_hint_opt g) : T.Tac (t':st_term & c':comp_st & st_typing g t' c') let match_comp_res_with_post_hint (#g: env) (#t: st_term) (#c: comp_st) (d: st_typing g t c) (post_hint: post_hint_opt g) : T.Tac (t': st_term & c': comp_st & st_typing g t' c') =
true
null
false
match post_hint with | None -> (| t, c, d |) | Some { ret_ty = ret_ty } -> let cres = comp_res c in if eq_tm cres ret_ty then (| t, c, d |) else match Pulse.Checker.Pure.check_equiv g cres ret_ty with | None -> fail g (Some t.range) (Printf.sprintf "Could not prove equiv for computed type %s and expected type %s" (P.term_to_string cres) (P.term_to_string ret_ty)) | Some tok -> let d_equiv:RT.equiv _ (elab_term cres) (elab_term ret_ty) = RT.Rel_eq_token _ _ _ (FStar.Squash.return_squash tok) in let c' = with_st_comp c ({ (st_comp_of_comp c) with res = ret_ty }) in let (| cres_typing , cpre_typing , x , cpost_typing |) = st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d)) in let d_stequiv:st_equiv g c c' = ST_VPropEquiv _ c c' _ cpre_typing cres_typing cpost_typing d_equiv (VE_Refl _ _) (VE_Refl _ _) in (| t, c', T_Equiv _ _ _ _ d d_stequiv |)
{ "checked_file": "Pulse.Checker.Base.fst.checked", "dependencies": [ "Pulse.Typing.Metatheory.fsti.checked", "Pulse.Typing.LN.fsti.checked", "Pulse.Typing.FV.fsti.checked", "Pulse.Typing.Combinators.fsti.checked", "Pulse.Syntax.Printer.fsti.checked", "Pulse.RuntimeUtils.fsti.checked", "Pulse.Checker.Pure.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.String.fsti.checked", "FStar.Squash.fsti.checked", "FStar.Set.fsti.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Range.fsti.checked", "FStar.Printf.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.fst.checked", "FStar.Ghost.fsti.checked" ], "interface_file": true, "source_file": "Pulse.Checker.Base.fst" }
[]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.st_term", "Pulse.Syntax.Base.comp_st", "Pulse.Typing.st_typing", "Pulse.Typing.post_hint_opt", "FStar.Pervasives.Mkdtuple3", "FStar.Pervasives.dtuple3", "FStar.Pervasives.Native.option", "Pulse.Syntax.Base.ctag", "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.universe", "Pulse.Typing.universe_of", "FStar.Ghost.erased", "FStar.Reflection.Typing.tot_typing", "Pulse.Typing.elab_env", "FStar.Reflection.Typing.mk_abs", "Pulse.Elaborate.Pure.elab_term", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Reflection.Typing.mk_arrow", "Pulse.Syntax.Base.tm_vprop", "Pulse.Syntax.Base.eq_tm", "Prims.bool", "Pulse.Typing.Env.fail", "FStar.Pervasives.Native.Some", "Pulse.Syntax.Base.range", "Pulse.Syntax.Base.__proj__Mkst_term__item__range", "Prims.string", "FStar.Printf.sprintf", "Pulse.Syntax.Printer.term_to_string", "FStar.Tactics.Types.equiv_token", "Pulse.Syntax.Base.__proj__Mkst_comp__item__res", "Pulse.Syntax.Base.st_comp_of_comp", "Pulse.Syntax.Base.__proj__Mkst_comp__item__u", "Pulse.Typing.tot_typing", "Pulse.Syntax.Base.__proj__Mkst_comp__item__pre", "Pulse.Syntax.Base.var", "Pulse.Typing.fresh_wrt", "Pulse.Syntax.Naming.freevars", "Pulse.Syntax.Base.__proj__Mkst_comp__item__post", "Pulse.Typing.Env.push_binding", "Pulse.Syntax.Base.ppname_default", "Pulse.Syntax.Naming.open_term", "Pulse.Typing.T_Equiv", "Pulse.Typing.st_equiv", "Pulse.Typing.ST_VPropEquiv", "Pulse.Typing.VE_Refl", "Pulse.Syntax.Base.comp_pre", "Pulse.Syntax.Base.comp_res", "Pulse.Syntax.Base.comp_post", "FStar.Pervasives.dtuple4", "Pulse.Typing.Metatheory.Base.st_comp_typing_inversion", "Pulse.Typing.Metatheory.Base.comp_typing_inversion", "Pulse.Typing.Metatheory.Base.st_typing_correctness", "Pulse.Syntax.Base.comp", "Pulse.Syntax.Base.with_st_comp", "Pulse.Syntax.Base.Mkst_comp", "Pulse.Syntax.Base.st_comp", "FStar.Reflection.Typing.equiv", "FStar.Reflection.Typing.Rel_eq_token", "FStar.Squash.return_squash", "Pulse.Checker.Pure.check_equiv" ]
[]
module Pulse.Checker.Base module T = FStar.Tactics.V2 module RT = FStar.Reflection.Typing module Metatheory = Pulse.Typing.Metatheory module CP = Pulse.Checker.Pure module RU = Pulse.RuntimeUtils module FV = Pulse.Typing.FV module P = Pulse.Syntax.Printer open Pulse.Typing.Combinators open Pulse.Typing.Metatheory let format_failed_goal (g:env) (ctxt:list term) (goal:list term) = let terms_to_strings (ts:list term)= T.map Pulse.Syntax.Printer.term_to_string ts in let numbered_list ss = let _, s = T.fold_left (fun (i, acc) s -> (i+1, Printf.sprintf "%d. %s" i s :: acc)) (1, []) ss in String.concat "\n " (List.rev s) in let format_terms (ts:list term) = numbered_list (terms_to_strings ts) in Printf.sprintf "Failed to prove the following goals:\n \ %s\n\ The remaining conjuncts in the separation logic context available for use are:\n \ %s\n\ The typing context is:\n \ %s\n" (format_terms goal) (format_terms ctxt) (env_to_string g) let mk_arrow ty t = RT.mk_arrow (elab_term ty) T.Q_Explicit (elab_term t) let mk_abs ty t = RT.(mk_abs (elab_term ty) T.Q_Explicit (elab_term t)) let post_typing_as_abstraction (#g:env) (#x:var) (#ty:term) (#t:term { fresh_wrt x g (freevars t) }) (_:tot_typing (push_binding g x ppname_default ty) (open_term t x) tm_vprop) : FStar.Ghost.erased (RT.tot_typing (elab_env g) (mk_abs ty t) (mk_arrow ty tm_vprop)) = admit() let intro_post_hint g ctag_opt ret_ty_opt post = let x = fresh g in let ret_ty = match ret_ty_opt with | None -> tm_fstar RT.unit_ty FStar.Range.range_0 | Some t -> t in let ret_ty, _ = CP.instantiate_term_implicits g ret_ty in let (| u, ty_typing |) = CP.check_universe g ret_ty in let (| post, post_typing |) = CP.check_vprop (push_binding g x ppname_default ret_ty) (open_term_nv post (v_as_nv x)) in let post' = close_term post x in Pulse.Typing.FV.freevars_close_term post x 0; assume (open_term post' x == post); { g; ctag_hint=ctag_opt; ret_ty; u; ty_typing; post=post'; post_typing=post_typing_as_abstraction #_ #_ #_ #post' post_typing } let post_hint_from_comp_typing #g #c ct = let st_comp_typing = Metatheory.comp_typing_inversion ct in let (| ty_typing, pre_typing, x, post_typing |) = Metatheory.st_comp_typing_inversion st_comp_typing in let p : post_hint_t = { g; ctag_hint = Some (ctag_of_comp_st c); ret_ty = comp_res c; u=comp_u c; ty_typing=ty_typing; post=comp_post c; post_typing=post_typing_as_abstraction post_typing } in p let k_elab_unit (g:env) (ctxt:term) : continuation_elaborator g ctxt g ctxt = fun p r -> r let k_elab_trans (#g0:env) (#g1:env { g1 `env_extends` g0 }) (#g2:env { g2 `env_extends` g1 }) (#ctxt0 #ctxt1 #ctxt2:term) (k0:continuation_elaborator g0 ctxt0 g1 ctxt1) (k1:continuation_elaborator g1 ctxt1 g2 ctxt2 { g1 `env_extends` g0}) : continuation_elaborator g0 ctxt0 g2 ctxt2 = fun post_hint res -> k0 post_hint (k1 post_hint res) let comp_st_with_post (c:comp_st) (post:term) : c':comp_st { st_comp_of_comp c' == ({ st_comp_of_comp c with post} <: st_comp) } = match c with | C_ST st -> C_ST { st with post } | C_STGhost i st -> C_STGhost i { st with post } | C_STAtomic i st -> C_STAtomic i {st with post} let ve_unit_r g (p:term) : vprop_equiv g (tm_star p tm_emp) p = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _) let st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2) : option (st_equiv g c0 c2) = let ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 = d01 in let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in if x = y && eq_tm (comp_res c0) (comp_res c1) then Some ( ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12) (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12) (VE_Trans _ _ _ _ eq_post_01 eq_post_12) ) else None let t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c') : st_typing g st c' = match d with | T_Equiv _ _ _ _ d0 eq' -> ( match st_equiv_trans eq' eq with | None -> T_Equiv _ _ _ _ d eq | Some eq'' -> T_Equiv _ _ _ _ d0 eq'' ) | _ -> T_Equiv _ _ _ _ d eq let st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { freevars post `Set.subset` freevars (comp_post c)}) (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } -> vprop_equiv (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) (open_term post x))) : st_typing g t (comp_st_with_post c post) = if eq_tm post (comp_post c) then d else let c' = comp_st_with_post c post in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let veq = veq x in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq in t_equiv d st_equiv let simplify_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post:term { comp_post c == tm_star post tm_emp}) : st_typing g t (comp_st_with_post c post) = st_equiv_post d post (fun x -> ve_unit_r (push_binding g x ppname_default (comp_res c)) (open_term post x)) let simplify_lemma (c:comp_st) (c':comp_st) (post_hint:option post_hint_t) : Lemma (requires comp_post_matches_hint c post_hint /\ comp_res c' == comp_res c /\ comp_u c' == comp_u c /\ comp_post c' == tm_star (comp_post c) tm_emp) (ensures comp_post_matches_hint (comp_st_with_post c' (comp_post c)) post_hint /\ comp_pre (comp_st_with_post c' (comp_post c)) == comp_pre c') = () let vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g p ctxt) : tot_typing g p tm_vprop = let _, bk = vprop_equiv_typing d in bk ctxt_typing let comp_with_pre (c:comp_st) (pre:term) = match c with | C_ST st -> C_ST { st with pre } | C_STGhost i st -> C_STGhost i { st with pre } | C_STAtomic i st -> C_STAtomic i {st with pre} let st_equiv_pre (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (pre:term) (veq: vprop_equiv g (comp_pre c) pre) : st_typing g t (comp_with_pre c pre) = if eq_tm pre (comp_pre c) then d else let c' = comp_with_pre c pre in let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness d))) in let st_equiv : st_equiv g c c' = ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) veq (VE_Refl _ _) in t_equiv d st_equiv #push-options "--z3rlimit_factor 4 --ifuel 2 --fuel 0" let k_elab_equiv_continuation (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt #ctxt1 #ctxt2:term) (k:continuation_elaborator g1 ctxt g2 ctxt1) (d:vprop_equiv g2 ctxt1 ctxt2) : continuation_elaborator g1 ctxt g2 ctxt2 = fun post_hint res -> let (| st, c, st_d |) = res in let st_d : st_typing g2 st c = st_d in assert (comp_pre c == ctxt2); let st_d' : st_typing g2 st (comp_with_pre c ctxt1) = st_equiv_pre st_d _ (VE_Sym _ _ _ d) in k post_hint (| st, _, st_d' |) #pop-options let vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop) (#p:_) (d:vprop_equiv g ctxt p) : tot_typing g p tm_vprop = let fwd, _ = vprop_equiv_typing d in fwd ctxt_typing #push-options "--z3rlimit_factor 4 --ifuel 1 --fuel 0" let k_elab_equiv_prefix (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt2 #ctxt:term) (k:continuation_elaborator g1 ctxt1 g2 ctxt) (d:vprop_equiv g1 ctxt1 ctxt2) : continuation_elaborator g1 ctxt2 g2 ctxt = fun post_hint res -> let framing_token : frame_for_req_in_ctxt g1 ctxt2 ctxt1 = let d = VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Trans _ _ _ _ (VE_Unit _ _) d) in (| tm_emp, emp_typing, d |) in let res = k post_hint res in let (| st, c, st_d |) = res in assert (comp_pre c == ctxt1); (| _, _, st_equiv_pre st_d _ d |) #pop-options let k_elab_equiv (#g1:env) (#g2:env { g2 `env_extends` g1 }) (#ctxt1 #ctxt1' #ctxt2 #ctxt2':term) (k:continuation_elaborator g1 ctxt1 g2 ctxt2) (d1:vprop_equiv g1 ctxt1 ctxt1') (d2:vprop_equiv g2 ctxt2 ctxt2') : continuation_elaborator g1 ctxt1' g2 ctxt2' = let k : continuation_elaborator g1 ctxt1 g2 ctxt2' = k_elab_equiv_continuation k d2 in let k : continuation_elaborator g1 ctxt1' g2 ctxt2' = k_elab_equiv_prefix k d1 in k #push-options "--query_stats --fuel 2 --ifuel 2 --split_queries no --z3rlimit_factor 20" let continuation_elaborator_with_bind (#g:env) (ctxt:term) (#c1:comp{stateful_comp c1}) (#e1:st_term) (e1_typing:st_typing g e1 c1) (ctxt_pre1_typing:tot_typing g (tm_star ctxt (comp_pre c1)) tm_vprop) (x:nvar { None? (lookup g (snd x)) }) : T.Tac (continuation_elaborator g (tm_star ctxt (comp_pre c1)) (push_binding g (snd x) (fst x) (comp_res c1)) (tm_star (open_term (comp_post c1) (snd x)) ctxt)) = let pre1 = comp_pre c1 in let res1 = comp_res c1 in let post1 = comp_post c1 in let ctxt_typing = star_typing_inversion_l ctxt_pre1_typing in // let p_prop = Metatheory.pure_typing_inversion pure_typing in let v_eq = VE_Comm g ctxt pre1 in let framing_token : frame_for_req_in_ctxt g (tm_star ctxt pre1) pre1 = (| ctxt, ctxt_typing, VE_Comm g pre1 ctxt |) in let (| c1, e1_typing |) = apply_frame ctxt_pre1_typing e1_typing framing_token in let (| u_of_1, pre_typing, _, _ |) = Metatheory.(st_comp_typing_inversion (comp_typing_inversion (st_typing_correctness e1_typing))) in let b = res1 in let ppname, x = x in let g' = push_binding g x ppname b in let post1_opened = open_term_nv post1 (v_as_nv x) in let k : continuation_elaborator g (tm_star ctxt pre1) g' (tm_star post1_opened ctxt) = fun post_hint res -> let (| e2, c2, e2_typing |) = res in let e2_typing : st_typing g' e2 c2 = e2_typing in let e2_closed = close_st_term e2 x in assume (open_st_term e2_closed x == e2); assert (comp_pre c1 == (tm_star ctxt pre1)); assert (comp_post c1 == tm_star post1 ctxt); assert (comp_pre c2 == tm_star post1_opened ctxt); assert (open_term (comp_post c1) x == tm_star post1_opened (open_term ctxt x)); // ctxt is well-typed, hence ln assume (open_term ctxt x == ctxt); assert (open_term (comp_post c1) x == comp_pre c2); // we closed e2 with x assume (~ (x `Set.mem` freevars_st e2_closed)); if x `Set.mem` freevars (comp_post c2) then fail g' None "Impossible: freevar clash when constructing continuation elaborator for bind, please file a bug-report" else ( let t_typing, post_typing = Pulse.Typing.Combinators.bind_res_and_post_typing g (st_comp_of_comp c2) x post_hint in let (| e, c, e_typing |) = Pulse.Typing.Combinators.mk_bind g (tm_star ctxt pre1) e1 e2_closed c1 c2 (ppname, x) e1_typing u_of_1 e2_typing t_typing post_typing in (| e, c, e_typing |) ) in k #pop-options module LN = Pulse.Typing.LN #push-options "--z3rlimit_factor 4 --fuel 1 --ifuel 1" let continuation_elaborator_with_let (#g:env) (#ctxt:term) (ctxt_typing:tot_typing g ctxt tm_vprop) (#e1:term) (#eff1:T.tot_or_ghost) (#t1:term) (b:binder{b.binder_ty == t1}) (e1_typing:typing g e1 eff1 t1) (x:nvar { None? (lookup g (snd x)) }) : T.Tac (continuation_elaborator g ctxt (push_binding g (snd x) (fst x) t1) ctxt) = assert ((push_binding g (snd x) (fst x) t1) `env_extends` g); fun post_hint (| e2, c2, d2 |) -> if eff1 = T.E_Ghost && not (C_STGhost? c2) then fail g (Some e1.range) (Printf.sprintf "Cannot bind ghost expression %s with %s computation" (P.term_to_string e1) (P.comp_to_string c2)); let ppname, x = x in let e2_closed = close_st_term e2 x in assume (open_st_term (close_st_term e2 x) x == e2); let e = wr c2 (Tm_TotBind {binder=b; head=e1;body=e2_closed}) in let c = open_comp_with (close_comp c2 x) e1 in // we just closed assume (~ (x `Set.mem` freevars_st e2_closed)); let d : st_typing g e c = if eff1 = T.E_Total then T_TotBind g e1 e2_closed t1 c2 b x e1_typing d2 else let token = CP.is_non_informative (push_binding g x ppname t1) c2 in match token with | None -> fail g None (Printf.sprintf "Impossible! Non-informative for %s returned None" (P.comp_to_string c2)) | Some token -> let token = FStar.Squash.return_squash token in T_GhostBind g e1 e2_closed t1 c2 b x e1_typing d2 (E (RT.Non_informative_token _ _ token)) in let _ = match post_hint with | None -> () | Some post_hint -> // // The post_hint is well-typed in g // so it should not have x free // // c2 matches post hint, so it should also not have x free // so closing with x, and opening with e1 should be identity // assume (comp_post c == comp_post c2 /\ comp_res c == comp_res c2 /\ comp_u c == comp_u c2) in FV.tot_typing_freevars ctxt_typing; close_with_non_freevar ctxt x 0; LN.tot_typing_ln ctxt_typing; open_with_gt_ln ctxt (-1) e1 0; (| e, c, d |) let rec check_equiv_emp (g:env) (vp:term) : option (vprop_equiv g vp tm_emp) = match vp.t with | Tm_Emp -> Some (VE_Refl _ _) | Tm_Star vp1 vp2 -> (match check_equiv_emp g vp1, check_equiv_emp g vp2 with | Some d1, Some d2 -> let d3 : vprop_equiv g (tm_star vp1 vp2) (tm_star tm_emp tm_emp) = VE_Ctxt _ _ _ _ _ d1 d2 in let d4 : vprop_equiv g (tm_star tm_emp tm_emp) tm_emp = VE_Unit _ _ in Some (VE_Trans _ _ _ _ d3 d4) | _, _ -> None) | _ -> None let intro_comp_typing (g:env) (c:comp_st) (pre_typing:tot_typing g (comp_pre c) tm_vprop) (res_typing:universe_of g (comp_res c) (comp_u c)) (x:var { fresh_wrt x g (freevars (comp_post c)) }) (post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop) : T.Tac (comp_typing g c (comp_u c)) = let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\ comp_pre c == st.pre /\ comp_res c == st.res /\ comp_post c == st.post } ) : T.Tac (st_comp_typing g st) = STC g st x res_typing pre_typing post_typing in match c with | C_ST st -> let stc = intro_st_comp_typing st in CT_ST _ _ stc | C_STAtomic i st -> let stc = intro_st_comp_typing st in let (| ty, i_typing |) = CP.core_check_tot_term g i in if not (eq_tm ty tm_inames) then fail g None (Printf.sprintf "ill-typed inames term %s" (P.term_to_string i)) else CT_STAtomic _ _ _ i_typing stc | C_STGhost i st -> let stc = intro_st_comp_typing st in let (| ty, i_typing |) = CP.core_check_tot_term g i in if not (eq_tm ty tm_inames) then fail g None (Printf.sprintf "ill-typed inames term %s" (P.term_to_string i)) else CT_STGhost _ _ _ i_typing stc let return_in_ctxt (g:env) (y:var) (y_ppname:ppname) (u:universe) (ty:term) (ctxt:vprop) (ty_typing:universe_of g ty u) (post_hint0:post_hint_opt g { Some? post_hint0 /\ checker_res_matches_post_hint g post_hint0 y ty ctxt}) : Pure (st_typing_in_ctxt g ctxt post_hint0) (requires lookup g y == Some ty) (ensures fun _ -> True) = let Some post_hint = post_hint0 in let x = fresh g in assume (~ (x `Set.mem` freevars post_hint.post)); let ctag = match post_hint.ctag_hint with | None -> STT | Some ctag -> ctag in let y_tm = tm_var {nm_index=y;nm_ppname=y_ppname} in let d = T_Return g ctag false u ty y_tm post_hint.post x ty_typing (magic ()) // that null_var y is well typed at ty in g, we know since lookup g y == Some ty (magic ()) // typing of (open post x) in (g, x) ... post_hint is well-typed, so should get in let t = wtag (Some ctag) (Tm_Return {ctag=ctag;insert_eq=false;term=y_tm}) in let c = comp_return ctag false u ty y_tm post_hint.post x in let d : st_typing g t c = d in let _ :squash (comp_pre c == ctxt /\ comp_post_matches_hint c (Some post_hint)) = match post_hint0 with | Some post_hint -> // this u should follow from equality of t assume (comp_u c == post_hint.u) in (| _, _, d |) let match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post_hint:post_hint_opt g) : T.Tac (t':st_term & c':comp_st & st_typing g t' c') =
false
false
Pulse.Checker.Base.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 1, "initial_ifuel": 1, "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": 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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val match_comp_res_with_post_hint (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c) (post_hint:post_hint_opt g) : T.Tac (t':st_term & c':comp_st & st_typing g t' c')
[]
Pulse.Checker.Base.match_comp_res_with_post_hint
{ "file_name": "lib/steel/pulse/Pulse.Checker.Base.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
d: Pulse.Typing.st_typing g t c -> post_hint: Pulse.Typing.post_hint_opt g -> FStar.Tactics.Effect.Tac (FStar.Pervasives.dtuple3 Pulse.Syntax.Base.st_term (fun _ -> Pulse.Syntax.Base.comp_st) (fun t' c' -> Pulse.Typing.st_typing g t' c'))
{ "end_col": 51, "end_line": 467, "start_col": 2, "start_line": 442 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 u16 = U16.t
let u16 =
false
null
false
U16.t
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "FStar.UInt16.t" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char
false
true
FStar.Bytes.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 u16 : Prims.eqtype
[]
FStar.Bytes.u16
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
Prims.eqtype
{ "end_col": 22, "end_line": 41, "start_col": 17, "start_line": 41 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 length b = FStar.UInt32.v (len b)
let length b =
false
null
false
FStar.UInt32.v (len b)
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "FStar.Bytes.bytes", "FStar.UInt32.v", "FStar.Bytes.len", "FStar.UInt.uint_t" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32
false
false
FStar.Bytes.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 length : b: FStar.Bytes.bytes -> FStar.UInt.uint_t 32
[]
FStar.Bytes.length
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
b: FStar.Bytes.bytes -> FStar.UInt.uint_t 32
{ "end_col": 44, "end_line": 52, "start_col": 22, "start_line": 52 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 u32 = U32.t
let u32 =
false
null
false
U32.t
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "FStar.UInt32.t" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t
false
true
FStar.Bytes.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 u32 : Prims.eqtype
[]
FStar.Bytes.u32
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
Prims.eqtype
{ "end_col": 22, "end_line": 42, "start_col": 17, "start_line": 42 }
Prims.Pure
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 op_String_Access = get
let op_String_Access =
false
null
false
get
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[]
[ "FStar.Bytes.get" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k} let lbytes32 (l:UInt32.t) = b:bytes{len b = l} val empty_bytes : lbytes 0 val empty_unique: b:bytes -> Lemma (length b = 0 ==> b = empty_bytes) [SMTPat (len b)] (** If you statically know the length, it is OK to read at arbitrary indexes *) val get: b:bytes -> pos:u32{U32.v pos < length b} -> Pure byte (requires True) (ensures (fun y -> y == S.index (reveal b) (U32.v pos)))
false
false
FStar.Bytes.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 op_String_Access : b: FStar.Bytes.bytes -> pos: FStar.Bytes.u32{FStar.UInt32.v pos < FStar.Bytes.length b} -> Prims.Pure FStar.Bytes.byte
[]
FStar.Bytes.op_String_Access
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
b: FStar.Bytes.bytes -> pos: FStar.Bytes.u32{FStar.UInt32.v pos < FStar.Bytes.length b} -> Prims.Pure FStar.Bytes.byte
{ "end_col": 33, "end_line": 98, "start_col": 30, "start_line": 98 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 u8 = U8.t
let u8 =
false
null
false
U8.t
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "FStar.UInt8.t" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char
false
true
FStar.Bytes.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 u8 : Prims.eqtype
[]
FStar.Bytes.u8
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
Prims.eqtype
{ "end_col": 20, "end_line": 40, "start_col": 16, "start_line": 40 }
Prims.Pure
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 op_At_Bar = append
let op_At_Bar =
false
null
false
append
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[]
[ "FStar.Bytes.append" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k} let lbytes32 (l:UInt32.t) = b:bytes{len b = l} val empty_bytes : lbytes 0 val empty_unique: b:bytes -> Lemma (length b = 0 ==> b = empty_bytes) [SMTPat (len b)] (** If you statically know the length, it is OK to read at arbitrary indexes *) val get: b:bytes -> pos:u32{U32.v pos < length b} -> Pure byte (requires True) (ensures (fun y -> y == S.index (reveal b) (U32.v pos))) unfold let op_String_Access = get unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i) let equal b1 b2 = length b1 = length b2 /\ (forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i]) val extensionality: b1:bytes -> b2:bytes -> Lemma (requires (equal b1 b2)) (ensures (b1 = b2)) (** creating byte values **) val create: len:u32 -> v:byte -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v} unfold let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v val init: len:u32 -> f:(i:u32{U32.(i <^ len)} -> byte) -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == f i} // this is a hack JROESCH val abyte (b:byte) : lbytes 1 (* admit () create 1ul b *) val twobytes (b:byte*byte) : lbytes 2 // init 2ul (fun i -> if i = 0ul then fst b else snd b) (** appending bytes **) val append: b1:bytes -> b2:bytes -> Pure bytes (requires (UInt.size (length b1 + length b2) U32.n))
false
false
FStar.Bytes.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 op_At_Bar : b1: FStar.Bytes.bytes -> b2: FStar.Bytes.bytes -> Prims.Pure FStar.Bytes.bytes
[]
FStar.Bytes.op_At_Bar
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
b1: FStar.Bytes.bytes -> b2: FStar.Bytes.bytes -> Prims.Pure FStar.Bytes.bytes
{ "end_col": 29, "end_line": 140, "start_col": 23, "start_line": 140 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 lbytes32 (l:UInt32.t) = b:bytes{len b = l}
let lbytes32 (l: UInt32.t) =
false
null
false
b: bytes{len b = l}
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "FStar.UInt32.t", "FStar.Bytes.bytes", "Prims.b2t", "Prims.op_Equality", "FStar.Bytes.len" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k}
false
true
FStar.Bytes.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 lbytes32 : l: FStar.UInt32.t -> Type0
[]
FStar.Bytes.lbytes32
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
l: FStar.UInt32.t -> Type0
{ "end_col": 46, "end_line": 82, "start_col": 28, "start_line": 82 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v
let create_ (n: nat{FStar.UInt.size n U32.n}) v =
false
null
false
create (U32.uint_to_t n) v
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "Prims.nat", "FStar.UInt.size", "FStar.UInt32.n", "FStar.Bytes.byte", "FStar.Bytes.create", "FStar.UInt32.uint_to_t", "FStar.Bytes.lbytes", "FStar.UInt32.v", "Prims.l_Forall", "FStar.Bytes.u32", "Prims.b2t", "FStar.UInt32.op_Less_Hat", "Prims.eq2", "FStar.Bytes.op_String_Access" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k} let lbytes32 (l:UInt32.t) = b:bytes{len b = l} val empty_bytes : lbytes 0 val empty_unique: b:bytes -> Lemma (length b = 0 ==> b = empty_bytes) [SMTPat (len b)] (** If you statically know the length, it is OK to read at arbitrary indexes *) val get: b:bytes -> pos:u32{U32.v pos < length b} -> Pure byte (requires True) (ensures (fun y -> y == S.index (reveal b) (U32.v pos))) unfold let op_String_Access = get unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i) let equal b1 b2 = length b1 = length b2 /\ (forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i]) val extensionality: b1:bytes -> b2:bytes -> Lemma (requires (equal b1 b2)) (ensures (b1 = b2)) (** creating byte values **) val create: len:u32 -> v:byte -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v}
false
false
FStar.Bytes.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 create_ : n: Prims.nat{FStar.UInt.size n FStar.UInt32.n} -> v: FStar.Bytes.byte -> b: FStar.Bytes.lbytes (FStar.UInt32.v (FStar.UInt32.uint_to_t n)) {forall (i: FStar.Bytes.u32{i <^ FStar.UInt32.uint_to_t n}). {:pattern b.[ i ]} b.[ i ] == v}
[]
FStar.Bytes.create_
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
n: Prims.nat{FStar.UInt.size n FStar.UInt32.n} -> v: FStar.Bytes.byte -> b: FStar.Bytes.lbytes (FStar.UInt32.v (FStar.UInt32.uint_to_t n)) {forall (i: FStar.Bytes.u32{i <^ FStar.UInt32.uint_to_t n}). {:pattern b.[ i ]} b.[ i ] == v}
{ "end_col": 75, "end_line": 119, "start_col": 49, "start_line": 119 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i)
let index (b: bytes) (i: nat{i < length b}) =
false
null
false
get b (U32.uint_to_t i)
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "FStar.Bytes.bytes", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "FStar.Bytes.length", "FStar.Bytes.get", "FStar.UInt32.uint_to_t", "FStar.Bytes.byte" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k} let lbytes32 (l:UInt32.t) = b:bytes{len b = l} val empty_bytes : lbytes 0 val empty_unique: b:bytes -> Lemma (length b = 0 ==> b = empty_bytes) [SMTPat (len b)] (** If you statically know the length, it is OK to read at arbitrary indexes *) val get: b:bytes -> pos:u32{U32.v pos < length b} -> Pure byte (requires True) (ensures (fun y -> y == S.index (reveal b) (U32.v pos))) unfold let op_String_Access = get
false
false
FStar.Bytes.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 index : b: FStar.Bytes.bytes -> i: Prims.nat{i < FStar.Bytes.length b} -> FStar.Bytes.byte
[]
FStar.Bytes.index
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
b: FStar.Bytes.bytes -> i: Prims.nat{i < FStar.Bytes.length b} -> FStar.Bytes.byte
{ "end_col": 74, "end_line": 100, "start_col": 51, "start_line": 100 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 equal b1 b2 = length b1 = length b2 /\ (forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i])
let equal b1 b2 =
false
null
false
length b1 = length b2 /\ (forall (i: u32{U32.v i < length b1}). {:pattern (b1.[ i ]); (b2.[ i ])} b1.[ i ] == b2.[ i ])
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "FStar.Bytes.bytes", "Prims.l_and", "Prims.b2t", "Prims.op_Equality", "FStar.UInt.uint_t", "FStar.Bytes.length", "Prims.l_Forall", "FStar.Bytes.u32", "Prims.op_LessThan", "FStar.UInt32.v", "Prims.eq2", "FStar.Bytes.byte", "FStar.Bytes.op_String_Access", "Prims.logical" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k} let lbytes32 (l:UInt32.t) = b:bytes{len b = l} val empty_bytes : lbytes 0 val empty_unique: b:bytes -> Lemma (length b = 0 ==> b = empty_bytes) [SMTPat (len b)] (** If you statically know the length, it is OK to read at arbitrary indexes *) val get: b:bytes -> pos:u32{U32.v pos < length b} -> Pure byte (requires True) (ensures (fun y -> y == S.index (reveal b) (U32.v pos))) unfold let op_String_Access = get unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i)
false
true
FStar.Bytes.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 equal : b1: FStar.Bytes.bytes -> b2: FStar.Bytes.bytes -> Prims.logical
[]
FStar.Bytes.equal
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
b1: FStar.Bytes.bytes -> b2: FStar.Bytes.bytes -> Prims.logical
{ "end_col": 86, "end_line": 104, "start_col": 2, "start_line": 103 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 split_ b (k:nat{FStar.UInt.size k U32.n /\ k < length b}) = split b (U32.uint_to_t k)
let split_ b (k: nat{FStar.UInt.size k U32.n /\ k < length b}) =
false
null
false
split b (U32.uint_to_t k)
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "FStar.Bytes.bytes", "Prims.nat", "Prims.l_and", "FStar.UInt.size", "FStar.UInt32.n", "Prims.b2t", "Prims.op_LessThan", "FStar.Bytes.length", "FStar.Bytes.split", "FStar.UInt32.uint_to_t", "FStar.Pervasives.Native.tuple2", "Prims.eq2", "FStar.Seq.Base.seq", "FStar.Bytes.byte", "FStar.Pervasives.Native.Mktuple2", "FStar.Bytes.reveal", "FStar.Seq.Properties.split", "FStar.UInt32.v" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k} let lbytes32 (l:UInt32.t) = b:bytes{len b = l} val empty_bytes : lbytes 0 val empty_unique: b:bytes -> Lemma (length b = 0 ==> b = empty_bytes) [SMTPat (len b)] (** If you statically know the length, it is OK to read at arbitrary indexes *) val get: b:bytes -> pos:u32{U32.v pos < length b} -> Pure byte (requires True) (ensures (fun y -> y == S.index (reveal b) (U32.v pos))) unfold let op_String_Access = get unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i) let equal b1 b2 = length b1 = length b2 /\ (forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i]) val extensionality: b1:bytes -> b2:bytes -> Lemma (requires (equal b1 b2)) (ensures (b1 = b2)) (** creating byte values **) val create: len:u32 -> v:byte -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v} unfold let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v val init: len:u32 -> f:(i:u32{U32.(i <^ len)} -> byte) -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == f i} // this is a hack JROESCH val abyte (b:byte) : lbytes 1 (* admit () create 1ul b *) val twobytes (b:byte*byte) : lbytes 2 // init 2ul (fun i -> if i = 0ul then fst b else snd b) (** appending bytes **) val append: b1:bytes -> b2:bytes -> Pure bytes (requires (UInt.size (length b1 + length b2) U32.n)) (ensures (fun b -> reveal b == S.append (reveal b1) (reveal b2))) unfold let op_At_Bar = append val slice: b:bytes -> s:u32 -> e:u32{U32.(s <=^ e) /\ U32.v e <= length b} -> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v e)} let slice_ b (s:nat) (e:nat{s <= e /\ e <= length b}) = slice b (U32.uint_to_t s) (U32.uint_to_t e) val sub: b:bytes -> s:u32 -> l:u32{U32.v s + U32.v l <= length b} -> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v s + U32.v l)} val split: b:bytes -> k:u32{U32.v k <= length b} -> p:(bytes*bytes){ let x, y = p in (reveal x, reveal y) == Seq.split (reveal b) (U32.v k)}
false
false
FStar.Bytes.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 split_ : b: FStar.Bytes.bytes -> k: Prims.nat{FStar.UInt.size k FStar.UInt32.n /\ k < FStar.Bytes.length b} -> p: (FStar.Bytes.bytes * FStar.Bytes.bytes) { let _ = p in (let FStar.Pervasives.Native.Mktuple2 #_ #_ x y = _ in FStar.Pervasives.Native.Mktuple2 (FStar.Bytes.reveal x) (FStar.Bytes.reveal y) == FStar.Seq.Properties.split (FStar.Bytes.reveal b) (FStar.UInt32.v (FStar.UInt32.uint_to_t k))) <: Type0 }
[]
FStar.Bytes.split_
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
b: FStar.Bytes.bytes -> k: Prims.nat{FStar.UInt.size k FStar.UInt32.n /\ k < FStar.Bytes.length b} -> p: (FStar.Bytes.bytes * FStar.Bytes.bytes) { let _ = p in (let FStar.Pervasives.Native.Mktuple2 #_ #_ x y = _ in FStar.Pervasives.Native.Mktuple2 (FStar.Bytes.reveal x) (FStar.Bytes.reveal y) == FStar.Seq.Properties.split (FStar.Bytes.reveal b) (FStar.UInt32.v (FStar.UInt32.uint_to_t k))) <: Type0 }
{ "end_col": 96, "end_line": 162, "start_col": 71, "start_line": 162 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 slice_ b (s:nat) (e:nat{s <= e /\ e <= length b}) = slice b (U32.uint_to_t s) (U32.uint_to_t e)
let slice_ b (s: nat) (e: nat{s <= e /\ e <= length b}) =
false
null
false
slice b (U32.uint_to_t s) (U32.uint_to_t e)
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "FStar.Bytes.bytes", "Prims.nat", "Prims.l_and", "Prims.b2t", "Prims.op_LessThanOrEqual", "FStar.Bytes.length", "FStar.Bytes.slice", "FStar.UInt32.uint_to_t", "Prims.eq2", "FStar.Seq.Base.seq", "FStar.Bytes.byte", "FStar.Bytes.reveal", "FStar.Seq.Base.slice", "FStar.UInt32.v" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k} let lbytes32 (l:UInt32.t) = b:bytes{len b = l} val empty_bytes : lbytes 0 val empty_unique: b:bytes -> Lemma (length b = 0 ==> b = empty_bytes) [SMTPat (len b)] (** If you statically know the length, it is OK to read at arbitrary indexes *) val get: b:bytes -> pos:u32{U32.v pos < length b} -> Pure byte (requires True) (ensures (fun y -> y == S.index (reveal b) (U32.v pos))) unfold let op_String_Access = get unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i) let equal b1 b2 = length b1 = length b2 /\ (forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i]) val extensionality: b1:bytes -> b2:bytes -> Lemma (requires (equal b1 b2)) (ensures (b1 = b2)) (** creating byte values **) val create: len:u32 -> v:byte -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v} unfold let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v val init: len:u32 -> f:(i:u32{U32.(i <^ len)} -> byte) -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == f i} // this is a hack JROESCH val abyte (b:byte) : lbytes 1 (* admit () create 1ul b *) val twobytes (b:byte*byte) : lbytes 2 // init 2ul (fun i -> if i = 0ul then fst b else snd b) (** appending bytes **) val append: b1:bytes -> b2:bytes -> Pure bytes (requires (UInt.size (length b1 + length b2) U32.n)) (ensures (fun b -> reveal b == S.append (reveal b1) (reveal b2))) unfold let op_At_Bar = append val slice: b:bytes -> s:u32 -> e:u32{U32.(s <=^ e) /\ U32.v e <= length b}
false
false
FStar.Bytes.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 slice_ : b: FStar.Bytes.bytes -> s: Prims.nat -> e: Prims.nat{s <= e /\ e <= FStar.Bytes.length b} -> r: FStar.Bytes.bytes { FStar.Bytes.reveal r == FStar.Seq.Base.slice (FStar.Bytes.reveal b) (FStar.UInt32.v (FStar.UInt32.uint_to_t s)) (FStar.UInt32.v (FStar.UInt32.uint_to_t e)) }
[]
FStar.Bytes.slice_
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
b: FStar.Bytes.bytes -> s: Prims.nat -> e: Prims.nat{s <= e /\ e <= FStar.Bytes.length b} -> r: FStar.Bytes.bytes { FStar.Bytes.reveal r == FStar.Seq.Base.slice (FStar.Bytes.reveal b) (FStar.UInt32.v (FStar.UInt32.uint_to_t s)) (FStar.UInt32.v (FStar.UInt32.uint_to_t e)) }
{ "end_col": 99, "end_line": 147, "start_col": 56, "start_line": 147 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 fits_in_k_bytes (n:nat) (k:nat) = FStar.UInt.size n (op_Multiply 8 k)
let fits_in_k_bytes (n k: nat) =
false
null
false
FStar.UInt.size n (op_Multiply 8 k)
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "Prims.nat", "FStar.UInt.size", "Prims.op_Multiply" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k} let lbytes32 (l:UInt32.t) = b:bytes{len b = l} val empty_bytes : lbytes 0 val empty_unique: b:bytes -> Lemma (length b = 0 ==> b = empty_bytes) [SMTPat (len b)] (** If you statically know the length, it is OK to read at arbitrary indexes *) val get: b:bytes -> pos:u32{U32.v pos < length b} -> Pure byte (requires True) (ensures (fun y -> y == S.index (reveal b) (U32.v pos))) unfold let op_String_Access = get unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i) let equal b1 b2 = length b1 = length b2 /\ (forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i]) val extensionality: b1:bytes -> b2:bytes -> Lemma (requires (equal b1 b2)) (ensures (b1 = b2)) (** creating byte values **) val create: len:u32 -> v:byte -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v} unfold let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v val init: len:u32 -> f:(i:u32{U32.(i <^ len)} -> byte) -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == f i} // this is a hack JROESCH val abyte (b:byte) : lbytes 1 (* admit () create 1ul b *) val twobytes (b:byte*byte) : lbytes 2 // init 2ul (fun i -> if i = 0ul then fst b else snd b) (** appending bytes **) val append: b1:bytes -> b2:bytes -> Pure bytes (requires (UInt.size (length b1 + length b2) U32.n)) (ensures (fun b -> reveal b == S.append (reveal b1) (reveal b2))) unfold let op_At_Bar = append val slice: b:bytes -> s:u32 -> e:u32{U32.(s <=^ e) /\ U32.v e <= length b} -> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v e)} let slice_ b (s:nat) (e:nat{s <= e /\ e <= length b}) = slice b (U32.uint_to_t s) (U32.uint_to_t e) val sub: b:bytes -> s:u32 -> l:u32{U32.v s + U32.v l <= length b} -> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v s + U32.v l)} val split: b:bytes -> k:u32{U32.v k <= length b} -> p:(bytes*bytes){ let x, y = p in (reveal x, reveal y) == Seq.split (reveal b) (U32.v k)} unfold let split_ b (k:nat{FStar.UInt.size k U32.n /\ k < length b}) = split b (U32.uint_to_t k)
false
true
FStar.Bytes.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 fits_in_k_bytes : n: Prims.nat -> k: Prims.nat -> Type0
[]
FStar.Bytes.fits_in_k_bytes
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
n: Prims.nat -> k: Prims.nat -> Type0
{ "end_col": 73, "end_line": 165, "start_col": 38, "start_line": 165 }
Prims.Tot
[ { "abbrev": true, "full_module": "FStar.Char", "short_module": "Chr" }, { "abbrev": true, "full_module": "FStar.String", "short_module": "Str" }, { "abbrev": true, "full_module": "FStar.UInt64", "short_module": "U64" }, { "abbrev": true, "full_module": "FStar.UInt32", "short_module": "U32" }, { "abbrev": true, "full_module": "FStar.UInt16", "short_module": "U16" }, { "abbrev": true, "full_module": "FStar.UInt8", "short_module": "U8" }, { "abbrev": true, "full_module": "FStar.UInt", "short_module": "U" }, { "abbrev": true, "full_module": "FStar.Seq", "short_module": "S" }, { "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 xor_ (#n:nat{FStar.UInt.size n U32.n}) (b1:minbytes n) (b2:minbytes n) = xor (U32.uint_to_t n) b1 b2
let xor_ (#n: nat{FStar.UInt.size n U32.n}) (b1 b2: minbytes n) =
false
null
false
xor (U32.uint_to_t n) b1 b2
{ "checked_file": "FStar.Bytes.fsti.checked", "dependencies": [ "prims.fst.checked", "LowStar.Modifies.fst.checked", "LowStar.Buffer.fst.checked", "FStar.UInt8.fsti.checked", "FStar.UInt64.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.UInt16.fsti.checked", "FStar.UInt.fsti.checked", "FStar.String.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.Char.fsti.checked" ], "interface_file": false, "source_file": "FStar.Bytes.fsti" }
[ "total" ]
[ "Prims.nat", "FStar.UInt.size", "FStar.UInt32.n", "FStar.Bytes.minbytes", "FStar.Bytes.xor", "FStar.UInt32.uint_to_t", "FStar.Bytes.bytes", "Prims.b2t", "Prims.op_Equality", "FStar.Bytes.u32", "FStar.Bytes.len" ]
[]
(* Copyright 2008-2017 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. *) (* A standard library for manipulation of value bytes. This model is realized by Bytes.bytes in OCaml and by struct {uintX_t size; char *bytes} (or similar) in C. This file is essentially a specialized version of FStar.Seq, with lemmas and refinements taylored for typical operations on bytes, and with support for machine integers and C-extractible versions (which Seq does not provide.) @summary Value bytes standard library *) module FStar.Bytes module S = FStar.Seq module U = FStar.UInt module U8 = FStar.UInt8 module U16 = FStar.UInt16 module U32 = FStar.UInt32 module U64 = FStar.UInt64 module Str = FStar.String module Chr = FStar.Char unfold let u8 = U8.t unfold let u16 = U16.t unfold let u32 = U32.t (** Realized by uint8_t in C and int in OCaml (char does not have necessary operators...) *) unfold type byte = u8 (** Realized in C by a pair of a length field and uint8_t* in C Realized in OCaml by a string *) val bytes : t:Type0{hasEq t} val len : bytes -> u32 unfold let length b = FStar.UInt32.v (len b) (** representation for specs that need lemmas not defined here. *) val reveal: bytes -> GTot (S.seq byte) val length_reveal: x:bytes -> Lemma (ensures (S.length (reveal x) = length x)) [SMTPatOr [[SMTPat (S.length (reveal x))]; [SMTPat (len x)]]] val hide: s:S.seq byte{S.length s < pow2 32} -> GTot bytes val hide_reveal: x:bytes -> Lemma (ensures (hide (reveal x) = x)) [SMTPat (reveal x)] val reveal_hide: x:S.seq byte{S.length x < pow2 32} -> Lemma (ensures (reveal (hide x) == x)) [SMTPat (hide x)] type lbytes (l:nat) = b:bytes{length b = l} type kbytes (k:nat) = b:bytes{length b < pow2 k} let lbytes32 (l:UInt32.t) = b:bytes{len b = l} val empty_bytes : lbytes 0 val empty_unique: b:bytes -> Lemma (length b = 0 ==> b = empty_bytes) [SMTPat (len b)] (** If you statically know the length, it is OK to read at arbitrary indexes *) val get: b:bytes -> pos:u32{U32.v pos < length b} -> Pure byte (requires True) (ensures (fun y -> y == S.index (reveal b) (U32.v pos))) unfold let op_String_Access = get unfold let index (b:bytes) (i:nat{i < length b}) = get b (U32.uint_to_t i) let equal b1 b2 = length b1 = length b2 /\ (forall (i:u32{U32.v i < length b1}).{:pattern (b1.[i]); (b2.[i])} b1.[i] == b2.[i]) val extensionality: b1:bytes -> b2:bytes -> Lemma (requires (equal b1 b2)) (ensures (b1 = b2)) (** creating byte values **) val create: len:u32 -> v:byte -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == v} unfold let create_ (n:nat{FStar.UInt.size n U32.n}) v = create (U32.uint_to_t n) v val init: len:u32 -> f:(i:u32{U32.(i <^ len)} -> byte) -> b:lbytes (U32.v len){forall (i:u32{U32.(i <^ len)}).{:pattern b.[i]} b.[i] == f i} // this is a hack JROESCH val abyte (b:byte) : lbytes 1 (* admit () create 1ul b *) val twobytes (b:byte*byte) : lbytes 2 // init 2ul (fun i -> if i = 0ul then fst b else snd b) (** appending bytes **) val append: b1:bytes -> b2:bytes -> Pure bytes (requires (UInt.size (length b1 + length b2) U32.n)) (ensures (fun b -> reveal b == S.append (reveal b1) (reveal b2))) unfold let op_At_Bar = append val slice: b:bytes -> s:u32 -> e:u32{U32.(s <=^ e) /\ U32.v e <= length b} -> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v e)} let slice_ b (s:nat) (e:nat{s <= e /\ e <= length b}) = slice b (U32.uint_to_t s) (U32.uint_to_t e) val sub: b:bytes -> s:u32 -> l:u32{U32.v s + U32.v l <= length b} -> r:bytes{reveal r == Seq.slice (reveal b) (U32.v s) (U32.v s + U32.v l)} val split: b:bytes -> k:u32{U32.v k <= length b} -> p:(bytes*bytes){ let x, y = p in (reveal x, reveal y) == Seq.split (reveal b) (U32.v k)} unfold let split_ b (k:nat{FStar.UInt.size k U32.n /\ k < length b}) = split b (U32.uint_to_t k) (** Interpret a sequence of bytes as a mathematical integer encoded in big endian **) let fits_in_k_bytes (n:nat) (k:nat) = FStar.UInt.size n (op_Multiply 8 k) type uint_k (k:nat) = n:nat{fits_in_k_bytes n k} (** repr_bytes n: The number of bytes needed to represent a nat **) val repr_bytes: n:nat -> k:pos{fits_in_k_bytes n k} val lemma_repr_bytes_values: n:nat -> Lemma (ensures ( let k = repr_bytes n in if n < 256 then k==1 else if n < 65536 then k==2 else if n < 16777216 then k==3 else if n < 4294967296 then k==4 else if n < 1099511627776 then k==5 else if n < 281474976710656 then k==6 else if n < 72057594037927936 then k==7 else if n < 18446744073709551616 then k==8 else True )) [SMTPat (repr_bytes n)] val repr_bytes_size: k:nat -> n:uint_k k -> Lemma (ensures (repr_bytes n <= k)) [SMTPat (fits_in_k_bytes n k)] val int_of_bytes: b:bytes -> Tot (uint_k (length b)) val bytes_of_int: k:nat -> n:nat{repr_bytes n <= k /\ k < pow2 32} -> lbytes k val int_of_bytes_of_int: #k:nat{k <= 32} -> n:uint_k k -> Lemma (ensures (int_of_bytes (bytes_of_int k n) == n)) [SMTPat (bytes_of_int k n)] val bytes_of_int_of_bytes: b:bytes{length b <= 32} -> Lemma (ensures (bytes_of_int (length b) (int_of_bytes b) == b)) [SMTPat (int_of_bytes b)] //18-02-25 use [uint32] instead of [int32] etc? val int32_of_bytes: b:bytes{length b <= 4} -> n:u32{U32.v n == int_of_bytes b} val int16_of_bytes: b:bytes{length b <= 2} -> n:u16{U16.v n == int_of_bytes b} val int8_of_bytes: b:bytes{length b = 1} -> n:u8{U8.v n = int_of_bytes b} val bytes_of_int32: n:U32.t -> b:lbytes 4{b == bytes_of_int 4 (U32.v n)} val bytes_of_int16: n:U16.t -> b:lbytes 2{b == bytes_of_int 2 (U16.v n)} val bytes_of_int8: n:U8.t -> b:lbytes 1{b == bytes_of_int 1 (U8.v n)} //////////////////////////////////////////////////////////////////////////////// type minbytes (n:nat) = b:bytes{length b >= n} val xor: n:u32 -> b1:minbytes (U32.v n) -> b2:minbytes (U32.v n) -> b:bytes{len b = n}
false
false
FStar.Bytes.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 xor_ : b1: FStar.Bytes.minbytes n -> b2: FStar.Bytes.minbytes n -> b: FStar.Bytes.bytes{FStar.Bytes.len b = FStar.UInt32.uint_to_t n}
[]
FStar.Bytes.xor_
{ "file_name": "ulib/FStar.Bytes.fsti", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
b1: FStar.Bytes.minbytes n -> b2: FStar.Bytes.minbytes n -> b: FStar.Bytes.bytes{FStar.Bytes.len b = FStar.UInt32.uint_to_t n}
{ "end_col": 111, "end_line": 247, "start_col": 84, "start_line": 247 }
Prims.Tot
val eval_Paddd (src1 src2: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2)
val eval_Paddd (src1 src2: quad32) : option quad32 let eval_Paddd (src1 src2: quad32) : option quad32 =
false
null
false
check_sse2 (eval_Paddd_raw src1 src2)
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.quad32", "Vale.X64.Instructions_s.check_sse2", "Vale.X64.Instructions_s.eval_Paddd_raw", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32))
false
true
Vale.X64.Instructions_s.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 eval_Paddd (src1 src2: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_Paddd
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 89, "end_line": 129, "start_col": 52, "start_line": 129 }
Prims.Tot
val eval_Mov64 (src: nat64) : option nat64
[ { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_Mov64 (src:nat64) : option nat64 = Some src
val eval_Mov64 (src: nat64) : option nat64 let eval_Mov64 (src: nat64) : option nat64 =
false
null
false
Some src
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.nat64", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base
false
true
Vale.X64.Instructions_s.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 eval_Mov64 (src: nat64) : option nat64
[]
Vale.X64.Instructions_s.eval_Mov64
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
src: Vale.X64.Machine_s.nat64 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64
{ "end_col": 52, "end_line": 13, "start_col": 44, "start_line": 13 }
Prims.Tot
val eval_Shufpd_raw (permutation: int) (src1 src2: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 = if 0 <= permutation && permutation < 4 then Some (Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2) (if permutation % 2 = 0 then src1.lo1 else src1.hi3) (if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2) (if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3)) else None
val eval_Shufpd_raw (permutation: int) (src1 src2: quad32) : option quad32 let eval_Shufpd_raw (permutation: int) (src1 src2: quad32) : option quad32 =
false
null
false
if 0 <= permutation && permutation < 4 then Some (Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2) (if permutation % 2 = 0 then src1.lo1 else src1.hi3) (if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2) (if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3)) else None
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Prims.int", "Vale.X64.Machine_s.quad32", "Prims.op_AmpAmp", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "FStar.Pervasives.Native.Some", "Vale.Def.Words_s.Mkfour", "Vale.Def.Types_s.nat32", "Prims.op_Equality", "Prims.op_Modulus", "Vale.Def.Words_s.__proj__Mkfour__item__lo0", "Prims.bool", "Vale.Def.Words_s.__proj__Mkfour__item__hi2", "Vale.Def.Words_s.__proj__Mkfour__item__lo1", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Prims.op_Division", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd let eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) let eval_Psrld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt) let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 ( if 0 <= amt && amt < 16 then let src_bytes = le_quad32_to_bytes dst in let zero_pad = Seq.create amt 0 in let remaining_bytes = slice src_bytes amt (length src_bytes) in Some (le_bytes_to_quad32 (append zero_pad remaining_bytes)) else None) val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if amount = 4 then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0) else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Palignr_raw amount src1 src2) val ins_Palignr (amount:nat8) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount) let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_avx (eval_Palignr_raw amount src1 src2) val ins_VPalignr (amount:nat8) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount)
false
true
Vale.X64.Instructions_s.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 eval_Shufpd_raw (permutation: int) (src1 src2: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_Shufpd_raw
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
permutation: Prims.int -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 11, "end_line": 177, "start_col": 2, "start_line": 171 }
Prims.Tot
val is_byte_reversal_mask (q: quad32) : bool
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x00010203 && q.lo1 = 0x04050607 && q.hi2 = 0x08090A0B && q.hi3 = 0x0C0D0E0F
val is_byte_reversal_mask (q: quad32) : bool let is_byte_reversal_mask (q: quad32) : bool =
false
null
false
q.lo0 = 0x00010203 && q.lo1 = 0x04050607 && q.hi2 = 0x08090A0B && q.hi3 = 0x0C0D0E0F
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.quad32", "Prims.op_AmpAmp", "Prims.op_Equality", "Prims.int", "Vale.Def.Words_s.__proj__Mkfour__item__lo0", "Vale.Def.Types_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__lo1", "Vale.Def.Words_s.__proj__Mkfour__item__hi2", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Prims.bool" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd let eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) let eval_Psrld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt) let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 ( if 0 <= amt && amt < 16 then let src_bytes = le_quad32_to_bytes dst in let zero_pad = Seq.create amt 0 in let remaining_bytes = slice src_bytes amt (length src_bytes) in Some (le_bytes_to_quad32 (append zero_pad remaining_bytes)) else None) val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if amount = 4 then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0) else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Palignr_raw amount src1 src2) val ins_Palignr (amount:nat8) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount) let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_avx (eval_Palignr_raw amount src1 src2) val ins_VPalignr (amount:nat8) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount) let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 = if 0 <= permutation && permutation < 4 then Some (Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2) (if permutation % 2 = 0 then src1.lo1 else src1.hi3) (if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2) (if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3)) else None let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_sse2 (eval_Shufpd_raw permutation src1 src2) val ins_Shufpd (permutation:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation) let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_avx (eval_Shufpd_raw permutation src1 src2) val ins_VShufpd (permutation:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation) let is_full_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x04050607 && q.hi3 = 0x00010203
false
true
Vale.X64.Instructions_s.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 is_byte_reversal_mask (q: quad32) : bool
[]
Vale.X64.Instructions_s.is_byte_reversal_mask
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
q: Vale.X64.Machine_s.quad32 -> Prims.bool
{ "end_col": 20, "end_line": 199, "start_col": 2, "start_line": 196 }
Prims.Tot
val eval_VPxor (src1 src2: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2))
val eval_VPxor (src1 src2: quad32) : option quad32 let eval_VPxor (src1 src2: quad32) : option quad32 =
false
null
false
check_avx (Some (quad32_xor src1 src2))
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.quad32", "Vale.X64.Instructions_s.check_avx", "FStar.Pervasives.Native.Some", "Vale.Def.Types_s.quad32_xor", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor
false
true
Vale.X64.Instructions_s.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 eval_VPxor (src1 src2: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_VPxor
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 91, "end_line": 116, "start_col": 52, "start_line": 116 }
Prims.Tot
val eval_MovBe64 (src: nat64) : option nat64
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None
val eval_MovBe64 (src: nat64) : option nat64 let eval_MovBe64 (src: nat64) : option nat64 =
false
null
false
if movbe_enabled then Some (reverse_bytes_nat64 src) else None
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.nat64", "Vale.X64.CPU_Features_s.movbe_enabled", "FStar.Pervasives.Native.Some", "Vale.Def.Types_s.reverse_bytes_nat64", "Prims.bool", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64
false
true
Vale.X64.Instructions_s.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 eval_MovBe64 (src: nat64) : option nat64
[]
Vale.X64.Instructions_s.eval_MovBe64
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
src: Vale.X64.Machine_s.nat64 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64
{ "end_col": 108, "end_line": 16, "start_col": 46, "start_line": 16 }
Prims.Tot
val is_lower_upper_byte_reversal_mask (q: quad32) : bool
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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_lower_upper_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x04050607 && q.lo1 = 0x00010203 && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B
val is_lower_upper_byte_reversal_mask (q: quad32) : bool let is_lower_upper_byte_reversal_mask (q: quad32) : bool =
false
null
false
q.lo0 = 0x04050607 && q.lo1 = 0x00010203 && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.quad32", "Prims.op_AmpAmp", "Prims.op_Equality", "Prims.int", "Vale.Def.Words_s.__proj__Mkfour__item__lo0", "Vale.Def.Types_s.nat32", "Vale.Def.Words_s.__proj__Mkfour__item__lo1", "Vale.Def.Words_s.__proj__Mkfour__item__hi2", "Vale.Def.Words_s.__proj__Mkfour__item__hi3", "Prims.bool" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd let eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) let eval_Psrld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt) let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 ( if 0 <= amt && amt < 16 then let src_bytes = le_quad32_to_bytes dst in let zero_pad = Seq.create amt 0 in let remaining_bytes = slice src_bytes amt (length src_bytes) in Some (le_bytes_to_quad32 (append zero_pad remaining_bytes)) else None) val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if amount = 4 then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0) else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Palignr_raw amount src1 src2) val ins_Palignr (amount:nat8) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount) let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_avx (eval_Palignr_raw amount src1 src2) val ins_VPalignr (amount:nat8) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount) let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 = if 0 <= permutation && permutation < 4 then Some (Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2) (if permutation % 2 = 0 then src1.lo1 else src1.hi3) (if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2) (if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3)) else None let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_sse2 (eval_Shufpd_raw permutation src1 src2) val ins_Shufpd (permutation:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation) let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_avx (eval_Shufpd_raw permutation src1 src2) val ins_VShufpd (permutation:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation) let is_full_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x04050607 && q.hi3 = 0x00010203 let is_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x00010203 && q.lo1 = 0x04050607 && q.hi2 = 0x08090A0B && q.hi3 = 0x0C0D0E0F let is_high_dup_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B
false
true
Vale.X64.Instructions_s.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 is_lower_upper_byte_reversal_mask (q: quad32) : bool
[]
Vale.X64.Instructions_s.is_lower_upper_byte_reversal_mask
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
q: Vale.X64.Machine_s.quad32 -> Prims.bool
{ "end_col": 20, "end_line": 211, "start_col": 2, "start_line": 208 }
Prims.Tot
val eval_Xor64 (dst src: nat64) : option (nat64 & (bool & bool))
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false))
val eval_Xor64 (dst src: nat64) : option (nat64 & (bool & bool)) let eval_Xor64 (dst src: nat64) : option (nat64 & (bool & bool)) =
false
null
false
Some (Vale.Def.Types_s.ixor dst src, (false, false))
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.nat64", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.tuple2", "Prims.bool", "FStar.Pervasives.Native.Mktuple2", "Vale.Def.Types_s.ixor", "Vale.Def.Words_s.pow2_64", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64
false
true
Vale.X64.Instructions_s.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 eval_Xor64 (dst src: nat64) : option (nat64 & (bool & bool))
[]
Vale.X64.Instructions_s.eval_Xor64
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
dst: Vale.X64.Machine_s.nat64 -> src: Vale.X64.Machine_s.nat64 -> FStar.Pervasives.Native.option (Vale.X64.Machine_s.nat64 * (Prims.bool * Prims.bool))
{ "end_col": 54, "end_line": 70, "start_col": 2, "start_line": 70 }
Prims.Tot
val eval_Pshufb (src1 src2: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2)
val eval_Pshufb (src1 src2: quad32) : option quad32 let eval_Pshufb (src1 src2: quad32) : option quad32 =
false
null
false
check_ssse3 (eval_Pshufb_raw src1 src2)
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.quad32", "Vale.X64.Instructions_s.check_ssse3", "Vale.X64.Instructions_s.eval_Pshufb_raw", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd let eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) let eval_Psrld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt) let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 ( if 0 <= amt && amt < 16 then let src_bytes = le_quad32_to_bytes dst in let zero_pad = Seq.create amt 0 in let remaining_bytes = slice src_bytes amt (length src_bytes) in Some (le_bytes_to_quad32 (append zero_pad remaining_bytes)) else None) val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if amount = 4 then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0) else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Palignr_raw amount src1 src2) val ins_Palignr (amount:nat8) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount) let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_avx (eval_Palignr_raw amount src1 src2) val ins_VPalignr (amount:nat8) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount) let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 = if 0 <= permutation && permutation < 4 then Some (Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2) (if permutation % 2 = 0 then src1.lo1 else src1.hi3) (if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2) (if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3)) else None let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_sse2 (eval_Shufpd_raw permutation src1 src2) val ins_Shufpd (permutation:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation) let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_avx (eval_Shufpd_raw permutation src1 src2) val ins_VShufpd (permutation:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation) let is_full_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x04050607 && q.hi3 = 0x00010203 let is_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x00010203 && q.lo1 = 0x04050607 && q.hi2 = 0x08090A0B && q.hi3 = 0x0C0D0E0F let is_high_dup_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let is_lower_upper_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x04050607 && q.lo1 = 0x00010203 && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let eval_Pshufb_raw (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if is_full_byte_reversal_mask src2 then Some (reverse_bytes_quad32 src1) else if is_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3)) else if is_high_dup_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else if is_lower_upper_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else None
false
true
Vale.X64.Instructions_s.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 eval_Pshufb (src1 src2: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_Pshufb
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 92, "end_line": 237, "start_col": 53, "start_line": 237 }
Prims.Tot
val eval_VPalignr (amount: nat8) (src1 src2: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_avx (eval_Palignr_raw amount src1 src2)
val eval_VPalignr (amount: nat8) (src1 src2: quad32) : option quad32 let eval_VPalignr (amount: nat8) (src1 src2: quad32) : option quad32 =
false
null
false
check_avx (eval_Palignr_raw amount src1 src2)
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.Def.Types_s.nat8", "Vale.X64.Machine_s.quad32", "Vale.X64.Instructions_s.check_avx", "Vale.X64.Instructions_s.eval_Palignr_raw", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd let eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) let eval_Psrld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt) let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 ( if 0 <= amt && amt < 16 then let src_bytes = le_quad32_to_bytes dst in let zero_pad = Seq.create amt 0 in let remaining_bytes = slice src_bytes amt (length src_bytes) in Some (le_bytes_to_quad32 (append zero_pad remaining_bytes)) else None) val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if amount = 4 then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0) else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Palignr_raw amount src1 src2) val ins_Palignr (amount:nat8) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount)
false
true
Vale.X64.Instructions_s.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 eval_VPalignr (amount: nat8) (src1 src2: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_VPalignr
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
amount: Vale.Def.Types_s.nat8 -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 47, "end_line": 166, "start_col": 2, "start_line": 166 }
Prims.Tot
val eval_VPaddd (src1 src2: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2)
val eval_VPaddd (src1 src2: quad32) : option quad32 let eval_VPaddd (src1 src2: quad32) : option quad32 =
false
null
false
check_avx (eval_Paddd_raw src1 src2)
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.quad32", "Vale.X64.Instructions_s.check_avx", "Vale.X64.Instructions_s.eval_Paddd_raw", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd
false
true
Vale.X64.Instructions_s.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 eval_VPaddd (src1 src2: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_VPaddd
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 89, "end_line": 132, "start_col": 53, "start_line": 132 }
Prims.Tot
val eval_Pslld (amt: int) (dst: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
val eval_Pslld (amt: int) (dst: quad32) : option quad32 let eval_Pslld (amt: int) (dst: quad32) : option quad32 =
false
null
false
check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None)
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Prims.int", "Vale.X64.Machine_s.quad32", "Vale.X64.Instructions_s.check_sse2", "Prims.op_AmpAmp", "Prims.op_LessThanOrEqual", "Prims.op_LessThan", "FStar.Pervasives.Native.Some", "Vale.Def.Words.Four_s.four_map", "Vale.Def.Words_s.natN", "Vale.Def.Words_s.pow2_32", "Vale.Def.Types_s.ishl", "Prims.bool", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd
false
true
Vale.X64.Instructions_s.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 eval_Pslld (amt: int) (dst: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_Pslld
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
amt: Prims.int -> dst: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 95, "end_line": 136, "start_col": 2, "start_line": 136 }
Prims.Tot
val eval_AESNI_dec_last (dst src: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_AESNI_dec_last (dst src:quad32) : option quad32 = if aesni_enabled then Some (quad32_xor (Vale.AES.AES_s.inv_sub_bytes (Vale.AES.AES_s.inv_shift_rows_LE dst)) src) else None
val eval_AESNI_dec_last (dst src: quad32) : option quad32 let eval_AESNI_dec_last (dst src: quad32) : option quad32 =
false
null
false
if aesni_enabled then Some (quad32_xor (Vale.AES.AES_s.inv_sub_bytes (Vale.AES.AES_s.inv_shift_rows_LE dst)) src) else None
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.quad32", "Vale.X64.CPU_Features_s.aesni_enabled", "FStar.Pervasives.Native.Some", "Vale.Def.Types_s.quad32_xor", "Vale.AES.AES_common_s.inv_sub_bytes", "Vale.AES.AES_s.inv_shift_rows_LE", "Prims.bool", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd let eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) let eval_Psrld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt) let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 ( if 0 <= amt && amt < 16 then let src_bytes = le_quad32_to_bytes dst in let zero_pad = Seq.create amt 0 in let remaining_bytes = slice src_bytes amt (length src_bytes) in Some (le_bytes_to_quad32 (append zero_pad remaining_bytes)) else None) val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if amount = 4 then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0) else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Palignr_raw amount src1 src2) val ins_Palignr (amount:nat8) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount) let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_avx (eval_Palignr_raw amount src1 src2) val ins_VPalignr (amount:nat8) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount) let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 = if 0 <= permutation && permutation < 4 then Some (Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2) (if permutation % 2 = 0 then src1.lo1 else src1.hi3) (if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2) (if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3)) else None let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_sse2 (eval_Shufpd_raw permutation src1 src2) val ins_Shufpd (permutation:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation) let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_avx (eval_Shufpd_raw permutation src1 src2) val ins_VShufpd (permutation:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation) let is_full_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x04050607 && q.hi3 = 0x00010203 let is_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x00010203 && q.lo1 = 0x04050607 && q.hi2 = 0x08090A0B && q.hi3 = 0x0C0D0E0F let is_high_dup_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let is_lower_upper_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x04050607 && q.lo1 = 0x00010203 && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let eval_Pshufb_raw (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if is_full_byte_reversal_mask src2 then Some (reverse_bytes_quad32 src1) else if is_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3)) else if is_high_dup_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else if is_lower_upper_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else None let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2) val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb let eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2) val ins_VPshufb : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPshufb let eval_Pshufd (permutation:nat8) (src:quad32) : option quad32 = check_sse2 ( let bits:bits_of_byte = byte_to_twobits permutation in Some (Mkfour (select_word src bits.lo0) (select_word src bits.lo1) (select_word src bits.hi2) (select_word src bits.hi3))) val ins_Pshufd (permutation:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_Pshufd permutation) let eval_Pcmpeqd (dst src:quad32) : option quad32 = check_sse2 ( let eq_result (b:bool):nat32 = if b then 0xFFFFFFFF else 0 in Some (Mkfour (eq_result (src.lo0 = dst.lo0)) (eq_result (src.lo1 = dst.lo1)) (eq_result (src.hi2 = dst.hi2)) (eq_result (src.hi3 = dst.hi3)))) val ins_Pcmpeqd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pcmpeqd let eval_Pextrq (index:nat8) (src:quad32) : option nat64 = check_sse4_1 ( let src_two = four_to_two_two src in Some (two_to_nat 32 (two_select src_two (index % 2)))) val ins_Pextrq (index:nat8) : instr_dep [out op64] [opXmm] PreserveFlags (eval_Pextrq index) let eval_Pinsrd (index:nat8) (dst:quad32) (src:nat64) : option quad32 = check_sse4_1 (Some (insert_nat32 dst (src % pow2_32) (index % 4))) val ins_Pinsrd (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrd index) let eval_Pinsrq (index:nat8) (dst:quad32) (src:nat64) : option quad32 = check_sse4_1 (Some (insert_nat64_def dst src (index % 2))) val ins_Pinsrq (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrq index) let eval_Pslldq_raw (count:nat8) (src:quad32) : option quad32 = // We only spec the two very special cases we need if count = 4 then Some (Mkfour 0 src.lo0 src.lo1 src.hi2) else if count = 8 then Some (Mkfour 0 0 src.lo0 src.lo1) else None let eval_VPslldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Pslldq_raw count src) val ins_VPslldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPslldq count) let eval_Psrldq_8_raw (count:nat8) (src:quad32) : option quad32 = // We only spec the one very special case we need if count = 8 then Some (Mkfour src.hi2 src.hi3 0 0) else None let eval_VPsrldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Psrldq_8_raw count src) val ins_VPsrldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPsrldq count) let eval_Pclmulqdq (imm:int) (src1 src2:quad32) : option quad32 = let Mkfour a0 a1 a2 a3 = src1 in let Mkfour b0 b1 b2 b3 = src2 in let f x0 x1 y0 y1 = let x = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo x0 x1) in let y = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo y0 y1) in Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul x y) in if pclmulqdq_enabled then match imm with | 0 -> Some (f a0 a1 b0 b1) | 1 -> Some (f a2 a3 b0 b1) | 16 -> Some (f a0 a1 b2 b3) | 17 -> Some (f a2 a3 b2 b3) | _ -> None else None val ins_Pclmulqdq (imm:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Pclmulqdq imm) let eval_VPclmulqdq (imm:int) (src1 src2:quad32) : option quad32 = check_avx (eval_Pclmulqdq imm src1 src2) val ins_VPclmulqdq (imm:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPclmulqdq imm) let eval_AESNI_enc (src1 src2:quad32) : option quad32 = if aesni_enabled then Some (quad32_xor (Vale.AES.AES_s.mix_columns_LE (Vale.AES.AES_s.sub_bytes (Vale.AES.AES_s.shift_rows_LE src1))) src2) else None val ins_AESNI_enc : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_AESNI_enc let eval_VAESNI_enc (src1 src2:quad32) : option quad32 = check_avx (eval_AESNI_enc src1 src2) val ins_VAESNI_enc : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VAESNI_enc let eval_AESNI_enc_last (src1 src2:quad32) : option quad32 = if aesni_enabled then Some (quad32_xor (Vale.AES.AES_s.sub_bytes (Vale.AES.AES_s.shift_rows_LE src1)) src2) else None val ins_AESNI_enc_last : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_AESNI_enc_last let eval_VAESNI_enc_last (src1 src2:quad32) : option quad32 = check_avx (eval_AESNI_enc_last src1 src2) val ins_VAESNI_enc_last : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VAESNI_enc_last let eval_AESNI_dec (dst src:quad32) : option quad32 = if aesni_enabled then Some (quad32_xor (Vale.AES.AES_s.inv_mix_columns_LE (Vale.AES.AES_s.inv_sub_bytes (Vale.AES.AES_s.inv_shift_rows_LE dst))) src) else None val ins_AESNI_dec : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_AESNI_dec
false
true
Vale.X64.Instructions_s.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 eval_AESNI_dec_last (dst src: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_AESNI_dec_last
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
dst: Vale.X64.Machine_s.quad32 -> src: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 11, "end_line": 339, "start_col": 2, "start_line": 337 }
Prims.Tot
val eval_Shl64 (dst amt: nat64) : option nat64
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
val eval_Shl64 (dst amt: nat64) : option nat64 let eval_Shl64 (dst amt: nat64) : option nat64 =
false
null
false
if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.nat64", "Prims.op_LessThan", "FStar.Pervasives.Native.Some", "Vale.Def.Types_s.ishl", "Vale.Def.Words_s.pow2_64", "Prims.bool", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64
false
true
Vale.X64.Instructions_s.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 eval_Shl64 (dst amt: nat64) : option nat64
[]
Vale.X64.Instructions_s.eval_Shl64
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
dst: Vale.X64.Machine_s.nat64 -> amt: Vale.X64.Machine_s.nat64 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.nat64
{ "end_col": 65, "end_line": 78, "start_col": 2, "start_line": 78 }
Prims.Tot
val eval_VPshufb (src1 src2: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2)
val eval_VPshufb (src1 src2: quad32) : option quad32 let eval_VPshufb (src1 src2: quad32) : option quad32 =
false
null
false
check_avx (eval_Pshufb_raw src1 src2)
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.quad32", "Vale.X64.Instructions_s.check_avx", "Vale.X64.Instructions_s.eval_Pshufb_raw", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd let eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) let eval_Psrld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt) let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 ( if 0 <= amt && amt < 16 then let src_bytes = le_quad32_to_bytes dst in let zero_pad = Seq.create amt 0 in let remaining_bytes = slice src_bytes amt (length src_bytes) in Some (le_bytes_to_quad32 (append zero_pad remaining_bytes)) else None) val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if amount = 4 then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0) else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Palignr_raw amount src1 src2) val ins_Palignr (amount:nat8) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount) let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_avx (eval_Palignr_raw amount src1 src2) val ins_VPalignr (amount:nat8) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount) let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 = if 0 <= permutation && permutation < 4 then Some (Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2) (if permutation % 2 = 0 then src1.lo1 else src1.hi3) (if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2) (if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3)) else None let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_sse2 (eval_Shufpd_raw permutation src1 src2) val ins_Shufpd (permutation:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation) let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_avx (eval_Shufpd_raw permutation src1 src2) val ins_VShufpd (permutation:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation) let is_full_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x04050607 && q.hi3 = 0x00010203 let is_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x00010203 && q.lo1 = 0x04050607 && q.hi2 = 0x08090A0B && q.hi3 = 0x0C0D0E0F let is_high_dup_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let is_lower_upper_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x04050607 && q.lo1 = 0x00010203 && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let eval_Pshufb_raw (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if is_full_byte_reversal_mask src2 then Some (reverse_bytes_quad32 src1) else if is_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3)) else if is_high_dup_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else if is_lower_upper_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else None let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2) val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb
false
true
Vale.X64.Instructions_s.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 eval_VPshufb (src1 src2: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_VPshufb
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 91, "end_line": 240, "start_col": 54, "start_line": 240 }
Prims.Tot
val eval_Pclmulqdq (imm: int) (src1 src2: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_Pclmulqdq (imm:int) (src1 src2:quad32) : option quad32 = let Mkfour a0 a1 a2 a3 = src1 in let Mkfour b0 b1 b2 b3 = src2 in let f x0 x1 y0 y1 = let x = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo x0 x1) in let y = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo y0 y1) in Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul x y) in if pclmulqdq_enabled then match imm with | 0 -> Some (f a0 a1 b0 b1) | 1 -> Some (f a2 a3 b0 b1) | 16 -> Some (f a0 a1 b2 b3) | 17 -> Some (f a2 a3 b2 b3) | _ -> None else None
val eval_Pclmulqdq (imm: int) (src1 src2: quad32) : option quad32 let eval_Pclmulqdq (imm: int) (src1 src2: quad32) : option quad32 =
false
null
false
let Mkfour a0 a1 a2 a3 = src1 in let Mkfour b0 b1 b2 b3 = src2 in let f x0 x1 y0 y1 = let x = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo x0 x1) in let y = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo y0 y1) in Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul x y) in if pclmulqdq_enabled then match imm with | 0 -> Some (f a0 a1 b0 b1) | 1 -> Some (f a2 a3 b0 b1) | 16 -> Some (f a0 a1 b2 b3) | 17 -> Some (f a2 a3 b2 b3) | _ -> None else None
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Prims.int", "Vale.X64.Machine_s.quad32", "Vale.Def.Types_s.nat32", "Vale.X64.CPU_Features_s.pclmulqdq_enabled", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option", "Prims.bool", "Vale.Def.Words_s.nat32", "Vale.Def.Types_s.quad32", "Vale.Math.Poly2.Bits_s.to_quad32", "Vale.Math.Poly2_s.mul", "Vale.Math.Poly2_s.poly", "Vale.Math.Poly2.Bits_s.of_double32", "Vale.Def.Words_s.Mktwo" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd let eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) let eval_Psrld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt) let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 ( if 0 <= amt && amt < 16 then let src_bytes = le_quad32_to_bytes dst in let zero_pad = Seq.create amt 0 in let remaining_bytes = slice src_bytes amt (length src_bytes) in Some (le_bytes_to_quad32 (append zero_pad remaining_bytes)) else None) val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if amount = 4 then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0) else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Palignr_raw amount src1 src2) val ins_Palignr (amount:nat8) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount) let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_avx (eval_Palignr_raw amount src1 src2) val ins_VPalignr (amount:nat8) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount) let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 = if 0 <= permutation && permutation < 4 then Some (Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2) (if permutation % 2 = 0 then src1.lo1 else src1.hi3) (if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2) (if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3)) else None let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_sse2 (eval_Shufpd_raw permutation src1 src2) val ins_Shufpd (permutation:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation) let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_avx (eval_Shufpd_raw permutation src1 src2) val ins_VShufpd (permutation:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation) let is_full_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x04050607 && q.hi3 = 0x00010203 let is_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x00010203 && q.lo1 = 0x04050607 && q.hi2 = 0x08090A0B && q.hi3 = 0x0C0D0E0F let is_high_dup_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let is_lower_upper_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x04050607 && q.lo1 = 0x00010203 && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let eval_Pshufb_raw (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if is_full_byte_reversal_mask src2 then Some (reverse_bytes_quad32 src1) else if is_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3)) else if is_high_dup_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else if is_lower_upper_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else None let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2) val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb let eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2) val ins_VPshufb : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPshufb let eval_Pshufd (permutation:nat8) (src:quad32) : option quad32 = check_sse2 ( let bits:bits_of_byte = byte_to_twobits permutation in Some (Mkfour (select_word src bits.lo0) (select_word src bits.lo1) (select_word src bits.hi2) (select_word src bits.hi3))) val ins_Pshufd (permutation:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_Pshufd permutation) let eval_Pcmpeqd (dst src:quad32) : option quad32 = check_sse2 ( let eq_result (b:bool):nat32 = if b then 0xFFFFFFFF else 0 in Some (Mkfour (eq_result (src.lo0 = dst.lo0)) (eq_result (src.lo1 = dst.lo1)) (eq_result (src.hi2 = dst.hi2)) (eq_result (src.hi3 = dst.hi3)))) val ins_Pcmpeqd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pcmpeqd let eval_Pextrq (index:nat8) (src:quad32) : option nat64 = check_sse4_1 ( let src_two = four_to_two_two src in Some (two_to_nat 32 (two_select src_two (index % 2)))) val ins_Pextrq (index:nat8) : instr_dep [out op64] [opXmm] PreserveFlags (eval_Pextrq index) let eval_Pinsrd (index:nat8) (dst:quad32) (src:nat64) : option quad32 = check_sse4_1 (Some (insert_nat32 dst (src % pow2_32) (index % 4))) val ins_Pinsrd (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrd index) let eval_Pinsrq (index:nat8) (dst:quad32) (src:nat64) : option quad32 = check_sse4_1 (Some (insert_nat64_def dst src (index % 2))) val ins_Pinsrq (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrq index) let eval_Pslldq_raw (count:nat8) (src:quad32) : option quad32 = // We only spec the two very special cases we need if count = 4 then Some (Mkfour 0 src.lo0 src.lo1 src.hi2) else if count = 8 then Some (Mkfour 0 0 src.lo0 src.lo1) else None let eval_VPslldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Pslldq_raw count src) val ins_VPslldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPslldq count) let eval_Psrldq_8_raw (count:nat8) (src:quad32) : option quad32 = // We only spec the one very special case we need if count = 8 then Some (Mkfour src.hi2 src.hi3 0 0) else None let eval_VPsrldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Psrldq_8_raw count src) val ins_VPsrldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPsrldq count)
false
true
Vale.X64.Instructions_s.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 eval_Pclmulqdq (imm: int) (src1 src2: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_Pclmulqdq
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
imm: Prims.int -> src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 11, "end_line": 305, "start_col": 65, "start_line": 290 }
Prims.Tot
val eval_AESNI_enc_last (src1 src2: quad32) : option quad32
[ { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.Seq.Base", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CryptoInstructions_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.CPU_Features_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Instruction_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.X64.Machine_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Types_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Four_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words.Two_s", "short_module": null }, { "abbrev": false, "full_module": "Vale.Def.Words_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 eval_AESNI_enc_last (src1 src2:quad32) : option quad32 = if aesni_enabled then Some (quad32_xor (Vale.AES.AES_s.sub_bytes (Vale.AES.AES_s.shift_rows_LE src1)) src2) else None
val eval_AESNI_enc_last (src1 src2: quad32) : option quad32 let eval_AESNI_enc_last (src1 src2: quad32) : option quad32 =
false
null
false
if aesni_enabled then Some (quad32_xor (Vale.AES.AES_s.sub_bytes (Vale.AES.AES_s.shift_rows_LE src1)) src2) else None
{ "checked_file": "Vale.X64.Instructions_s.fsti.checked", "dependencies": [ "Vale.X64.Machine_s.fst.checked", "Vale.X64.Instruction_s.fsti.checked", "Vale.X64.CryptoInstructions_s.fsti.checked", "Vale.X64.CPU_Features_s.fst.checked", "Vale.Math.Poly2_s.fsti.checked", "Vale.Math.Poly2.Bits_s.fsti.checked", "Vale.Def.Words_s.fsti.checked", "Vale.Def.Words.Two_s.fsti.checked", "Vale.Def.Words.Four_s.fsti.checked", "Vale.Def.Types_s.fst.checked", "Vale.AES.AES_s.fst.checked", "prims.fst.checked", "FStar.UInt.fsti.checked", "FStar.Seq.Base.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Vale.X64.Instructions_s.fsti" }
[ "total" ]
[ "Vale.X64.Machine_s.quad32", "Vale.X64.CPU_Features_s.aesni_enabled", "FStar.Pervasives.Native.Some", "Vale.Def.Types_s.quad32_xor", "Vale.AES.AES_common_s.sub_bytes", "Vale.AES.AES_s.shift_rows_LE", "Prims.bool", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.option" ]
[]
module Vale.X64.Instructions_s open FStar.Mul open Vale.Def.Words_s open Vale.Def.Words.Two_s open Vale.Def.Words.Four_s open Vale.Def.Types_s open Vale.X64.Machine_s open Vale.X64.Instruction_s open Vale.X64.CPU_Features_s open Vale.X64.CryptoInstructions_s open FStar.Seq.Base let eval_Mov64 (src:nat64) : option nat64 = Some src val ins_Mov64 : instr_dep [out op64] [op64] PreserveFlags eval_Mov64 let eval_MovBe64 (src:nat64) : option nat64 = if movbe_enabled then Some (reverse_bytes_nat64 src) else None val ins_MovBe64 : instr_dep [out op64] [op64] PreserveFlags eval_MovBe64 let eval_Bswap64 (dst:nat64) : option nat64 = Some (reverse_bytes_nat64 dst) val ins_Bswap64 : instr_dep [inOut op64] [] PreserveFlags eval_Bswap64 let eval_Cmovc64 (dst src:nat64) (carry:bool) : option nat64 = Some (if carry then src else dst) val ins_Cmovc64 : instr_dep [inOut op64] [op64; opFlagsCf] PreserveFlags eval_Cmovc64 let eval_Add64 (dst src:nat64) : option (bool & nat64) = let sum = dst + src in Some (sum >= pow2_64, sum % pow2_64) val ins_Add64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Add64 let eval_AddLea64 (src1 src2:nat64) : option nat64 = Some ((src1 + src2) % pow2_64) val ins_AddLea64 :instr_dep [out op64] [op64; op64] PreserveFlags eval_AddLea64 let eval_AddCarry64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_carry then 1 else 0) in Some (sum >= pow2_64, sum % pow2_64) val ins_AddCarry64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_AddCarry64 let eval_Adcx64_Adox64 (old_flag:bool) (dst src:nat64) : option (bool & nat64) = let sum = dst + src + (if old_flag then 1 else 0) in if adx_enabled then Some (sum >= pow2_64, sum % pow2_64) else None val ins_Adcx64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 val ins_Adox64 : instr_dep [inOut opFlagsOf; inOut op64] [op64] PreserveFlags eval_Adcx64_Adox64 let eval_Sub64 (dst src:nat64) : option (bool & nat64) = let diff = dst - src in Some (diff < 0, diff % pow2_64) val ins_Sub64 : instr_dep [out opFlagsCf; inOut op64] [op64] HavocFlags eval_Sub64 let eval_Sbb64 (old_carry:bool) (dst src:nat64) : option (bool & nat64) = let diff = dst - (src + (if old_carry then 1 else 0)) in Some (diff < 0, diff % pow2_64) // We specify cf, but underspecify everything else (via HavocFlags) val ins_Sbb64 : instr_dep [inOut opFlagsCf; inOut op64] [op64] HavocFlags eval_Sbb64 let eval_Mul64 (rax src:nat64) : option (nat64 & nat64) = Some (FStar.UInt.mul_div #64 rax src, FStar.UInt.mul_mod #64 rax src) val ins_Mul64 : instr_dep [out (one64Reg rRdx); inOut (one64Reg rRax)] [op64] HavocFlags eval_Mul64 let eval_Mulx64 (rdx src:nat64) : option (nat64 & nat64) = let hi = FStar.UInt.mul_div #64 rdx src in let lo = FStar.UInt.mul_mod #64 rdx src in if bmi2_enabled then Some (hi, lo) else None val ins_Mulx64 : instr_dep [out op64; out op64] [one64Reg rRdx; op64] PreserveFlags eval_Mulx64 let eval_IMul64 (dst src:nat64) : option nat64 = Some (FStar.UInt.mul_mod #64 dst src) val ins_IMul64 : instr_dep [inOut op64] [op64] HavocFlags eval_IMul64 let eval_And64 (dst src:nat64) : option nat64 = Some (iand dst src) val ins_And64 : instr_dep [inOut op64] [op64] HavocFlags eval_And64 let eval_Xor64 (dst src:nat64) : option (nat64 & (bool & bool)) = Some (Vale.Def.Types_s.ixor dst src, (false, false)) val ins_Xor64 : instr_dep [inOut op64; out opFlagsCf; out opFlagsOf] [op64] HavocFlags eval_Xor64 let eval_Shr64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishr dst amt) else None val ins_Shr64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shr64 let eval_Shl64 (dst amt:nat64) : option nat64 = if amt < 64 then Some (Vale.Def.Types_s.ishl dst amt) else None val ins_Shl64 : instr_dep [inOut op64] [op64] HavocFlags eval_Shl64 let eval_Cpuid (rax rcx:nat64) : option (nat64 & (nat64 & (nat64 & nat64))) = Some (cpuid rRax rax rcx, (cpuid rRbx rax rcx, (cpuid rRcx rax rcx, cpuid rRdx rax rcx))) val ins_Cpuid : instr_dep [inOut (one64Reg rRax); out (one64Reg rRbx); inOut (one64Reg rRcx); out (one64Reg rRdx)] [] PreserveFlags eval_Cpuid // The XGETBV instruction requires that OSXSAVE (in CPUID) is enabled. // We underspecify XGETBV here to only support fetching XCR0, which // is supported on any processor supporting the XGETBV instruction let eval_Xgetbv (rcx:nat64) : option (nat64 & nat64) = if osxsave_enabled && rcx = 0 then Some (xgetbv rRax rcx, xgetbv rRdx rcx) else None val ins_Xgetbv : instr_dep [out (one64Reg rRax); out (one64Reg rRdx)] [one64Reg rRcx] PreserveFlags eval_Xgetbv let check_avx (#a:Type0) (x:option a) : option a = if avx_enabled then x else None let check_sse2 (#a:Type0) (x:option a) : option a = if sse2_enabled then x else None let check_ssse3 (#a:Type0) (x:option a) : option a = if ssse3_enabled then x else None let check_sse4_1 (#a:Type0) (x:option a) : option a = if sse4_1_enabled then x else None let eval_Movdqu (src:quad32) : option quad32 = check_sse2 (Some src) val ins_Movdqu : instr_dep [out opXmm] [opXmm] PreserveFlags eval_Movdqu let eval_Pxor (dst src:quad32) : option quad32 = check_sse2 (Some (quad32_xor dst src)) val ins_Pxor : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pxor let eval_VPxor (src1 src2:quad32) : option quad32 = check_avx (Some (quad32_xor src1 src2)) val ins_VPxor : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPxor let eval_Pand (dst src:quad32) : option quad32 = check_sse2 (Some (four_map2 (fun di si -> iand di si) dst src)) val ins_Pand : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pand let eval_Paddd_raw (src1 src2:quad32) : option quad32 = Some (Mkfour ((src1.lo0 + src2.lo0) % pow2_32) ((src1.lo1 + src2.lo1) % pow2_32) ((src1.hi2 + src2.hi2) % pow2_32) ((src1.hi3 + src2.hi3) % pow2_32)) let eval_Paddd (src1 src2:quad32) : option quad32 = check_sse2 (eval_Paddd_raw src1 src2) val ins_Paddd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Paddd let eval_VPaddd (src1 src2:quad32) : option quad32 = check_avx (eval_Paddd_raw src1 src2) val ins_VPaddd : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPaddd let eval_Pslld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishl i amt) dst) else None) val ins_Pslld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Pslld amt) let eval_Psrld (amt:int) (dst:quad32) : option quad32 = check_sse2 (if 0 <= amt && amt < 32 then Some (four_map (fun i -> ishr i amt) dst) else None) val ins_Psrld (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrld amt) let eval_Psrldq (amt:int) (dst:quad32) : option quad32 = check_sse2 ( if 0 <= amt && amt < 16 then let src_bytes = le_quad32_to_bytes dst in let zero_pad = Seq.create amt 0 in let remaining_bytes = slice src_bytes amt (length src_bytes) in Some (le_bytes_to_quad32 (append zero_pad remaining_bytes)) else None) val ins_Psrldq (amt:int) : instr_dep [inOut opXmm] [] PreserveFlags (eval_Psrldq amt) let eval_Palignr_raw (amount:nat8) (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if amount = 4 then Some (Mkfour src2.lo1 src2.hi2 src2.hi3 src1.lo0) else if amount = 8 then Some (Mkfour src2.hi2 src2.hi3 src1.lo0 src1.lo1) else None let eval_Palignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Palignr_raw amount src1 src2) val ins_Palignr (amount:nat8) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Palignr amount) let eval_VPalignr (amount:nat8) (src1 src2:quad32) : option quad32 = check_avx (eval_Palignr_raw amount src1 src2) val ins_VPalignr (amount:nat8) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPalignr amount) let eval_Shufpd_raw (permutation:int) (src1 src2:quad32) : option quad32 = if 0 <= permutation && permutation < 4 then Some (Mkfour (if permutation % 2 = 0 then src1.lo0 else src1.hi2) (if permutation % 2 = 0 then src1.lo1 else src1.hi3) (if (permutation / 2) % 2 = 0 then src2.lo0 else src2.hi2) (if (permutation / 2) % 2 = 0 then src2.lo1 else src2.hi3)) else None let eval_Shufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_sse2 (eval_Shufpd_raw permutation src1 src2) val ins_Shufpd (permutation:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Shufpd permutation) let eval_VShufpd (permutation:int) (src1 src2:quad32) : option quad32 = check_avx (eval_Shufpd_raw permutation src1 src2) val ins_VShufpd (permutation:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VShufpd permutation) let is_full_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x04050607 && q.hi3 = 0x00010203 let is_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x00010203 && q.lo1 = 0x04050607 && q.hi2 = 0x08090A0B && q.hi3 = 0x0C0D0E0F let is_high_dup_reversal_mask (q:quad32) : bool = q.lo0 = 0x0C0D0E0F && q.lo1 = 0x08090A0B && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let is_lower_upper_byte_reversal_mask (q:quad32) : bool = q.lo0 = 0x04050607 && q.lo1 = 0x00010203 && q.hi2 = 0x0C0D0E0F && q.hi3 = 0x08090A0B let eval_Pshufb_raw (src1 src2:quad32) : option quad32 = // We only spec a restricted version sufficient for a handful of standard patterns if is_full_byte_reversal_mask src2 then Some (reverse_bytes_quad32 src1) else if is_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3)) else if is_high_dup_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else if is_lower_upper_byte_reversal_mask src2 then Some (Mkfour (reverse_bytes_nat32 src1.lo1) (reverse_bytes_nat32 src1.lo0) (reverse_bytes_nat32 src1.hi3) (reverse_bytes_nat32 src1.hi2)) else None let eval_Pshufb (src1 src2:quad32) : option quad32 = check_ssse3 (eval_Pshufb_raw src1 src2) val ins_Pshufb : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pshufb let eval_VPshufb (src1 src2:quad32) : option quad32 = check_avx (eval_Pshufb_raw src1 src2) val ins_VPshufb : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VPshufb let eval_Pshufd (permutation:nat8) (src:quad32) : option quad32 = check_sse2 ( let bits:bits_of_byte = byte_to_twobits permutation in Some (Mkfour (select_word src bits.lo0) (select_word src bits.lo1) (select_word src bits.hi2) (select_word src bits.hi3))) val ins_Pshufd (permutation:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_Pshufd permutation) let eval_Pcmpeqd (dst src:quad32) : option quad32 = check_sse2 ( let eq_result (b:bool):nat32 = if b then 0xFFFFFFFF else 0 in Some (Mkfour (eq_result (src.lo0 = dst.lo0)) (eq_result (src.lo1 = dst.lo1)) (eq_result (src.hi2 = dst.hi2)) (eq_result (src.hi3 = dst.hi3)))) val ins_Pcmpeqd : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_Pcmpeqd let eval_Pextrq (index:nat8) (src:quad32) : option nat64 = check_sse4_1 ( let src_two = four_to_two_two src in Some (two_to_nat 32 (two_select src_two (index % 2)))) val ins_Pextrq (index:nat8) : instr_dep [out op64] [opXmm] PreserveFlags (eval_Pextrq index) let eval_Pinsrd (index:nat8) (dst:quad32) (src:nat64) : option quad32 = check_sse4_1 (Some (insert_nat32 dst (src % pow2_32) (index % 4))) val ins_Pinsrd (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrd index) let eval_Pinsrq (index:nat8) (dst:quad32) (src:nat64) : option quad32 = check_sse4_1 (Some (insert_nat64_def dst src (index % 2))) val ins_Pinsrq (index:nat8) : instr_dep [inOut opXmm] [op64] PreserveFlags (eval_Pinsrq index) let eval_Pslldq_raw (count:nat8) (src:quad32) : option quad32 = // We only spec the two very special cases we need if count = 4 then Some (Mkfour 0 src.lo0 src.lo1 src.hi2) else if count = 8 then Some (Mkfour 0 0 src.lo0 src.lo1) else None let eval_VPslldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Pslldq_raw count src) val ins_VPslldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPslldq count) let eval_Psrldq_8_raw (count:nat8) (src:quad32) : option quad32 = // We only spec the one very special case we need if count = 8 then Some (Mkfour src.hi2 src.hi3 0 0) else None let eval_VPsrldq (count:nat8) (src:quad32) : option quad32 = check_avx (eval_Psrldq_8_raw count src) val ins_VPsrldq (count:nat8) : instr_dep [out opXmm] [opXmm] PreserveFlags (eval_VPsrldq count) let eval_Pclmulqdq (imm:int) (src1 src2:quad32) : option quad32 = let Mkfour a0 a1 a2 a3 = src1 in let Mkfour b0 b1 b2 b3 = src2 in let f x0 x1 y0 y1 = let x = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo x0 x1) in let y = Vale.Math.Poly2.Bits_s.of_double32 (Mktwo y0 y1) in Vale.Math.Poly2.Bits_s.to_quad32 (Vale.Math.Poly2_s.mul x y) in if pclmulqdq_enabled then match imm with | 0 -> Some (f a0 a1 b0 b1) | 1 -> Some (f a2 a3 b0 b1) | 16 -> Some (f a0 a1 b2 b3) | 17 -> Some (f a2 a3 b2 b3) | _ -> None else None val ins_Pclmulqdq (imm:int) : instr_dep [inOut opXmm] [opXmm] PreserveFlags (eval_Pclmulqdq imm) let eval_VPclmulqdq (imm:int) (src1 src2:quad32) : option quad32 = check_avx (eval_Pclmulqdq imm src1 src2) val ins_VPclmulqdq (imm:int) : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags (eval_VPclmulqdq imm) let eval_AESNI_enc (src1 src2:quad32) : option quad32 = if aesni_enabled then Some (quad32_xor (Vale.AES.AES_s.mix_columns_LE (Vale.AES.AES_s.sub_bytes (Vale.AES.AES_s.shift_rows_LE src1))) src2) else None val ins_AESNI_enc : instr_dep [inOut opXmm] [opXmm] PreserveFlags eval_AESNI_enc let eval_VAESNI_enc (src1 src2:quad32) : option quad32 = check_avx (eval_AESNI_enc src1 src2) val ins_VAESNI_enc : instr_dep [out opXmm] [opXmm; opXmm] PreserveFlags eval_VAESNI_enc
false
true
Vale.X64.Instructions_s.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 eval_AESNI_enc_last (src1 src2: quad32) : option quad32
[]
Vale.X64.Instructions_s.eval_AESNI_enc_last
{ "file_name": "vale/specs/hardware/Vale.X64.Instructions_s.fsti", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
src1: Vale.X64.Machine_s.quad32 -> src2: Vale.X64.Machine_s.quad32 -> FStar.Pervasives.Native.option Vale.X64.Machine_s.quad32
{ "end_col": 11, "end_line": 324, "start_col": 2, "start_line": 322 }