effect
stringclasses
48 values
original_source_type
stringlengths
0
23k
opens_and_abbrevs
listlengths
2
92
isa_cross_project_example
bool
1 class
source_definition
stringlengths
9
57.9k
partial_definition
stringlengths
7
23.3k
is_div
bool
2 classes
is_type
null
is_proof
bool
2 classes
completed_definiton
stringlengths
1
250k
dependencies
dict
effect_flags
sequencelengths
0
2
ideal_premises
sequencelengths
0
236
mutual_with
sequencelengths
0
11
file_context
stringlengths
0
407k
interleaved
bool
1 class
is_simply_typed
bool
2 classes
file_name
stringlengths
5
48
vconfig
dict
is_simple_lemma
null
source_type
stringlengths
10
23k
proof_features
sequencelengths
0
1
name
stringlengths
8
95
source
dict
verbose_type
stringlengths
1
7.42k
source_range
dict
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2
let bind_res (u2: R.universe) (t2 pre post2: R.term) =
false
null
false
mk_stt_comp u2 t2 pre post2
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_stt_comp" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bind_res : u2: FStar.Reflection.Types.universe -> t2: FStar.Reflection.Types.term -> pre: FStar.Reflection.Types.term -> post2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.bind_res
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u2: FStar.Reflection.Types.universe -> t2: FStar.Reflection.Types.term -> pre: FStar.Reflection.Types.term -> post2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 29, "end_line": 165, "start_col": 2, "start_line": 165 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2)
let sub_stt_equiv_post u t pre1 post1 pre2 post2 =
false
null
false
mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2)
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.V2.Data.aqualv", "Pulse.Soundness.Common.stt_vprop_post_equiv", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Soundness.Common.sub_stt_res" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post
false
false
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val sub_stt_equiv_post : u121: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre1: _ -> post1: FStar.Reflection.Types.term -> pre2: FStar.Reflection.Types.term -> post2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.sub_stt_equiv_post
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u121: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre1: _ -> post1: FStar.Reflection.Types.term -> pre2: FStar.Reflection.Types.term -> post2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 39, "end_line": 278, "start_col": 2, "start_line": 277 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame)
let frame_type_t_pre_post_frame (u: R.universe) (t pre post frame: R.term) =
false
null
false
let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame)
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Soundness.Common.frame_res", "Pulse.Reflection.Util.mk_stt_comp" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame))
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val frame_type_t_pre_post_frame : u94: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre: FStar.Reflection.Types.term -> post: FStar.Reflection.Types.term -> frame: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.frame_type_t_pre_post_frame
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u94: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre: FStar.Reflection.Types.term -> post: FStar.Reflection.Types.term -> frame: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 41, "end_line": 236, "start_col": 2, "start_line": 233 }
FStar.Pervasives.Lemma
val elab_close_commute' (e: term) (v: var) (n: index) : Lemma (RT.subst_term (elab_term e) [RT.ND v n] == elab_term (close_term' e v n)) [SMTPat (elab_term (close_term' e v n))]
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let elab_close_commute' (e:term) (v:var) (n:index) : Lemma (RT.subst_term (elab_term e) [ RT.ND v n ] == elab_term (close_term' e v n)) [SMTPat (elab_term (close_term' e v n))] = elab_close_commute' e v n
val elab_close_commute' (e: term) (v: var) (n: index) : Lemma (RT.subst_term (elab_term e) [RT.ND v n] == elab_term (close_term' e v n)) [SMTPat (elab_term (close_term' e v n))] let elab_close_commute' (e: term) (v: var) (n: index) : Lemma (RT.subst_term (elab_term e) [RT.ND v n] == elab_term (close_term' e v n)) [SMTPat (elab_term (close_term' e v n))] =
false
null
true
elab_close_commute' e v n
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "lemma" ]
[ "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.var", "Pulse.Syntax.Base.index", "Pulse.Elaborate.elab_close_commute'", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Types.term", "FStar.Reflection.Typing.subst_term", "Pulse.Elaborate.Pure.elab_term", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "Pulse.Syntax.Naming.close_term'", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var) let sub_stt_pre1 u t = let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var) let sub_stt_type u = let var = 4 in let t = mk_name var in let ty_typ = RT.tm_type u in mk_arrow (ty_typ, R.Q_Explicit) (RT.close_term (sub_stt_pre1 u t) var) (** Properties of environments suitable for elaboration **) let has_stt_bindings (f:RT.fstar_top_env) = RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\ RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True //(forall (u1 u2:R.universe). RT.lookup_fvar_uinst f bind_fv [u1; u2] == Some (bind_type u1 u2)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f frame_fv [u] == Some (frame_type u)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f subsumption_fv [u] == Some (sub_stt_type u)) let stt_env = e:env { has_stt_bindings (fstar_env e) } let check_top_level_environment (f:RT.fstar_top_env) : option stt_env = admit(); Some (mk_env f) //we should implement this as a runtime check let elab_comp_post (c:comp_st) : R.term = let t = elab_term (comp_res c) in let post = elab_term (comp_post c) in mk_abs t R.Q_Explicit post let comp_post_type (c:comp_st) : R.term = let t = elab_term (comp_res c) in mk_arrow (t, R.Q_Explicit) vprop_tm assume val inversion_of_stt_typing (g:env) (c:comp_st) (u:R.universe) // _ |- stt u#u t pre (fun (x:t) -> post) : Type _ (_:RT.tot_typing (elab_env g) (elab_comp c) (RT.tm_type u)) : GTot ( // _ |- t : Type u#u RT.tot_typing (elab_env g) (elab_term (comp_res c)) (RT.tm_type (comp_u c)) & // _ |- pre : vprop RT.tot_typing (elab_env g) (elab_term (comp_pre c)) (elab_term (tm_vprop)) & // _ |- (fun (x:t) -> post) : t -> vprop RT.tot_typing (elab_env g) (elab_comp_post c) (elab_term (tm_arrow (null_binder (comp_res c)) None (C_Tot tm_vprop)))) let soundness_t (d:'a) = g:stt_env -> t:st_term -> c:comp -> d':st_typing g t c{d' << d} -> GTot (RT.tot_typing (elab_env g) (elab_st_typing d') (elab_comp c)) let elab_open_commute' (e:term) (v:term) (n:index) : Lemma (ensures RT.subst_term (elab_term e) [ RT.DT n (elab_term v)] == elab_term (open_term' e v n)) [SMTPat (elab_term (open_term' e v n))] = elab_open_commute' e v n let elab_close_commute' (e:term) (v:var) (n:index) : Lemma (RT.subst_term (elab_term e) [ RT.ND v n ] == elab_term (close_term' e v n)) [SMTPat (elab_term (close_term' e v n))] =
false
false
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val elab_close_commute' (e: term) (v: var) (n: index) : Lemma (RT.subst_term (elab_term e) [RT.ND v n] == elab_term (close_term' e v n)) [SMTPat (elab_term (close_term' e v n))]
[]
Pulse.Soundness.Common.elab_close_commute'
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
e: Pulse.Syntax.Base.term -> v: Pulse.Syntax.Base.var -> n: Pulse.Syntax.Base.index -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_term (Pulse.Elaborate.Pure.elab_term e) [FStar.Reflection.Typing.ND v n] == Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Naming.close_term' e v n)) [SMTPat (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Naming.close_term' e v n))]
{ "end_col": 27, "end_line": 384, "start_col": 2, "start_line": 384 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ])
let bind_type_t1_t2_pre_post1 (u1 u2: R.universe) (t1 t2 pre post1: R.term) =
false
null
false
let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [RT.ND var 0])
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.V2.Data.aqualv", "Pulse.Soundness.Common.post2_type_bind", "FStar.Reflection.V2.Data.Q_Implicit", "FStar.Reflection.Typing.subst_term", "Pulse.Soundness.Common.bind_type_t1_t2_pre_post1_post2", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "Pulse.Reflection.Util.mk_name", "Prims.int" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bind_type_t1_t2_pre_post1 : u1: FStar.Reflection.Types.universe -> u2: FStar.Reflection.Types.universe -> t1: FStar.Reflection.Types.term -> t2: FStar.Reflection.Types.term -> pre: FStar.Reflection.Types.term -> post1: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.bind_type_t1_t2_pre_post1
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u1: FStar.Reflection.Types.universe -> u2: FStar.Reflection.Types.universe -> t1: FStar.Reflection.Types.term -> t2: FStar.Reflection.Types.term -> pre: FStar.Reflection.Types.term -> post1: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 42, "end_line": 186, "start_col": 75, "start_line": 181 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let sub_stt_pre1 u t = let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var)
let sub_stt_pre1 u t =
false
null
false
let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var)
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Reflection.Typing.close_term", "Pulse.Soundness.Common.sub_stt_post1", "Pulse.Reflection.Util.vprop_tm", "Pulse.Reflection.Util.mk_name", "Prims.int" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val sub_stt_pre1 : u140: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.sub_stt_pre1
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u140: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 55, "end_line": 310, "start_col": 22, "start_line": 305 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var)
let sub_stt_post2 u t pre1 post1 pre2 =
false
null
false
let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var)
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Reflection.Typing.close_term", "Pulse.Soundness.Common.sub_stt_equiv_pre", "Pulse.Reflection.Util.vprop_tm", "Pulse.Reflection.Util.mk_name", "Prims.int" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val sub_stt_post2 : u131: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre1: FStar.Reflection.Types.term -> post1: FStar.Reflection.Types.term -> pre2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.sub_stt_post2
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u131: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre1: FStar.Reflection.Types.term -> post1: FStar.Reflection.Types.term -> pre2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 76, "end_line": 289, "start_col": 39, "start_line": 284 }
Prims.GTot
val ghost_typing_soundness (#g: env) (#e #t: term) (d: ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d
val ghost_typing_soundness (#g: env) (#e #t: term) (d: ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) let ghost_typing_soundness (#g: env) (#e #t: term) (d: ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) =
false
null
false
let E d = d in d
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "sometrivial" ]
[ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.term", "Pulse.Typing.ghost_typing", "FStar.Reflection.Typing.typing", "Pulse.Typing.elab_env", "Pulse.Elaborate.Pure.elab_term", "FStar.Pervasives.Native.Mktuple2", "FStar.Stubs.TypeChecker.Core.tot_or_ghost", "FStar.Reflection.Types.typ", "FStar.Stubs.TypeChecker.Core.E_Ghost", "FStar.Reflection.Typing.ghost_typing" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t)
false
false
Pulse.Soundness.Common.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 ghost_typing_soundness (#g: env) (#e #t: term) (d: ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))
[]
Pulse.Soundness.Common.ghost_typing_soundness
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
d: Pulse.Typing.ghost_typing g e t -> Prims.GTot (FStar.Reflection.Typing.ghost_typing (Pulse.Typing.elab_env g) (Pulse.Elaborate.Pure.elab_term e) (Pulse.Elaborate.Pure.elab_term t))
{ "end_col": 5, "end_line": 60, "start_col": 3, "start_line": 59 }
FStar.Pervasives.Lemma
val elab_open_commute' (e v: term) (n: index) : Lemma (ensures RT.subst_term (elab_term e) [RT.DT n (elab_term v)] == elab_term (open_term' e v n)) [SMTPat (elab_term (open_term' e v n))]
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let elab_open_commute' (e:term) (v:term) (n:index) : Lemma (ensures RT.subst_term (elab_term e) [ RT.DT n (elab_term v)] == elab_term (open_term' e v n)) [SMTPat (elab_term (open_term' e v n))] = elab_open_commute' e v n
val elab_open_commute' (e v: term) (n: index) : Lemma (ensures RT.subst_term (elab_term e) [RT.DT n (elab_term v)] == elab_term (open_term' e v n)) [SMTPat (elab_term (open_term' e v n))] let elab_open_commute' (e v: term) (n: index) : Lemma (ensures RT.subst_term (elab_term e) [RT.DT n (elab_term v)] == elab_term (open_term' e v n)) [SMTPat (elab_term (open_term' e v n))] =
false
null
true
elab_open_commute' e v n
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "lemma" ]
[ "Pulse.Syntax.Base.term", "Pulse.Syntax.Base.index", "Pulse.Elaborate.elab_open_commute'", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Types.term", "FStar.Reflection.Typing.subst_term", "Pulse.Elaborate.Pure.elab_term", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.DT", "Prims.Nil", "Pulse.Syntax.Naming.open_term'", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var) let sub_stt_pre1 u t = let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var) let sub_stt_type u = let var = 4 in let t = mk_name var in let ty_typ = RT.tm_type u in mk_arrow (ty_typ, R.Q_Explicit) (RT.close_term (sub_stt_pre1 u t) var) (** Properties of environments suitable for elaboration **) let has_stt_bindings (f:RT.fstar_top_env) = RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\ RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True //(forall (u1 u2:R.universe). RT.lookup_fvar_uinst f bind_fv [u1; u2] == Some (bind_type u1 u2)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f frame_fv [u] == Some (frame_type u)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f subsumption_fv [u] == Some (sub_stt_type u)) let stt_env = e:env { has_stt_bindings (fstar_env e) } let check_top_level_environment (f:RT.fstar_top_env) : option stt_env = admit(); Some (mk_env f) //we should implement this as a runtime check let elab_comp_post (c:comp_st) : R.term = let t = elab_term (comp_res c) in let post = elab_term (comp_post c) in mk_abs t R.Q_Explicit post let comp_post_type (c:comp_st) : R.term = let t = elab_term (comp_res c) in mk_arrow (t, R.Q_Explicit) vprop_tm assume val inversion_of_stt_typing (g:env) (c:comp_st) (u:R.universe) // _ |- stt u#u t pre (fun (x:t) -> post) : Type _ (_:RT.tot_typing (elab_env g) (elab_comp c) (RT.tm_type u)) : GTot ( // _ |- t : Type u#u RT.tot_typing (elab_env g) (elab_term (comp_res c)) (RT.tm_type (comp_u c)) & // _ |- pre : vprop RT.tot_typing (elab_env g) (elab_term (comp_pre c)) (elab_term (tm_vprop)) & // _ |- (fun (x:t) -> post) : t -> vprop RT.tot_typing (elab_env g) (elab_comp_post c) (elab_term (tm_arrow (null_binder (comp_res c)) None (C_Tot tm_vprop)))) let soundness_t (d:'a) = g:stt_env -> t:st_term -> c:comp -> d':st_typing g t c{d' << d} -> GTot (RT.tot_typing (elab_env g) (elab_st_typing d') (elab_comp c)) let elab_open_commute' (e:term) (v:term) (n:index) : Lemma (ensures RT.subst_term (elab_term e) [ RT.DT n (elab_term v)] == elab_term (open_term' e v n)) [SMTPat (elab_term (open_term' e v n))] =
false
false
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val elab_open_commute' (e v: term) (n: index) : Lemma (ensures RT.subst_term (elab_term e) [RT.DT n (elab_term v)] == elab_term (open_term' e v n)) [SMTPat (elab_term (open_term' e v n))]
[]
Pulse.Soundness.Common.elab_open_commute'
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
e: Pulse.Syntax.Base.term -> v: Pulse.Syntax.Base.term -> n: Pulse.Syntax.Base.index -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.subst_term (Pulse.Elaborate.Pure.elab_term e) [FStar.Reflection.Typing.DT n (Pulse.Elaborate.Pure.elab_term v)] == Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Naming.open_term' e v n)) [SMTPat (Pulse.Elaborate.Pure.elab_term (Pulse.Syntax.Naming.open_term' e v n))]
{ "end_col": 26, "end_line": 377, "start_col": 2, "start_line": 377 }
Prims.Tot
val comp_post_type (c: comp_st) : R.term
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let comp_post_type (c:comp_st) : R.term = let t = elab_term (comp_res c) in mk_arrow (t, R.Q_Explicit) vprop_tm
val comp_post_type (c: comp_st) : R.term let comp_post_type (c: comp_st) : R.term =
false
null
false
let t = elab_term (comp_res c) in mk_arrow (t, R.Q_Explicit) vprop_tm
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "Pulse.Syntax.Base.comp_st", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Reflection.Util.vprop_tm", "Pulse.Elaborate.Pure.elab_term", "Pulse.Syntax.Base.comp_res" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var) let sub_stt_pre1 u t = let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var) let sub_stt_type u = let var = 4 in let t = mk_name var in let ty_typ = RT.tm_type u in mk_arrow (ty_typ, R.Q_Explicit) (RT.close_term (sub_stt_pre1 u t) var) (** Properties of environments suitable for elaboration **) let has_stt_bindings (f:RT.fstar_top_env) = RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\ RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True //(forall (u1 u2:R.universe). RT.lookup_fvar_uinst f bind_fv [u1; u2] == Some (bind_type u1 u2)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f frame_fv [u] == Some (frame_type u)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f subsumption_fv [u] == Some (sub_stt_type u)) let stt_env = e:env { has_stt_bindings (fstar_env e) } let check_top_level_environment (f:RT.fstar_top_env) : option stt_env = admit(); Some (mk_env f) //we should implement this as a runtime check let elab_comp_post (c:comp_st) : R.term = let t = elab_term (comp_res c) in let post = elab_term (comp_post c) in mk_abs t R.Q_Explicit post
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val comp_post_type (c: comp_st) : R.term
[]
Pulse.Soundness.Common.comp_post_type
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
c: Pulse.Syntax.Base.comp_st -> FStar.Reflection.Types.term
{ "end_col": 37, "end_line": 341, "start_col": 41, "start_line": 339 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ])
let bind_type_t1_t2 (u1 u2: R.universe) (t1 t2: R.term) =
false
null
false
let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [RT.ND var 0])
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Implicit", "FStar.Reflection.Typing.subst_term", "Pulse.Soundness.Common.bind_type_t1_t2_pre", "Prims.Cons", "FStar.Reflection.Typing.subst_elt", "FStar.Reflection.Typing.ND", "Prims.Nil", "Pulse.Reflection.Util.vprop_tm", "Pulse.Reflection.Util.mk_name", "Prims.int" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ])
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val bind_type_t1_t2 : u1: FStar.Reflection.Types.universe -> u2: FStar.Reflection.Types.universe -> t1: FStar.Reflection.Types.term -> t2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.bind_type_t1_t2
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u1: FStar.Reflection.Types.universe -> u2: FStar.Reflection.Types.universe -> t1: FStar.Reflection.Types.term -> t2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 42, "end_line": 202, "start_col": 55, "start_line": 196 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let sub_stt_type u = let var = 4 in let t = mk_name var in let ty_typ = RT.tm_type u in mk_arrow (ty_typ, R.Q_Explicit) (RT.close_term (sub_stt_pre1 u t) var)
let sub_stt_type u =
false
null
false
let var = 4 in let t = mk_name var in let ty_typ = RT.tm_type u in mk_arrow (ty_typ, R.Q_Explicit) (RT.close_term (sub_stt_pre1 u t) var)
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Reflection.Typing.close_term", "Pulse.Soundness.Common.sub_stt_pre1", "FStar.Reflection.Typing.tm_type", "Pulse.Reflection.Util.mk_name", "Prims.int" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var) let sub_stt_pre1 u t = let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val sub_stt_type : u141: FStar.Reflection.Types.universe -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.sub_stt_type
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u141: FStar.Reflection.Types.universe -> FStar.Reflection.Types.term
{ "end_col": 49, "end_line": 317, "start_col": 20, "start_line": 312 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let has_stt_bindings (f:RT.fstar_top_env) = RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\ RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True
let has_stt_bindings (f: RT.fstar_top_env) =
false
null
false
RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\ RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Typing.fstar_top_env", "Prims.l_and", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Reflection.Types.term", "FStar.Reflection.Typing.lookup_fvar", "FStar.Reflection.Typing.bool_fv", "FStar.Pervasives.Native.Some", "FStar.Reflection.Typing.tm_type", "FStar.Reflection.Typing.u_zero", "Pulse.Reflection.Util.vprop_fv", "Pulse.Syntax.Pure.u2", "Prims.l_True", "Prims.logical" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var) let sub_stt_pre1 u t = let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var) let sub_stt_type u = let var = 4 in let t = mk_name var in let ty_typ = RT.tm_type u in mk_arrow (ty_typ, R.Q_Explicit) (RT.close_term (sub_stt_pre1 u t) var) (** Properties of environments suitable for elaboration **)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val has_stt_bindings : f: FStar.Reflection.Typing.fstar_top_env -> Prims.logical
[]
Pulse.Soundness.Common.has_stt_bindings
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
f: FStar.Reflection.Typing.fstar_top_env -> Prims.logical
{ "end_col": 61, "end_line": 323, "start_col": 4, "start_line": 322 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var)
let frame_type (u: R.universe) =
false
null
false
let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var)
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Implicit", "FStar.Reflection.Typing.close_term", "Pulse.Soundness.Common.frame_type_t", "FStar.Reflection.Typing.tm_type", "Pulse.Reflection.Util.mk_name", "Prims.int" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val frame_type : u104: FStar.Reflection.Types.universe -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.frame_type
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u104: FStar.Reflection.Types.universe -> FStar.Reflection.Types.term
{ "end_col": 49, "end_line": 263, "start_col": 31, "start_line": 258 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv")
let stt_vprop_post_equiv_fv =
false
null
false
R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv")
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.V2.Builtins.pack_fv", "Pulse.Reflection.Util.mk_pulse_lib_core_lid" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val stt_vprop_post_equiv_fv : FStar.Reflection.Types.fv
[]
Pulse.Soundness.Common.stt_vprop_post_equiv_fv
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
FStar.Reflection.Types.fv
{ "end_col": 82, "end_line": 268, "start_col": 30, "start_line": 268 }
FStar.Pervasives.Lemma
val elab_comp_open_commute (c: comp) (x: term) : Lemma (ensures elab_comp (open_comp_with c x) == RT.open_with (elab_comp c) (elab_term x)) [SMTPat (elab_comp (open_comp_with c x))]
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let elab_comp_open_commute (c:comp) (x:term) : Lemma (ensures elab_comp (open_comp_with c x) == RT.open_with (elab_comp c) (elab_term x)) [SMTPat (elab_comp (open_comp_with c x))] = elab_comp_open_commute c x
val elab_comp_open_commute (c: comp) (x: term) : Lemma (ensures elab_comp (open_comp_with c x) == RT.open_with (elab_comp c) (elab_term x)) [SMTPat (elab_comp (open_comp_with c x))] let elab_comp_open_commute (c: comp) (x: term) : Lemma (ensures elab_comp (open_comp_with c x) == RT.open_with (elab_comp c) (elab_term x)) [SMTPat (elab_comp (open_comp_with c x))] =
false
null
true
elab_comp_open_commute c x
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "lemma" ]
[ "Pulse.Syntax.Base.comp", "Pulse.Syntax.Base.term", "Pulse.Elaborate.elab_comp_open_commute", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Types.term", "Pulse.Elaborate.Pure.elab_comp", "Pulse.Syntax.Naming.open_comp_with", "FStar.Reflection.Typing.open_with", "Pulse.Elaborate.Pure.elab_term", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var) let sub_stt_pre1 u t = let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var) let sub_stt_type u = let var = 4 in let t = mk_name var in let ty_typ = RT.tm_type u in mk_arrow (ty_typ, R.Q_Explicit) (RT.close_term (sub_stt_pre1 u t) var) (** Properties of environments suitable for elaboration **) let has_stt_bindings (f:RT.fstar_top_env) = RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\ RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True //(forall (u1 u2:R.universe). RT.lookup_fvar_uinst f bind_fv [u1; u2] == Some (bind_type u1 u2)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f frame_fv [u] == Some (frame_type u)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f subsumption_fv [u] == Some (sub_stt_type u)) let stt_env = e:env { has_stt_bindings (fstar_env e) } let check_top_level_environment (f:RT.fstar_top_env) : option stt_env = admit(); Some (mk_env f) //we should implement this as a runtime check let elab_comp_post (c:comp_st) : R.term = let t = elab_term (comp_res c) in let post = elab_term (comp_post c) in mk_abs t R.Q_Explicit post let comp_post_type (c:comp_st) : R.term = let t = elab_term (comp_res c) in mk_arrow (t, R.Q_Explicit) vprop_tm assume val inversion_of_stt_typing (g:env) (c:comp_st) (u:R.universe) // _ |- stt u#u t pre (fun (x:t) -> post) : Type _ (_:RT.tot_typing (elab_env g) (elab_comp c) (RT.tm_type u)) : GTot ( // _ |- t : Type u#u RT.tot_typing (elab_env g) (elab_term (comp_res c)) (RT.tm_type (comp_u c)) & // _ |- pre : vprop RT.tot_typing (elab_env g) (elab_term (comp_pre c)) (elab_term (tm_vprop)) & // _ |- (fun (x:t) -> post) : t -> vprop RT.tot_typing (elab_env g) (elab_comp_post c) (elab_term (tm_arrow (null_binder (comp_res c)) None (C_Tot tm_vprop)))) let soundness_t (d:'a) = g:stt_env -> t:st_term -> c:comp -> d':st_typing g t c{d' << d} -> GTot (RT.tot_typing (elab_env g) (elab_st_typing d') (elab_comp c)) let elab_open_commute' (e:term) (v:term) (n:index) : Lemma (ensures RT.subst_term (elab_term e) [ RT.DT n (elab_term v)] == elab_term (open_term' e v n)) [SMTPat (elab_term (open_term' e v n))] = elab_open_commute' e v n let elab_close_commute' (e:term) (v:var) (n:index) : Lemma (RT.subst_term (elab_term e) [ RT.ND v n ] == elab_term (close_term' e v n)) [SMTPat (elab_term (close_term' e v n))] = elab_close_commute' e v n let elab_comp_close_commute (c:comp) (x:var) : Lemma (ensures elab_comp (close_comp c x) == RT.close_term (elab_comp c) x) [SMTPat (elab_comp (close_comp c x))] = elab_comp_close_commute c x let elab_comp_open_commute (c:comp) (x:term) : Lemma (ensures elab_comp (open_comp_with c x) == RT.open_with (elab_comp c) (elab_term x)) [SMTPat (elab_comp (open_comp_with c x))] =
false
false
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val elab_comp_open_commute (c: comp) (x: term) : Lemma (ensures elab_comp (open_comp_with c x) == RT.open_with (elab_comp c) (elab_term x)) [SMTPat (elab_comp (open_comp_with c x))]
[]
Pulse.Soundness.Common.elab_comp_open_commute
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
c: Pulse.Syntax.Base.comp -> x: Pulse.Syntax.Base.term -> FStar.Pervasives.Lemma (ensures Pulse.Elaborate.Pure.elab_comp (Pulse.Syntax.Naming.open_comp_with c x) == FStar.Reflection.Typing.open_with (Pulse.Elaborate.Pure.elab_comp c) (Pulse.Elaborate.Pure.elab_term x)) [SMTPat (Pulse.Elaborate.Pure.elab_comp (Pulse.Syntax.Naming.open_comp_with c x))]
{ "end_col": 28, "end_line": 396, "start_col": 2, "start_line": 396 }
FStar.Pervasives.Lemma
val elab_comp_close_commute (c: comp) (x: var) : Lemma (ensures elab_comp (close_comp c x) == RT.close_term (elab_comp c) x) [SMTPat (elab_comp (close_comp c x))]
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let elab_comp_close_commute (c:comp) (x:var) : Lemma (ensures elab_comp (close_comp c x) == RT.close_term (elab_comp c) x) [SMTPat (elab_comp (close_comp c x))] = elab_comp_close_commute c x
val elab_comp_close_commute (c: comp) (x: var) : Lemma (ensures elab_comp (close_comp c x) == RT.close_term (elab_comp c) x) [SMTPat (elab_comp (close_comp c x))] let elab_comp_close_commute (c: comp) (x: var) : Lemma (ensures elab_comp (close_comp c x) == RT.close_term (elab_comp c) x) [SMTPat (elab_comp (close_comp c x))] =
false
null
true
elab_comp_close_commute c x
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "lemma" ]
[ "Pulse.Syntax.Base.comp", "Pulse.Syntax.Base.var", "Pulse.Elaborate.elab_comp_close_commute", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Reflection.Types.term", "Pulse.Elaborate.Pure.elab_comp", "Pulse.Syntax.Naming.close_comp", "FStar.Reflection.Typing.close_term", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var) let sub_stt_pre1 u t = let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var) let sub_stt_type u = let var = 4 in let t = mk_name var in let ty_typ = RT.tm_type u in mk_arrow (ty_typ, R.Q_Explicit) (RT.close_term (sub_stt_pre1 u t) var) (** Properties of environments suitable for elaboration **) let has_stt_bindings (f:RT.fstar_top_env) = RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\ RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True //(forall (u1 u2:R.universe). RT.lookup_fvar_uinst f bind_fv [u1; u2] == Some (bind_type u1 u2)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f frame_fv [u] == Some (frame_type u)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f subsumption_fv [u] == Some (sub_stt_type u)) let stt_env = e:env { has_stt_bindings (fstar_env e) } let check_top_level_environment (f:RT.fstar_top_env) : option stt_env = admit(); Some (mk_env f) //we should implement this as a runtime check let elab_comp_post (c:comp_st) : R.term = let t = elab_term (comp_res c) in let post = elab_term (comp_post c) in mk_abs t R.Q_Explicit post let comp_post_type (c:comp_st) : R.term = let t = elab_term (comp_res c) in mk_arrow (t, R.Q_Explicit) vprop_tm assume val inversion_of_stt_typing (g:env) (c:comp_st) (u:R.universe) // _ |- stt u#u t pre (fun (x:t) -> post) : Type _ (_:RT.tot_typing (elab_env g) (elab_comp c) (RT.tm_type u)) : GTot ( // _ |- t : Type u#u RT.tot_typing (elab_env g) (elab_term (comp_res c)) (RT.tm_type (comp_u c)) & // _ |- pre : vprop RT.tot_typing (elab_env g) (elab_term (comp_pre c)) (elab_term (tm_vprop)) & // _ |- (fun (x:t) -> post) : t -> vprop RT.tot_typing (elab_env g) (elab_comp_post c) (elab_term (tm_arrow (null_binder (comp_res c)) None (C_Tot tm_vprop)))) let soundness_t (d:'a) = g:stt_env -> t:st_term -> c:comp -> d':st_typing g t c{d' << d} -> GTot (RT.tot_typing (elab_env g) (elab_st_typing d') (elab_comp c)) let elab_open_commute' (e:term) (v:term) (n:index) : Lemma (ensures RT.subst_term (elab_term e) [ RT.DT n (elab_term v)] == elab_term (open_term' e v n)) [SMTPat (elab_term (open_term' e v n))] = elab_open_commute' e v n let elab_close_commute' (e:term) (v:var) (n:index) : Lemma (RT.subst_term (elab_term e) [ RT.ND v n ] == elab_term (close_term' e v n)) [SMTPat (elab_term (close_term' e v n))] = elab_close_commute' e v n let elab_comp_close_commute (c:comp) (x:var) : Lemma (ensures elab_comp (close_comp c x) == RT.close_term (elab_comp c) x) [SMTPat (elab_comp (close_comp c x))] =
false
false
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val elab_comp_close_commute (c: comp) (x: var) : Lemma (ensures elab_comp (close_comp c x) == RT.close_term (elab_comp c) x) [SMTPat (elab_comp (close_comp c x))]
[]
Pulse.Soundness.Common.elab_comp_close_commute
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
c: Pulse.Syntax.Base.comp -> x: Pulse.Syntax.Base.var -> FStar.Pervasives.Lemma (ensures Pulse.Elaborate.Pure.elab_comp (Pulse.Syntax.Naming.close_comp c x) == FStar.Reflection.Typing.close_term (Pulse.Elaborate.Pure.elab_comp c) x) [SMTPat (Pulse.Elaborate.Pure.elab_comp (Pulse.Syntax.Naming.close_comp c x))]
{ "end_col": 29, "end_line": 390, "start_col": 2, "start_line": 390 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var)
let frame_type_t_pre (u: R.universe) (t pre: R.term) =
false
null
false
let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var)
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Implicit", "FStar.Reflection.Typing.close_term", "Pulse.Soundness.Common.frame_type_t_pre_post", "FStar.Reflection.V2.Data.Q_Explicit", "Pulse.Reflection.Util.vprop_tm", "Pulse.Reflection.Util.mk_name", "Prims.int" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val frame_type_t_pre : u101: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.frame_type_t_pre
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u101: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 67, "end_line": 249, "start_col": 52, "start_line": 244 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)]
let stt_vprop_post_equiv (u: R.universe) (t t1 t2: R.term) =
false
null
false
R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)]
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "FStar.Reflection.V2.Derived.mk_app", "Pulse.Soundness.Common.stt_vprop_post_equiv_univ_inst", "Prims.Cons", "FStar.Reflection.V2.Data.argv", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Implicit", "FStar.Reflection.V2.Data.Q_Explicit", "Prims.Nil" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u])
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val stt_vprop_post_equiv : u109: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> t1: FStar.Reflection.Types.term -> t2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.stt_vprop_post_equiv
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u109: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> t1: FStar.Reflection.Types.term -> t2: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 70, "end_line": 272, "start_col": 2, "start_line": 271 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var)
let sub_stt_post1 u t pre1 =
false
null
false
let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var)
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Reflection.Types.universe", "FStar.Reflection.Types.term", "Pulse.Reflection.Util.mk_arrow", "FStar.Pervasives.Native.Mktuple2", "FStar.Reflection.V2.Data.aqualv", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Reflection.Typing.close_term", "Pulse.Soundness.Common.sub_stt_pre2", "Pulse.Reflection.Util.vprop_tm", "Pulse.Reflection.Util.mk_name", "Prims.int" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var)
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val sub_stt_post1 : u138: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre1: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.sub_stt_post1
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
u138: FStar.Reflection.Types.universe -> t: FStar.Reflection.Types.term -> pre1: FStar.Reflection.Types.term -> FStar.Reflection.Types.term
{ "end_col": 60, "end_line": 303, "start_col": 28, "start_line": 298 }
Prims.Tot
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None
let elab_term_opt (b: option term) =
false
null
false
match b with | Some b -> Some (elab_term b) | None -> None
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "FStar.Pervasives.Native.option", "Pulse.Syntax.Base.term", "FStar.Pervasives.Native.Some", "FStar.Reflection.Types.term", "Pulse.Elaborate.Pure.elab_term", "FStar.Pervasives.Native.None" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us
false
true
Pulse.Soundness.Common.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 elab_term_opt : b: FStar.Pervasives.Native.option Pulse.Syntax.Base.term -> FStar.Pervasives.Native.option FStar.Reflection.Types.term
[]
Pulse.Soundness.Common.elab_term_opt
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
b: FStar.Pervasives.Native.option Pulse.Syntax.Base.term -> FStar.Pervasives.Native.option FStar.Reflection.Types.term
{ "end_col": 16, "end_line": 28, "start_col": 2, "start_line": 26 }
FStar.Pervasives.Lemma
val extend_env_l_lookup_fvar (g: R.env) (sg: env_bindings) (fv: R.fv) (us: R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us
val extend_env_l_lookup_fvar (g: R.env) (sg: env_bindings) (fv: R.fv) (us: R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] let rec extend_env_l_lookup_fvar (g: R.env) (sg: env_bindings) (fv: R.fv) (us: R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] =
false
null
true
match sg with | [] -> () | hd :: tl -> extend_env_l_lookup_fvar g tl fv us
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "lemma" ]
[ "FStar.Reflection.Types.env", "Pulse.Typing.Env.env_bindings", "FStar.Reflection.Types.fv", "FStar.Reflection.V2.Data.universes", "Pulse.Typing.Env.binding", "Prims.list", "Pulse.Soundness.Common.extend_env_l_lookup_fvar", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.eq2", "FStar.Pervasives.Native.option", "FStar.Reflection.Types.term", "FStar.Reflection.Typing.lookup_fvar_uinst", "Pulse.Typing.extend_env_l", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us)
false
false
Pulse.Soundness.Common.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 extend_env_l_lookup_fvar (g: R.env) (sg: env_bindings) (fv: R.fv) (us: R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)]
[ "recursion" ]
Pulse.Soundness.Common.extend_env_l_lookup_fvar
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
g: FStar.Reflection.Types.env -> sg: Pulse.Typing.Env.env_bindings -> fv: FStar.Reflection.Types.fv -> us: FStar.Reflection.V2.Data.universes -> FStar.Pervasives.Lemma (ensures FStar.Reflection.Typing.lookup_fvar_uinst (Pulse.Typing.extend_env_l g sg) fv us == FStar.Reflection.Typing.lookup_fvar_uinst g fv us) [SMTPat (FStar.Reflection.Typing.lookup_fvar_uinst (Pulse.Typing.extend_env_l g sg) fv us)]
{ "end_col": 51, "end_line": 22, "start_col": 4, "start_line": 20 }
Prims.Tot
val elab_comp_post (c: comp_st) : R.term
[ { "abbrev": false, "full_module": "Pulse.Elaborate", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Typing", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Reflection.Util", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Syntax", "short_module": null }, { "abbrev": false, "full_module": "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.Soundness", "short_module": null }, { "abbrev": false, "full_module": "Pulse.Soundness", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let elab_comp_post (c:comp_st) : R.term = let t = elab_term (comp_res c) in let post = elab_term (comp_post c) in mk_abs t R.Q_Explicit post
val elab_comp_post (c: comp_st) : R.term let elab_comp_post (c: comp_st) : R.term =
false
null
false
let t = elab_term (comp_res c) in let post = elab_term (comp_post c) in mk_abs t R.Q_Explicit post
{ "checked_file": "Pulse.Soundness.Common.fst.checked", "dependencies": [ "Pulse.Typing.fst.checked", "Pulse.Syntax.fst.checked", "Pulse.Reflection.Util.fst.checked", "Pulse.Elaborate.fsti.checked", "prims.fst.checked", "FStar.Tactics.V2.fst.checked", "FStar.Set.fsti.checked", "FStar.Reflection.V2.fst.checked", "FStar.Reflection.Typing.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.List.Tot.fst.checked" ], "interface_file": false, "source_file": "Pulse.Soundness.Common.fst" }
[ "total" ]
[ "Pulse.Syntax.Base.comp_st", "Pulse.Reflection.Util.mk_abs", "FStar.Reflection.V2.Data.Q_Explicit", "FStar.Reflection.Types.term", "Pulse.Elaborate.Pure.elab_term", "Pulse.Syntax.Base.comp_post", "Pulse.Syntax.Base.comp_res" ]
[]
module Pulse.Soundness.Common module RT = FStar.Reflection.Typing module R = FStar.Reflection.V2 module L = FStar.List.Tot module T = FStar.Tactics.V2 open FStar.List.Tot open Pulse.Syntax open Pulse.Reflection.Util open Pulse.Typing open Pulse.Elaborate let ln_comp = c:comp_st { ln_c c } let rec extend_env_l_lookup_fvar (g:R.env) (sg:env_bindings) (fv:R.fv) (us:R.universes) : Lemma (ensures RT.lookup_fvar_uinst (extend_env_l g sg) fv us == RT.lookup_fvar_uinst g fv us) [SMTPat (RT.lookup_fvar_uinst (extend_env_l g sg) fv us)] = match sg with | [] -> () | hd::tl -> extend_env_l_lookup_fvar g tl fv us let elab_term_opt (b:option term) = match b with | Some b -> Some (elab_term b) | None -> None // let rec extend_env_l_lookup_bvar (g:R.env) (sg:env_bindings) (x:var) // : Lemma // (requires (forall x. RT.lookup_bvar g x == None)) // (ensures (RT.lookup_bvar (extend_env_l g sg) x == elab_term_opt (lookup sg x))) // (decreases sg) // [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)] // = match sg with // | [] -> () // | hd :: tl -> extend_env_l_lookup_bvar g tl x let lookup_elab_env (g:env) (x:var) : Lemma (ensures (RT.lookup_bvar (elab_env g) x == elab_term_opt (lookup g x))) [SMTPat (RT.lookup_bvar (elab_env g) x)] = admit () // TODO: FIX ME!!!! let tot_typing_soundness (#g:env) (#e:term) (#t:term) (d:tot_typing g e t) : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d let ghost_typing_soundness (#g:env) (#e:term) (#t:term) (d:ghost_typing g e t) : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t)) = let E d = d in d #push-options "--z3rlimit_factor 4" let mk_t_abs_tot (g:env) (#u:universe) (#q:option qualifier) (#ty:term) (ppname:ppname) (t_typing:tot_typing g ty (tm_type u)) (#body:term) (#body_ty:term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars body) }) (body_typing:tot_typing (push_binding g x ppname ty) (open_term body x) body_ty) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (elab_term body)) (elab_term (tm_arrow {binder_ty=ty; binder_ppname=ppname} q (close_comp (C_Tot body_ty) x)))) = let c = C_Tot body_ty in let r_ty = elab_term ty in let r_body = elab_term (open_term body x) in let r_c = elab_comp c in let r_t_typing = tot_typing_soundness t_typing in let r_body_typing = tot_typing_soundness body_typing in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; elab_freevars body; assert (~ (x `Set.mem` RT.freevars (elab_term body))); assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; assert (elab_term (tm_type u) == RT.tm_type u); let r_t_typing : RT.tot_typing (elab_env g) r_ty (RT.tm_type u) = coerce_eq () r_t_typing //strange that this coercion is needed in let d : RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_term (open_term body x)) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp (C_Tot body_ty) x))) = RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing in elab_open_commute' body (null_var x) 0; RT.open_term_spec (elab_term body) x; assert (elab_term (open_term body x) == RT.open_term (elab_term body) x); let d : RT.typing _ (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (RT.open_term (elab_term body) x) x)) _ = d in RT.close_open_inverse (elab_term body) x; d let mk_t_abs (g:env) (#u:universe) (#ty:term) (#q:option qualifier) (#t_typing:typing g ty T.E_Total (tm_type u)) (ppname:ppname) (r_t_typing:RT.tot_typing (elab_env g) (elab_term ty) (elab_comp (C_Tot (tm_type u)))) (#body:st_term) (#x:var { None? (lookup g x) /\ ~(x `Set.mem` freevars_st body) }) (#c:comp) (#body_typing:st_typing (push_binding g x ppname ty) (open_st_term body x) c) (r_body_typing:RT.tot_typing (elab_env (push_binding g x ppname ty)) (elab_st_typing body_typing) (elab_comp c)) : GTot (RT.tot_typing (elab_env g) (mk_abs_with_name ppname.name (elab_term ty) (elab_qual q) (RT.close_term (elab_st_typing body_typing) x)) (elab_term (tm_arrow {binder_ty=ty;binder_ppname=ppname} q (close_comp c x)))) = let r_ty = elab_term ty in let r_body = elab_st_typing body_typing in let r_c = elab_comp c in RT.well_typed_terms_are_ln _ _ _ r_body_typing; RT.open_close_inverse r_body x; elab_comp_close_commute c x; assume (~ (x `Set.mem` RT.freevars (RT.close_term r_body x))); RT.close_term_spec (elab_comp c) x; RT.T_Abs (elab_env g) x r_ty (RT.close_term r_body x) (T.E_Total, r_c) u ppname.name (elab_qual q) _ r_t_typing r_body_typing (*** Typing of combinators used in the elaboration **) (** Type of bind **) let bind_res (u2:R.universe) (t2 pre post2:R.term) = mk_stt_comp u2 t2 pre post2 let g_type_bind (u2:R.universe) (t1 t2 post1 post2:R.term) = mk_arrow (t1, R.Q_Explicit) (bind_res u2 t2 (R.mk_app post1 [bound_var 0 (* x *), R.Q_Explicit]) post2) let bind_type_t1_t2_pre_post1_post2_f (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = mk_arrow (g_type_bind u2 t1 t2 post1 post2, R.Q_Explicit) (bind_res u2 t2 pre post2) let bind_type_t1_t2_pre_post1_post2 (u1 u2:R.universe) (t1 t2 pre post1 post2:R.term) = let f_type = mk_stt_comp u1 t1 pre post1 in mk_arrow (f_type, R.Q_Explicit) (bind_type_t1_t2_pre_post1_post2_f u1 u2 t1 t2 pre post1 post2) let post2_type_bind t2 = mk_arrow (t2, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre_post1 (u1 u2:R.universe) (t1 t2 pre post1:R.term) = let var = 0 in let post2 = mk_name var in mk_arrow (post2_type_bind t2, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1_post2 u1 u2 t1 t2 pre post1 post2) [ RT.ND var 0 ]) let post1_type_bind t1 = mk_arrow (t1, R.Q_Explicit) vprop_tm let bind_type_t1_t2_pre (u1 u2:R.universe) (t1 t2 pre:R.term) = let var = 1 in let post1 = mk_name var in mk_arrow (post1_type_bind t1, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre_post1 u1 u2 t1 t2 pre post1) [ RT.ND var 0 ]) let bind_type_t1_t2 (u1 u2:R.universe) (t1 t2:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2_pre u1 u2 t1 t2 pre) [ RT.ND var 0 ]) let bind_type_t1 (u1 u2:R.universe) (t1:R.term) = let var = 3 in let t2 = mk_name var in let t2_type = RT.tm_type u2 in mk_arrow (t2_type, R.Q_Implicit) (RT.subst_term (bind_type_t1_t2 u1 u2 t1 t2) [ RT.ND var 0 ]) let bind_type (u1 u2:R.universe) = let var = 4 in let t1 = mk_name var in let t1_type = RT.tm_type u1 in mk_arrow (t1_type, R.Q_Implicit) (RT.subst_term (bind_type_t1 u1 u2 t1) [ RT.ND var 0 ]) (** Type of frame **) let mk_star (l r:R.term) = let open R in let head = pack_ln (Tv_FVar (pack_fv star_lid)) in R.mk_app head [(l, Q_Explicit); (r, Q_Explicit)] let frame_res (u:R.universe) (t pre post frame:R.term) = mk_stt_comp u t (mk_star pre frame) (mk_abs t R.Q_Explicit (mk_star (R.mk_app post [bound_var 0, R.Q_Explicit]) frame)) let frame_type_t_pre_post_frame (u:R.universe) (t pre post frame:R.term) = let open R in let f_type = mk_stt_comp u t pre post in mk_arrow (f_type, Q_Explicit) (frame_res u t pre post frame) let frame_type_t_pre_post (u:R.universe) (t pre post:R.term) = let var = 0 in let frame = mk_name var in mk_arrow (vprop_tm, R.Q_Explicit) (RT.close_term (frame_res u t pre post frame) var) let frame_type_t_pre (u:R.universe) (t pre:R.term) = let var = 1 in let post = mk_name var in let post_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre_post u t pre post) var) let frame_type_t (u:R.universe) (t:R.term) = let var = 2 in let pre = mk_name var in let pre_type = vprop_tm in mk_arrow (pre_type, R.Q_Implicit) (RT.close_term (frame_type_t_pre u t pre) var) let frame_type (u:R.universe) = let var = 3 in let t = mk_name var in let t_type = RT.tm_type u in mk_arrow (t_type, R.Q_Implicit) (RT.close_term (frame_type_t u t) var) (** Type of sub_stt **) let stt_vprop_post_equiv_fv = R.pack_fv (mk_pulse_lib_core_lid "vprop_post_equiv") let stt_vprop_post_equiv_univ_inst u = R.pack_ln (R.Tv_UInst stt_vprop_post_equiv_fv [u]) let stt_vprop_post_equiv (u:R.universe) (t t1 t2:R.term) = R.mk_app (stt_vprop_post_equiv_univ_inst u) [(t, R.Q_Implicit); (t1, R.Q_Explicit); (t2, R.Q_Explicit)] let sub_stt_res u t pre post = mk_stt_comp u t pre post let sub_stt_equiv_post u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_post_equiv u t post1 post2, R.Q_Explicit) (sub_stt_res u t pre2 post2) let sub_stt_equiv_pre u t pre1 post1 pre2 post2 = mk_arrow (stt_vprop_equiv pre1 pre2, R.Q_Explicit) (sub_stt_equiv_post u t pre1 pre2 post1 post2) let sub_stt_post2 u t pre1 post1 pre2 = let var = 0 in let post2 = mk_name var in let post2_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post2_type, R.Q_Explicit) (RT.close_term (sub_stt_equiv_pre u t pre1 pre2 post1 post2) var) let sub_stt_pre2 u t pre1 post1 = let var = 1 in let pre2 = mk_name var in let pre2_type = vprop_tm in mk_arrow (pre2_type, R.Q_Explicit) (RT.close_term (sub_stt_post2 u t pre1 post1 pre2) var) let sub_stt_post1 u t pre1 = let var = 2 in let post1 = mk_name var in let post1_type = mk_arrow (t, R.Q_Explicit) vprop_tm in mk_arrow (post1_type, R.Q_Explicit) (RT.close_term (sub_stt_pre2 u t pre1 post1) var) let sub_stt_pre1 u t = let var = 3 in let pre1 = mk_name var in let pre1_type = vprop_tm in mk_arrow (pre1_type, R.Q_Explicit) (RT.close_term (sub_stt_post1 u t pre1) var) let sub_stt_type u = let var = 4 in let t = mk_name var in let ty_typ = RT.tm_type u in mk_arrow (ty_typ, R.Q_Explicit) (RT.close_term (sub_stt_pre1 u t) var) (** Properties of environments suitable for elaboration **) let has_stt_bindings (f:RT.fstar_top_env) = RT.lookup_fvar f RT.bool_fv == Some (RT.tm_type RT.u_zero) /\ RT.lookup_fvar f vprop_fv == Some (RT.tm_type u2) /\ True //(forall (u1 u2:R.universe). RT.lookup_fvar_uinst f bind_fv [u1; u2] == Some (bind_type u1 u2)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f frame_fv [u] == Some (frame_type u)) /\ //(forall (u:R.universe). RT.lookup_fvar_uinst f subsumption_fv [u] == Some (sub_stt_type u)) let stt_env = e:env { has_stt_bindings (fstar_env e) } let check_top_level_environment (f:RT.fstar_top_env) : option stt_env = admit(); Some (mk_env f) //we should implement this as a runtime check
false
true
Pulse.Soundness.Common.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": 4, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val elab_comp_post (c: comp_st) : R.term
[]
Pulse.Soundness.Common.elab_comp_post
{ "file_name": "lib/steel/pulse/Pulse.Soundness.Common.fst", "git_rev": "7fbb54e94dd4f48ff7cb867d3bae6889a635541e", "git_url": "https://github.com/FStarLang/steel.git", "project_name": "steel" }
c: Pulse.Syntax.Base.comp_st -> FStar.Reflection.Types.term
{ "end_col": 28, "end_line": 337, "start_col": 41, "start_line": 334 }
Prims.Tot
val state_chi (s_pi_rho: state) : Tot state
[ { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "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 state_chi (s_pi_rho:state) : Tot state = repeati 5 state_chi_inner s_pi_rho
val state_chi (s_pi_rho: state) : Tot state let state_chi (s_pi_rho: state) : Tot state =
false
null
false
repeati 5 state_chi_inner s_pi_rho
{ "checked_file": "Spec.SHA3.Equivalence.fst.checked", "dependencies": [ "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SHA3.Equivalence.fst" }
[ "total" ]
[ "Spec.SHA3.state", "Lib.LoopCombinators.repeati", "Spec.SHA3.Equivalence.state_chi_inner" ]
[]
module Spec.SHA3.Equivalence open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open FStar.Mul open Lib.LoopCombinators open Spec.SHA3.Constants open Spec.SHA3 #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let state_chi_inner (y:index) (s:state) : Tot state = let v0 = get s 0 y ^. ((lognot (get s 1 y)) &. get s 2 y) in let v1 = get s 1 y ^. ((lognot (get s 2 y)) &. get s 3 y) in let v2 = get s 2 y ^. ((lognot (get s 3 y)) &. get s 4 y) in let v3 = get s 3 y ^. ((lognot (get s 4 y)) &. get s 0 y) in let v4 = get s 4 y ^. ((lognot (get s 0 y)) &. get s 1 y) in let s = set s 0 y v0 in let s = set s 1 y v1 in let s = set s 2 y v2 in let s = set s 3 y v3 in let s = set s 4 y v4 in s
false
true
Spec.SHA3.Equivalence.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_chi (s_pi_rho: state) : Tot state
[]
Spec.SHA3.Equivalence.state_chi
{ "file_name": "specs/lemmas/Spec.SHA3.Equivalence.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s_pi_rho: Spec.SHA3.state -> Spec.SHA3.state
{ "end_col": 36, "end_line": 28, "start_col": 2, "start_line": 28 }
Prims.Tot
val state_chi_inner (y: index) (s: state) : Tot state
[ { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "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 state_chi_inner (y:index) (s:state) : Tot state = let v0 = get s 0 y ^. ((lognot (get s 1 y)) &. get s 2 y) in let v1 = get s 1 y ^. ((lognot (get s 2 y)) &. get s 3 y) in let v2 = get s 2 y ^. ((lognot (get s 3 y)) &. get s 4 y) in let v3 = get s 3 y ^. ((lognot (get s 4 y)) &. get s 0 y) in let v4 = get s 4 y ^. ((lognot (get s 0 y)) &. get s 1 y) in let s = set s 0 y v0 in let s = set s 1 y v1 in let s = set s 2 y v2 in let s = set s 3 y v3 in let s = set s 4 y v4 in s
val state_chi_inner (y: index) (s: state) : Tot state let state_chi_inner (y: index) (s: state) : Tot state =
false
null
false
let v0 = get s 0 y ^. ((lognot (get s 1 y)) &. get s 2 y) in let v1 = get s 1 y ^. ((lognot (get s 2 y)) &. get s 3 y) in let v2 = get s 2 y ^. ((lognot (get s 3 y)) &. get s 4 y) in let v3 = get s 3 y ^. ((lognot (get s 4 y)) &. get s 0 y) in let v4 = get s 4 y ^. ((lognot (get s 0 y)) &. get s 1 y) in let s = set s 0 y v0 in let s = set s 1 y v1 in let s = set s 2 y v2 in let s = set s 3 y v3 in let s = set s 4 y v4 in s
{ "checked_file": "Spec.SHA3.Equivalence.fst.checked", "dependencies": [ "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SHA3.Equivalence.fst" }
[ "total" ]
[ "Spec.SHA3.index", "Spec.SHA3.state", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Spec.SHA3.set", "Lib.IntTypes.op_Hat_Dot", "Spec.SHA3.get", "Lib.IntTypes.op_Amp_Dot", "Lib.IntTypes.lognot" ]
[]
module Spec.SHA3.Equivalence open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open FStar.Mul open Lib.LoopCombinators open Spec.SHA3.Constants open Spec.SHA3 #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0"
false
true
Spec.SHA3.Equivalence.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_chi_inner (y: index) (s: state) : Tot state
[]
Spec.SHA3.Equivalence.state_chi_inner
{ "file_name": "specs/lemmas/Spec.SHA3.Equivalence.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
y: Spec.SHA3.index -> s: Spec.SHA3.state -> Spec.SHA3.state
{ "end_col": 3, "end_line": 25, "start_col": 53, "start_line": 14 }
FStar.Pervasives.Lemma
val state_chi_equivalence (st_old: state) : Lemma (state_chi st_old == Spec.SHA3.state_chi st_old)
[ { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "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 state_chi_equivalence (st_old:state) : Lemma (state_chi st_old == Spec.SHA3.state_chi st_old) = Lib.LoopCombinators.eq_repeati0 5 (state_chi_inner1 st_old) st_old; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 0; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 1; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 2; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 3; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 4; Lib.LoopCombinators.eq_repeati0 5 (state_chi_inner) st_old; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 0; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 1; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 2; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 3; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 4; let st1 = state_chi_inner1 st_old 0 st_old in let st2 = state_chi_inner1 st_old 1 st1 in let st3 = state_chi_inner1 st_old 2 st2 in let st4 = state_chi_inner1 st_old 3 st3 in let st5 = state_chi_inner1 st_old 4 st4 in let st1' = state_chi_inner 0 st_old in let st2' = state_chi_inner 1 st1' in let st3' = state_chi_inner 2 st2' in let st4' = state_chi_inner 3 st3' in let st5' = state_chi_inner 4 st4' in state_chi_inner_equivalence0 st_old 0 st_old; assert(st1 == st1'); state_chi_inner_equivalence1 st_old 0 st1; state_chi_inner_equivalence0 st_old 1 st1; assert(st2 == st2'); state_chi_inner_equivalence1 st1' 1 st2'; state_chi_inner_equivalence0 st_old 2 st2; assert(st3 == st3'); state_chi_inner_equivalence1 st2 2 st3; state_chi_inner_equivalence0 st_old 3 st3; assert(st4 == st4'); state_chi_inner_equivalence1 st3 3 st4; state_chi_inner_equivalence0 st_old 4 st4; assert(st5 == st5'); state_chi_inner_equivalence1 st4 4 st5; ()
val state_chi_equivalence (st_old: state) : Lemma (state_chi st_old == Spec.SHA3.state_chi st_old) let state_chi_equivalence (st_old: state) : Lemma (state_chi st_old == Spec.SHA3.state_chi st_old) =
false
null
true
Lib.LoopCombinators.eq_repeati0 5 (state_chi_inner1 st_old) st_old; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 0; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 1; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 2; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 3; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner1 st_old) st_old 4; Lib.LoopCombinators.eq_repeati0 5 (state_chi_inner) st_old; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 0; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 1; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 2; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 3; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner) st_old 4; let st1 = state_chi_inner1 st_old 0 st_old in let st2 = state_chi_inner1 st_old 1 st1 in let st3 = state_chi_inner1 st_old 2 st2 in let st4 = state_chi_inner1 st_old 3 st3 in let st5 = state_chi_inner1 st_old 4 st4 in let st1' = state_chi_inner 0 st_old in let st2' = state_chi_inner 1 st1' in let st3' = state_chi_inner 2 st2' in let st4' = state_chi_inner 3 st3' in let st5' = state_chi_inner 4 st4' in state_chi_inner_equivalence0 st_old 0 st_old; assert (st1 == st1'); state_chi_inner_equivalence1 st_old 0 st1; state_chi_inner_equivalence0 st_old 1 st1; assert (st2 == st2'); state_chi_inner_equivalence1 st1' 1 st2'; state_chi_inner_equivalence0 st_old 2 st2; assert (st3 == st3'); state_chi_inner_equivalence1 st2 2 st3; state_chi_inner_equivalence0 st_old 3 st3; assert (st4 == st4'); state_chi_inner_equivalence1 st3 3 st4; state_chi_inner_equivalence0 st_old 4 st4; assert (st5 == st5'); state_chi_inner_equivalence1 st4 4 st5; ()
{ "checked_file": "Spec.SHA3.Equivalence.fst.checked", "dependencies": [ "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SHA3.Equivalence.fst" }
[ "lemma" ]
[ "Spec.SHA3.state", "Prims.unit", "Spec.SHA3.Equivalence.state_chi_inner_equivalence1", "Prims._assert", "Prims.eq2", "Spec.SHA3.Equivalence.state_chi_inner_equivalence0", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Spec.SHA3.Equivalence.state_chi_inner", "Spec.SHA3.state_chi_inner1", "Lib.LoopCombinators.unfold_repeati", "Lib.LoopCombinators.eq_repeati0", "Prims.l_True", "Prims.squash", "Spec.SHA3.Equivalence.state_chi", "Spec.SHA3.state_chi", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module Spec.SHA3.Equivalence open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open FStar.Mul open Lib.LoopCombinators open Spec.SHA3.Constants open Spec.SHA3 #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let state_chi_inner (y:index) (s:state) : Tot state = let v0 = get s 0 y ^. ((lognot (get s 1 y)) &. get s 2 y) in let v1 = get s 1 y ^. ((lognot (get s 2 y)) &. get s 3 y) in let v2 = get s 2 y ^. ((lognot (get s 3 y)) &. get s 4 y) in let v3 = get s 3 y ^. ((lognot (get s 4 y)) &. get s 0 y) in let v4 = get s 4 y ^. ((lognot (get s 0 y)) &. get s 1 y) in let s = set s 0 y v0 in let s = set s 1 y v1 in let s = set s 2 y v2 in let s = set s 3 y v3 in let s = set s 4 y v4 in s let state_chi (s_pi_rho:state) : Tot state = repeati 5 state_chi_inner s_pi_rho let state_chi_inner_equivalence0 (st_old:state) (y:index) (st:state) : Lemma (requires (forall y'. (y' >= y /\ y' < 5) ==> get st_old 0 y' == get st 0 y' /\ get st_old 1 y' == get st 1 y' /\ get st_old 2 y' == get st 2 y' /\ get st_old 3 y' == get st 3 y' /\ get st_old 4 y' == get st 4 y')) (ensures (let st_new = state_chi_inner1 st_old y st in st_new == state_chi_inner y st)) = Lib.LoopCombinators.eq_repeati0 5 (state_chi_inner0 st_old y) st; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 0; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 1; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 2; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 3; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 4; assert (repeati 5 (state_chi_inner0 st_old y) st == state_chi_inner0 st_old y 4 (state_chi_inner0 st_old y 3 (state_chi_inner0 st_old y 2 (state_chi_inner0 st_old y 1 (state_chi_inner0 st_old y 0 st))))); () let state_chi_inner_equivalence1 (st_old:state) (y:index) (st_new:state) : Lemma (requires (st_new == state_chi_inner y st_old)) (ensures ( (forall y'. (y' < 5 /\ y' > y) ==> (get st_new 0 y' == get st_old 0 y' /\ get st_new 1 y' == get st_old 1 y' /\ get st_new 2 y' == get st_old 2 y' /\ get st_new 3 y' == get st_old 3 y' /\ get st_new 4 y' == get st_old 4 y')))) = () #push-options "--z3rlimit 50" let state_chi_equivalence (st_old:state) :
false
false
Spec.SHA3.Equivalence.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_chi_equivalence (st_old: state) : Lemma (state_chi st_old == Spec.SHA3.state_chi st_old)
[]
Spec.SHA3.Equivalence.state_chi_equivalence
{ "file_name": "specs/lemmas/Spec.SHA3.Equivalence.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
st_old: Spec.SHA3.state -> FStar.Pervasives.Lemma (ensures Spec.SHA3.Equivalence.state_chi st_old == Spec.SHA3.state_chi st_old)
{ "end_col": 11, "end_line": 99, "start_col": 9, "start_line": 62 }
FStar.Pervasives.Lemma
val state_chi_inner_equivalence0 (st_old: state) (y: index) (st: state) : Lemma (requires (forall y'. (y' >= y /\ y' < 5) ==> get st_old 0 y' == get st 0 y' /\ get st_old 1 y' == get st 1 y' /\ get st_old 2 y' == get st 2 y' /\ get st_old 3 y' == get st 3 y' /\ get st_old 4 y' == get st 4 y')) (ensures (let st_new = state_chi_inner1 st_old y st in st_new == state_chi_inner y st))
[ { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.LoopCombinators", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "short_module": null }, { "abbrev": false, "full_module": "Spec.SHA3", "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 state_chi_inner_equivalence0 (st_old:state) (y:index) (st:state) : Lemma (requires (forall y'. (y' >= y /\ y' < 5) ==> get st_old 0 y' == get st 0 y' /\ get st_old 1 y' == get st 1 y' /\ get st_old 2 y' == get st 2 y' /\ get st_old 3 y' == get st 3 y' /\ get st_old 4 y' == get st 4 y')) (ensures (let st_new = state_chi_inner1 st_old y st in st_new == state_chi_inner y st)) = Lib.LoopCombinators.eq_repeati0 5 (state_chi_inner0 st_old y) st; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 0; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 1; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 2; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 3; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 4; assert (repeati 5 (state_chi_inner0 st_old y) st == state_chi_inner0 st_old y 4 (state_chi_inner0 st_old y 3 (state_chi_inner0 st_old y 2 (state_chi_inner0 st_old y 1 (state_chi_inner0 st_old y 0 st))))); ()
val state_chi_inner_equivalence0 (st_old: state) (y: index) (st: state) : Lemma (requires (forall y'. (y' >= y /\ y' < 5) ==> get st_old 0 y' == get st 0 y' /\ get st_old 1 y' == get st 1 y' /\ get st_old 2 y' == get st 2 y' /\ get st_old 3 y' == get st 3 y' /\ get st_old 4 y' == get st 4 y')) (ensures (let st_new = state_chi_inner1 st_old y st in st_new == state_chi_inner y st)) let state_chi_inner_equivalence0 (st_old: state) (y: index) (st: state) : Lemma (requires (forall y'. (y' >= y /\ y' < 5) ==> get st_old 0 y' == get st 0 y' /\ get st_old 1 y' == get st 1 y' /\ get st_old 2 y' == get st 2 y' /\ get st_old 3 y' == get st 3 y' /\ get st_old 4 y' == get st 4 y')) (ensures (let st_new = state_chi_inner1 st_old y st in st_new == state_chi_inner y st)) =
false
null
true
Lib.LoopCombinators.eq_repeati0 5 (state_chi_inner0 st_old y) st; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 0; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 1; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 2; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 3; Lib.LoopCombinators.unfold_repeati 5 (state_chi_inner0 st_old y) st 4; assert (repeati 5 (state_chi_inner0 st_old y) st == state_chi_inner0 st_old y 4 (state_chi_inner0 st_old y 3 (state_chi_inner0 st_old y 2 (state_chi_inner0 st_old y 1 (state_chi_inner0 st_old y 0 st))))); ()
{ "checked_file": "Spec.SHA3.Equivalence.fst.checked", "dependencies": [ "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.SHA3.Equivalence.fst" }
[ "lemma" ]
[ "Spec.SHA3.state", "Spec.SHA3.index", "Prims.unit", "Prims._assert", "Prims.eq2", "Lib.LoopCombinators.repeati", "Spec.SHA3.state_chi_inner0", "Lib.LoopCombinators.unfold_repeati", "Lib.LoopCombinators.eq_repeati0", "Prims.l_Forall", "Prims.int", "Prims.l_and", "Prims.b2t", "Prims.op_GreaterThanOrEqual", "Prims.op_LessThanOrEqual", "Lib.IntTypes.max_size_t", "Prims.op_LessThan", "Prims.l_imp", "Lib.IntTypes.uint64", "Spec.SHA3.get", "Prims.squash", "Spec.SHA3.Equivalence.state_chi_inner", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Spec.SHA3.state_chi_inner1", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module Spec.SHA3.Equivalence open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open FStar.Mul open Lib.LoopCombinators open Spec.SHA3.Constants open Spec.SHA3 #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" let state_chi_inner (y:index) (s:state) : Tot state = let v0 = get s 0 y ^. ((lognot (get s 1 y)) &. get s 2 y) in let v1 = get s 1 y ^. ((lognot (get s 2 y)) &. get s 3 y) in let v2 = get s 2 y ^. ((lognot (get s 3 y)) &. get s 4 y) in let v3 = get s 3 y ^. ((lognot (get s 4 y)) &. get s 0 y) in let v4 = get s 4 y ^. ((lognot (get s 0 y)) &. get s 1 y) in let s = set s 0 y v0 in let s = set s 1 y v1 in let s = set s 2 y v2 in let s = set s 3 y v3 in let s = set s 4 y v4 in s let state_chi (s_pi_rho:state) : Tot state = repeati 5 state_chi_inner s_pi_rho let state_chi_inner_equivalence0 (st_old:state) (y:index) (st:state) : Lemma (requires (forall y'. (y' >= y /\ y' < 5) ==> get st_old 0 y' == get st 0 y' /\ get st_old 1 y' == get st 1 y' /\ get st_old 2 y' == get st 2 y' /\ get st_old 3 y' == get st 3 y' /\ get st_old 4 y' == get st 4 y')) (ensures (let st_new = state_chi_inner1 st_old y st in
false
false
Spec.SHA3.Equivalence.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_chi_inner_equivalence0 (st_old: state) (y: index) (st: state) : Lemma (requires (forall y'. (y' >= y /\ y' < 5) ==> get st_old 0 y' == get st 0 y' /\ get st_old 1 y' == get st 1 y' /\ get st_old 2 y' == get st 2 y' /\ get st_old 3 y' == get st 3 y' /\ get st_old 4 y' == get st 4 y')) (ensures (let st_new = state_chi_inner1 st_old y st in st_new == state_chi_inner y st))
[]
Spec.SHA3.Equivalence.state_chi_inner_equivalence0
{ "file_name": "specs/lemmas/Spec.SHA3.Equivalence.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
st_old: Spec.SHA3.state -> y: Spec.SHA3.index -> st: Spec.SHA3.state -> FStar.Pervasives.Lemma (requires forall (y': i: Prims.int { i >= 0 /\ i <= Lib.IntTypes.max_size_t /\ i < 5 /\ (i >= 0) /\ (i <= Lib.IntTypes.max_size_t) /\ (i < 5) /\ (i >= 0) /\ (i <= Lib.IntTypes.max_size_t) /\ (i < 5) /\ (i >= 0) /\ (i <= Lib.IntTypes.max_size_t) /\ (i < 5) /\ (i >= 0) /\ (i <= Lib.IntTypes.max_size_t) /\ (i < 5) /\ (i >= 0) /\ (i <= Lib.IntTypes.max_size_t) /\ (i < 5) /\ (i >= 0) /\ (i <= Lib.IntTypes.max_size_t) /\ (i < 5) /\ (i >= 0) /\ (i <= Lib.IntTypes.max_size_t) /\ (i < 5) /\ (i >= 0) /\ (i <= Lib.IntTypes.max_size_t) /\ (i < 5) /\ (i >= 0) /\ (i <= Lib.IntTypes.max_size_t) /\ (i < 5) }). y' >= y /\ y' < 5 ==> Spec.SHA3.get st_old 0 y' == Spec.SHA3.get st 0 y' /\ Spec.SHA3.get st_old 1 y' == Spec.SHA3.get st 1 y' /\ Spec.SHA3.get st_old 2 y' == Spec.SHA3.get st 2 y' /\ Spec.SHA3.get st_old 3 y' == Spec.SHA3.get st 3 y' /\ Spec.SHA3.get st_old 4 y' == Spec.SHA3.get st 4 y') (ensures (let st_new = Spec.SHA3.state_chi_inner1 st_old y st in st_new == Spec.SHA3.Equivalence.state_chi_inner y st))
{ "end_col": 11, "end_line": 48, "start_col": 9, "start_line": 39 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 = n:size_t{v n < 5}
let index =
false
null
false
n: size_t{v n < 5}
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[ "total" ]
[ "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul
false
true
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val index : Type0
[]
Hacl.Impl.SHA3.index
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 29, "end_line": 40, "start_col": 12, "start_line": 40 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state = lbuffer uint64 25ul
let state =
false
null
false
lbuffer uint64 25ul
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[ "total" ]
[ "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'"
false
true
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state : Type0
[]
Hacl.Impl.SHA3.state
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Type0
{ "end_col": 31, "end_line": 37, "start_col": 12, "start_line": 37 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b
let rotl (a: uint64) (b: size_t{0 < uint_v b /\ uint_v b < 64}) =
false
null
false
rotate_left a b
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[ "total" ]
[ "Lib.IntTypes.uint64", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.uint_v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.IntTypes.rotate_left", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.IntTypes.int_t" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val rotl : a: Lib.IntTypes.uint64 -> b: Lib.IntTypes.size_t{0 < Lib.IntTypes.uint_v b /\ Lib.IntTypes.uint_v b < 64} -> Lib.IntTypes.int_t Lib.IntTypes.U64 Lib.IntTypes.SEC
[]
Hacl.Impl.SHA3.rotl
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Lib.IntTypes.uint64 -> b: Lib.IntTypes.size_t{0 < Lib.IntTypes.uint_v b /\ Lib.IntTypes.uint_v b < 64} -> Lib.IntTypes.int_t Lib.IntTypes.U64 Lib.IntTypes.SEC
{ "end_col": 17, "end_line": 69, "start_col": 2, "start_line": 69 }
FStar.Pervasives.Lemma
val mult_plus_lt (i a b: nat) : Lemma (requires i < a) (ensures i * b + b <= a * b)
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 mult_plus_lt (i a b:nat) : Lemma (requires i < a) (ensures i * b + b <= a * b) = assert (i <= a - 1)
val mult_plus_lt (i a b: nat) : Lemma (requires i < a) (ensures i * b + b <= a * b) let mult_plus_lt (i a b: nat) : Lemma (requires i < a) (ensures i * b + b <= a * b) =
false
null
true
assert (i <= a - 1)
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[ "lemma" ]
[ "Prims.nat", "Prims._assert", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.unit", "Prims.op_LessThan", "Prims.squash", "Prims.op_Addition", "FStar.Mul.op_Star", "Prims.Nil", "FStar.Pervasives.pattern" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj) private val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s)) let storeState rateInBytes s res = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in [@ inline_let] let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block ); copy res (sub block 0ul rateInBytes); pop_frame() #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes)) let absorb_next s rateInBytes = push_frame(); let h0 = ST.get() in let nextBlock_ = create 200ul (u8 0) in let nextBlock = sub nextBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 nextBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); nextBlock.(rateInBytes -! 1ul) <- u8 0x80; loadState rateInBytes nextBlock s; state_permute s; pop_frame() inline_for_extraction noextract val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s)) let absorb_last delimitedSuffix rateInBytes rem input s = push_frame(); let h0 = ST.get() in let lastBlock_ = create 200ul (u8 0) in let lastBlock = sub lastBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 lastBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); let open Lib.RawIntTypes in update_sub lastBlock (size 0) rem input; lastBlock.(rem) <- byte_to_uint8 delimitedSuffix; loadState rateInBytes lastBlock s; if not ((delimitedSuffix &. byte 0x80) =. byte 0) && (size_to_UInt32 rem = size_to_UInt32 (rateInBytes -. 1ul)) then state_permute s; absorb_next s rateInBytes; pop_frame() val absorb_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> block:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_inner (v rateInBytes) (as_seq h0 block) (as_seq h0 s)) let absorb_inner rateInBytes block s = loadState rateInBytes block s; state_permute s #reset-options "--z3rlimit 100 --max_fuel 0 --max_ifuel 0" private val absorb: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> Stack unit (requires fun h0 -> live h0 s /\ live h0 input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb (as_seq h0 s) (v rateInBytes) (v inputByteLen) (as_seq h0 input) delimitedSuffix) let absorb s rateInBytes inputByteLen input delimitedSuffix = let n_blocks = inputByteLen /. rateInBytes in let rem = inputByteLen %. rateInBytes in loop_blocks rateInBytes n_blocks rem input (S.absorb_inner (v rateInBytes)) (S.absorb_last delimitedSuffix (v rateInBytes)) (absorb_inner rateInBytes) (absorb_last delimitedSuffix rateInBytes) s inline_for_extraction noextract val squeeze_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> s:state -> output:lbuffer uint8 rateInBytes -> i:size_t{v i < v (outputByteLen /. rateInBytes)} -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ (as_seq h1 s, as_seq h1 output) == S.squeeze_inner (v rateInBytes) (v outputByteLen) (v i) (as_seq h0 s)) let squeeze_inner rateInBytes outputByteLen s output i = storeState rateInBytes s output; state_permute s private
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val mult_plus_lt (i a b: nat) : Lemma (requires i < a) (ensures i * b + b <= a * b)
[]
Hacl.Impl.SHA3.mult_plus_lt
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
i: Prims.nat -> a: Prims.nat -> b: Prims.nat -> FStar.Pervasives.Lemma (requires i < a) (ensures i * b + b <= a * b)
{ "end_col": 21, "end_line": 479, "start_col": 2, "start_line": 479 }
FStar.HyperStack.ST.Stack
val absorb_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> block:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_inner (v rateInBytes) (as_seq h0 block) (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 absorb_inner rateInBytes block s = loadState rateInBytes block s; state_permute s
val absorb_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> block:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_inner (v rateInBytes) (as_seq h0 block) (as_seq h0 s)) let absorb_inner rateInBytes block s =
true
null
false
loadState rateInBytes block s; state_permute s
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.op_LessThanOrEqual", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Impl.SHA3.state", "Hacl.Impl.SHA3.state_permute", "Prims.unit", "Hacl.Impl.SHA3.loadState" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj) private val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s)) let storeState rateInBytes s res = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in [@ inline_let] let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block ); copy res (sub block 0ul rateInBytes); pop_frame() #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes)) let absorb_next s rateInBytes = push_frame(); let h0 = ST.get() in let nextBlock_ = create 200ul (u8 0) in let nextBlock = sub nextBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 nextBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); nextBlock.(rateInBytes -! 1ul) <- u8 0x80; loadState rateInBytes nextBlock s; state_permute s; pop_frame() inline_for_extraction noextract val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s)) let absorb_last delimitedSuffix rateInBytes rem input s = push_frame(); let h0 = ST.get() in let lastBlock_ = create 200ul (u8 0) in let lastBlock = sub lastBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 lastBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); let open Lib.RawIntTypes in update_sub lastBlock (size 0) rem input; lastBlock.(rem) <- byte_to_uint8 delimitedSuffix; loadState rateInBytes lastBlock s; if not ((delimitedSuffix &. byte 0x80) =. byte 0) && (size_to_UInt32 rem = size_to_UInt32 (rateInBytes -. 1ul)) then state_permute s; absorb_next s rateInBytes; pop_frame() val absorb_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> block:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_inner (v rateInBytes) (as_seq h0 block) (as_seq h0 s))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val absorb_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> block:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_inner (v rateInBytes) (as_seq h0 block) (as_seq h0 s))
[]
Hacl.Impl.SHA3.absorb_inner
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
rateInBytes: Lib.IntTypes.size_t{0 < Lib.IntTypes.v rateInBytes /\ Lib.IntTypes.v rateInBytes <= 200} -> block: Lib.Buffer.lbuffer Lib.IntTypes.uint8 rateInBytes -> s: Hacl.Impl.SHA3.state -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 17, "end_line": 433, "start_col": 2, "start_line": 432 }
FStar.HyperStack.ST.Stack
val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c)
val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round =
true
null
false
recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c)
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.SHA3.set", "FStar.UInt32.__uint_to_t", "Prims.unit", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Hat_Dot", "Lib.IntTypes.secret", "Hacl.Impl.SHA3.get", "Lib.IntTypes.uint64", "Lib.Buffer.op_Array_Access", "Lib.Buffer.CONST", "FStar.UInt32.uint_to_t", "Hacl.Impl.SHA3.keccak_rndc", "Lib.Buffer.recall_contents", "Spec.SHA3.Constants.keccak_rndc" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round))
[]
Hacl.Impl.SHA3.state_iota
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> round: Lib.IntTypes.size_t{Lib.IntTypes.v round < 24} -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 43, "end_line": 278, "start_col": 2, "start_line": 276 }
FStar.HyperStack.ST.Stack
val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let get s x y = s.(x +! 5ul *! y)
val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y =
true
null
false
s.(x +! 5ul *! y)
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Hacl.Impl.SHA3.index", "Lib.Buffer.op_Array_Access", "Lib.Buffer.MUT", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.IntTypes.op_Star_Bang" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y))
[]
Hacl.Impl.SHA3.get
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> x: Hacl.Impl.SHA3.index -> y: Hacl.Impl.SHA3.index -> FStar.HyperStack.ST.Stack Lib.IntTypes.uint64
{ "end_col": 33, "end_line": 52, "start_col": 16, "start_line": 52 }
FStar.HyperStack.ST.Stack
val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v)
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let set s x y v = s.(x +! 5ul *! y) <- v
val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v =
true
null
false
s.(x +! 5ul *! y) <- v
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Hacl.Impl.SHA3.index", "Lib.IntTypes.uint64", "Lib.Buffer.op_Array_Assignment", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.IntTypes.op_Star_Bang", "Prims.unit" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v)
[]
Hacl.Impl.SHA3.set
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> x: Hacl.Impl.SHA3.index -> y: Hacl.Impl.SHA3.index -> v: Lib.IntTypes.uint64 -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 40, "end_line": 65, "start_col": 18, "start_line": 65 }
FStar.HyperStack.ST.Stack
val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s )
val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C =
true
null
false
[@@ inline_let ]let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s)
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Lib.Buffer.loop1", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.SHA3.state_theta_inner_s", "Prims.unit", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Prims.nat", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Spec.SHA3.state_theta_inner_s" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C))
[]
Hacl.Impl.SHA3.state_theta1
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> _C: Lib.Buffer.lbuffer Lib.IntTypes.uint64 5ul -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 3, "end_line": 133, "start_col": 2, "start_line": 126 }
FStar.HyperStack.ST.Stack
val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st)
val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st =
true
null
false
let h0 = ST.get () in [@@ inline_let ]let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y); let h1 = ST.get () in assert (as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st)
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Spec.SHA3.Equivalence.state_chi_equivalence", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Prims.unit", "Prims._assert", "Prims.eq2", "Lib.Sequence.lseq", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Spec.SHA3.Equivalence.state_chi", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Lib.Buffer.loop1", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Hacl.Impl.SHA3.state_chi_inner", "Lib.LoopCombinators.unfold_repeati", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Prims.nat", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Spec.SHA3.Equivalence.state_chi_inner" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s))
[]
Hacl.Impl.SHA3.state_chi
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 44, "end_line": 264, "start_col": 18, "start_line": 252 }
FStar.HyperStack.ST.Stack
val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj)
val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block =
true
null
false
let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj)
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Lib.Buffer.update_sub_f", "Lib.IntTypes.op_Star_Bang", "FStar.Monotonic.HyperStack.mem", "Lib.ByteSequence.uint_to_bytes_le", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.Sequence.lseq", "Prims.unit", "Lib.ByteBuffer.uint_to_bytes_le", "Lib.Buffer.lbuffer_t", "Lib.Buffer.MUT", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.mk_int", "Lib.Buffer.sub", "FStar.HyperStack.ST.get", "Lib.Buffer.op_Array_Access", "Lib.IntTypes.uint64" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block))
[]
Hacl.Impl.SHA3.storeState_inner
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> j: Lib.IntTypes.size_t{Lib.IntTypes.v j < 25} -> block: Lib.Buffer.lbuffer Lib.IntTypes.uint8 200ul -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 66, "end_line": 340, "start_col": 32, "start_line": 335 }
Prims.Tot
val keccak_rotc:x: glbuffer rotc_t 24ul {witnessed x keccak_rotc /\ recallable x}
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list
val keccak_rotc:x: glbuffer rotc_t 24ul {witnessed x keccak_rotc /\ recallable x} let keccak_rotc:x: glbuffer rotc_t 24ul {witnessed x keccak_rotc /\ recallable x} =
false
null
false
createL_global rotc_list
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[ "total" ]
[ "Lib.Buffer.createL_global", "Spec.SHA3.Constants.rotc_t", "Spec.SHA3.Constants.rotc_list", "Lib.Buffer.glbuffer", "Lib.IntTypes.size", "FStar.Pervasives.normalize_term", "Lib.IntTypes.size_nat", "FStar.List.Tot.Base.length" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val keccak_rotc:x: glbuffer rotc_t 24ul {witnessed x keccak_rotc /\ recallable x}
[]
Hacl.Impl.SHA3.keccak_rotc
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
x: (c: Lib.Buffer.lbuffer_t Lib.Buffer.CONST Spec.SHA3.Constants.rotc_t (FStar.UInt32.uint_to_t 24 <: FStar.UInt32.t) {LowStar.ConstBuffer.qual_of c == LowStar.ConstBuffer.IMMUTABLE}) {Lib.Buffer.witnessed x Spec.SHA3.Constants.keccak_rotc /\ Lib.Buffer.recallable x}
{ "end_col": 28, "end_line": 26, "start_col": 4, "start_line": 26 }
FStar.HyperStack.ST.Stack
val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame()
val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s =
true
null
false
push_frame (); let h0 = ST.get () in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame ()
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Impl.SHA3.state_theta1", "Hacl.Impl.SHA3.state_theta0", "Lib.Buffer.lbuffer_t", "Lib.Buffer.MUT", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Lib.Buffer.create", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.u64", "Lib.Buffer.lbuffer", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "FStar.HyperStack.ST.push_frame" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s))
[]
Hacl.Impl.SHA3.state_theta
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 13, "end_line": 148, "start_col": 2, "start_line": 144 }
Prims.Tot
val keccak_piln:x: glbuffer piln_t 24ul {witnessed x keccak_piln /\ recallable x}
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list
val keccak_piln:x: glbuffer piln_t 24ul {witnessed x keccak_piln /\ recallable x} let keccak_piln:x: glbuffer piln_t 24ul {witnessed x keccak_piln /\ recallable x} =
false
null
false
createL_global piln_list
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[ "total" ]
[ "Lib.Buffer.createL_global", "Spec.SHA3.Constants.piln_t", "Spec.SHA3.Constants.piln_list", "Lib.Buffer.glbuffer", "Lib.IntTypes.size", "FStar.Pervasives.normalize_term", "Lib.IntTypes.size_nat", "FStar.List.Tot.Base.length" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val keccak_piln:x: glbuffer piln_t 24ul {witnessed x keccak_piln /\ recallable x}
[]
Hacl.Impl.SHA3.keccak_piln
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
x: (c: Lib.Buffer.lbuffer_t Lib.Buffer.CONST Spec.SHA3.Constants.piln_t (FStar.UInt32.uint_to_t 24 <: FStar.UInt32.t) {LowStar.ConstBuffer.qual_of c == LowStar.ConstBuffer.IMMUTABLE}) {Lib.Buffer.witnessed x Spec.SHA3.Constants.keccak_piln /\ Lib.Buffer.recallable x}
{ "end_col": 28, "end_line": 29, "start_col": 4, "start_line": 29 }
FStar.Pervasives.Lemma
val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1)
val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i =
false
null
true
if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1)
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[ "lemma" ]
[ "Prims.list", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "FStar.List.Tot.Base.length", "Prims.op_Equality", "Prims.int", "Prims.bool", "Hacl.Impl.SHA3.index_map", "Prims.op_Subtraction", "Prims.unit" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i))
[ "recursion" ]
Hacl.Impl.SHA3.index_map
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
f: (_: a -> b) -> l: Prims.list a -> i: Prims.nat{i < FStar.List.Tot.Base.length l} -> FStar.Pervasives.Lemma (ensures FStar.List.Tot.Base.index (FStar.List.Tot.Base.map f l) i == f (FStar.List.Tot.Base.index l i) )
{ "end_col": 39, "end_line": 161, "start_col": 2, "start_line": 157 }
FStar.HyperStack.ST.Stack
val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round)
val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s =
true
null
false
[@@ inline_let ]let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round)
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Lib.Buffer.loop1", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.SHA3.state_iota", "Prims.unit", "Hacl.Impl.SHA3.state_chi", "Hacl.Impl.SHA3.state_pi_rho", "Hacl.Impl.SHA3.state_theta", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Prims.nat", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Spec.SHA3.state_permute1" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s))
[]
Hacl.Impl.SHA3.state_permute
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 23, "end_line": 297, "start_col": 2, "start_line": 288 }
Prims.Tot
val keccak_rndc:x: glbuffer pub_uint64 24ul {witnessed x keccak_rndc /\ recallable x}
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list
val keccak_rndc:x: glbuffer pub_uint64 24ul {witnessed x keccak_rndc /\ recallable x} let keccak_rndc:x: glbuffer pub_uint64 24ul {witnessed x keccak_rndc /\ recallable x} =
false
null
false
createL_global rndc_list
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[ "total" ]
[ "Lib.Buffer.createL_global", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.PUB", "Spec.SHA3.Constants.rndc_list", "Lib.Buffer.glbuffer", "Lib.IntTypes.size", "FStar.Pervasives.normalize_term", "Lib.IntTypes.size_nat", "FStar.List.Tot.Base.length" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 8, "max_ifuel": 2, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val keccak_rndc:x: glbuffer pub_uint64 24ul {witnessed x keccak_rndc /\ recallable x}
[]
Hacl.Impl.SHA3.keccak_rndc
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
x: (c: Lib.Buffer.lbuffer_t Lib.Buffer.CONST (Lib.IntTypes.int_t Lib.IntTypes.U64 Lib.IntTypes.PUB) (FStar.UInt32.uint_to_t 24 <: FStar.UInt32.t) {LowStar.ConstBuffer.qual_of c == LowStar.ConstBuffer.IMMUTABLE}) {Lib.Buffer.witnessed x Spec.SHA3.Constants.keccak_rndc /\ Lib.Buffer.recallable x}
{ "end_col": 28, "end_line": 32, "start_col": 4, "start_line": 32 }
FStar.HyperStack.ST.Stack
val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) )
val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s =
true
null
false
let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@@ inline_let ]let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D))
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Hacl.Impl.SHA3.index", "Hacl.Impl.SHA3.state", "Lib.Buffer.loop1", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.SHA3.set", "Prims.unit", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Hat_Dot", "Hacl.Impl.SHA3.get", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lseq", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Prims.nat", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Spec.SHA3.state_theta_inner_s_inner", "Hacl.Impl.SHA3.rotl", "Lib.Buffer.op_Array_Access", "Lib.IntTypes.op_Percent_Dot", "Lib.IntTypes.op_Plus_Dot" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s))
[]
Hacl.Impl.SHA3.state_theta_inner_s
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
_C: Lib.Buffer.lbuffer Lib.IntTypes.uint64 5ul -> x: Hacl.Impl.SHA3.index -> s: Hacl.Impl.SHA3.state -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 3, "end_line": 114, "start_col": 32, "start_line": 105 }
FStar.HyperStack.ST.Stack
val squeeze_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> s:state -> output:lbuffer uint8 rateInBytes -> i:size_t{v i < v (outputByteLen /. rateInBytes)} -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ (as_seq h1 s, as_seq h1 output) == S.squeeze_inner (v rateInBytes) (v outputByteLen) (v i) (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 squeeze_inner rateInBytes outputByteLen s output i = storeState rateInBytes s output; state_permute s
val squeeze_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> s:state -> output:lbuffer uint8 rateInBytes -> i:size_t{v i < v (outputByteLen /. rateInBytes)} -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ (as_seq h1 s, as_seq h1 output) == S.squeeze_inner (v rateInBytes) (v outputByteLen) (v i) (as_seq h0 s)) let squeeze_inner rateInBytes outputByteLen s output i =
true
null
false
storeState rateInBytes s output; state_permute s
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.op_LessThanOrEqual", "Hacl.Impl.SHA3.state", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Lib.IntTypes.op_Slash_Dot", "Hacl.Impl.SHA3.state_permute", "Prims.unit", "Hacl.Impl.SHA3.storeState" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj) private val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s)) let storeState rateInBytes s res = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in [@ inline_let] let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block ); copy res (sub block 0ul rateInBytes); pop_frame() #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes)) let absorb_next s rateInBytes = push_frame(); let h0 = ST.get() in let nextBlock_ = create 200ul (u8 0) in let nextBlock = sub nextBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 nextBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); nextBlock.(rateInBytes -! 1ul) <- u8 0x80; loadState rateInBytes nextBlock s; state_permute s; pop_frame() inline_for_extraction noextract val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s)) let absorb_last delimitedSuffix rateInBytes rem input s = push_frame(); let h0 = ST.get() in let lastBlock_ = create 200ul (u8 0) in let lastBlock = sub lastBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 lastBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); let open Lib.RawIntTypes in update_sub lastBlock (size 0) rem input; lastBlock.(rem) <- byte_to_uint8 delimitedSuffix; loadState rateInBytes lastBlock s; if not ((delimitedSuffix &. byte 0x80) =. byte 0) && (size_to_UInt32 rem = size_to_UInt32 (rateInBytes -. 1ul)) then state_permute s; absorb_next s rateInBytes; pop_frame() val absorb_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> block:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_inner (v rateInBytes) (as_seq h0 block) (as_seq h0 s)) let absorb_inner rateInBytes block s = loadState rateInBytes block s; state_permute s #reset-options "--z3rlimit 100 --max_fuel 0 --max_ifuel 0" private val absorb: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> Stack unit (requires fun h0 -> live h0 s /\ live h0 input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb (as_seq h0 s) (v rateInBytes) (v inputByteLen) (as_seq h0 input) delimitedSuffix) let absorb s rateInBytes inputByteLen input delimitedSuffix = let n_blocks = inputByteLen /. rateInBytes in let rem = inputByteLen %. rateInBytes in loop_blocks rateInBytes n_blocks rem input (S.absorb_inner (v rateInBytes)) (S.absorb_last delimitedSuffix (v rateInBytes)) (absorb_inner rateInBytes) (absorb_last delimitedSuffix rateInBytes) s inline_for_extraction noextract val squeeze_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> s:state -> output:lbuffer uint8 rateInBytes -> i:size_t{v i < v (outputByteLen /. rateInBytes)} -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ (as_seq h1 s, as_seq h1 output) == S.squeeze_inner (v rateInBytes) (v outputByteLen) (v i) (as_seq h0 s))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val squeeze_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> s:state -> output:lbuffer uint8 rateInBytes -> i:size_t{v i < v (outputByteLen /. rateInBytes)} -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ (as_seq h1 s, as_seq h1 output) == S.squeeze_inner (v rateInBytes) (v outputByteLen) (v i) (as_seq h0 s))
[]
Hacl.Impl.SHA3.squeeze_inner
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
rateInBytes: Lib.IntTypes.size_t{0 < Lib.IntTypes.v rateInBytes /\ Lib.IntTypes.v rateInBytes <= 200} -> outputByteLen: Lib.IntTypes.size_t -> s: Hacl.Impl.SHA3.state -> output: Lib.Buffer.lbuffer Lib.IntTypes.uint8 rateInBytes -> i: Lib.IntTypes.size_t{Lib.IntTypes.v i < Lib.IntTypes.v (outputByteLen /. rateInBytes)} -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 17, "end_line": 474, "start_col": 2, "start_line": 473 }
FStar.HyperStack.ST.Stack
val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul )
val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C =
true
null
false
[@@ inline_let ]let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul)
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Lib.Buffer.loop1", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.op_Array_Assignment", "Prims.unit", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Hat_Dot", "Hacl.Impl.SHA3.get", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lseq", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Prims.nat", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Spec.SHA3.state_theta_inner_C" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C))
[]
Hacl.Impl.SHA3.state_theta0
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> _C: Lib.Buffer.lbuffer Lib.IntTypes.uint64 5ul -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 3, "end_line": 93, "start_col": 2, "start_line": 81 }
FStar.HyperStack.ST.Stack
val keccak: rate:size_t{v rate % 8 == 0 /\ v rate / 8 > 0 /\ v rate <= 1600} -> capacity:size_t{v capacity + v rate == 1600} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> outputByteLen:size_t -> output:lbuffer uint8 outputByteLen -> Stack unit (requires fun h -> live h input /\ live h output /\ disjoint input output) (ensures fun h0 _ h1 -> modifies1 output h0 h1 /\ as_seq h1 output == S.keccak (v rate) (v capacity) (v inputByteLen) (as_seq h0 input) delimitedSuffix (v outputByteLen))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 keccak rate capacity inputByteLen input delimitedSuffix outputByteLen output = push_frame(); let rateInBytes = rate /. size 8 in let s:state = create 25ul (u64 0) in absorb s rateInBytes inputByteLen input delimitedSuffix; squeeze s rateInBytes outputByteLen output; pop_frame()
val keccak: rate:size_t{v rate % 8 == 0 /\ v rate / 8 > 0 /\ v rate <= 1600} -> capacity:size_t{v capacity + v rate == 1600} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> outputByteLen:size_t -> output:lbuffer uint8 outputByteLen -> Stack unit (requires fun h -> live h input /\ live h output /\ disjoint input output) (ensures fun h0 _ h1 -> modifies1 output h0 h1 /\ as_seq h1 output == S.keccak (v rate) (v capacity) (v inputByteLen) (as_seq h0 input) delimitedSuffix (v outputByteLen)) let keccak rate capacity inputByteLen input delimitedSuffix outputByteLen output =
true
null
false
push_frame (); let rateInBytes = rate /. size 8 in let s:state = create 25ul (u64 0) in absorb s rateInBytes inputByteLen input delimitedSuffix; squeeze s rateInBytes outputByteLen output; pop_frame ()
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Lib.IntTypes.size_t", "Prims.l_and", "Prims.eq2", "Prims.int", "Prims.op_Modulus", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.b2t", "Prims.op_GreaterThan", "Prims.op_Division", "Prims.op_LessThanOrEqual", "Prims.op_Addition", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Lib.IntTypes.byte_t", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Impl.SHA3.squeeze", "Hacl.Impl.SHA3.absorb", "Hacl.Impl.SHA3.state", "Lib.Buffer.create", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.u64", "Lib.IntTypes.int_t", "Lib.IntTypes.op_Slash_Dot", "Lib.IntTypes.size", "FStar.HyperStack.ST.push_frame" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj) private val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s)) let storeState rateInBytes s res = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in [@ inline_let] let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block ); copy res (sub block 0ul rateInBytes); pop_frame() #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes)) let absorb_next s rateInBytes = push_frame(); let h0 = ST.get() in let nextBlock_ = create 200ul (u8 0) in let nextBlock = sub nextBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 nextBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); nextBlock.(rateInBytes -! 1ul) <- u8 0x80; loadState rateInBytes nextBlock s; state_permute s; pop_frame() inline_for_extraction noextract val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s)) let absorb_last delimitedSuffix rateInBytes rem input s = push_frame(); let h0 = ST.get() in let lastBlock_ = create 200ul (u8 0) in let lastBlock = sub lastBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 lastBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); let open Lib.RawIntTypes in update_sub lastBlock (size 0) rem input; lastBlock.(rem) <- byte_to_uint8 delimitedSuffix; loadState rateInBytes lastBlock s; if not ((delimitedSuffix &. byte 0x80) =. byte 0) && (size_to_UInt32 rem = size_to_UInt32 (rateInBytes -. 1ul)) then state_permute s; absorb_next s rateInBytes; pop_frame() val absorb_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> block:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_inner (v rateInBytes) (as_seq h0 block) (as_seq h0 s)) let absorb_inner rateInBytes block s = loadState rateInBytes block s; state_permute s #reset-options "--z3rlimit 100 --max_fuel 0 --max_ifuel 0" private val absorb: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> Stack unit (requires fun h0 -> live h0 s /\ live h0 input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb (as_seq h0 s) (v rateInBytes) (v inputByteLen) (as_seq h0 input) delimitedSuffix) let absorb s rateInBytes inputByteLen input delimitedSuffix = let n_blocks = inputByteLen /. rateInBytes in let rem = inputByteLen %. rateInBytes in loop_blocks rateInBytes n_blocks rem input (S.absorb_inner (v rateInBytes)) (S.absorb_last delimitedSuffix (v rateInBytes)) (absorb_inner rateInBytes) (absorb_last delimitedSuffix rateInBytes) s inline_for_extraction noextract val squeeze_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> s:state -> output:lbuffer uint8 rateInBytes -> i:size_t{v i < v (outputByteLen /. rateInBytes)} -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ (as_seq h1 s, as_seq h1 output) == S.squeeze_inner (v rateInBytes) (v outputByteLen) (v i) (as_seq h0 s)) let squeeze_inner rateInBytes outputByteLen s output i = storeState rateInBytes s output; state_permute s private let mult_plus_lt (i a b:nat) : Lemma (requires i < a) (ensures i * b + b <= a * b) = assert (i <= a - 1) val squeeze: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> output:lbuffer uint8 outputByteLen -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ as_seq h1 output == S.squeeze (as_seq h0 s) (v rateInBytes) (v outputByteLen)) let squeeze s rateInBytes outputByteLen output = let outBlocks = outputByteLen /. rateInBytes in let remOut = outputByteLen %. rateInBytes in assert_spinoff (v outputByteLen - v remOut == v outBlocks * v rateInBytes); let last = sub output (outputByteLen -. remOut) remOut in [@ inline_let] let a_spec (i:nat{i <= v outputByteLen / v rateInBytes}) = S.state in let blocks = sub output (size 0) (outBlocks *! rateInBytes) in let h0 = ST.get() in fill_blocks h0 rateInBytes outBlocks blocks a_spec (fun h i -> as_seq h s) (fun _ -> loc s) (fun h0 -> S.squeeze_inner (v rateInBytes) (v outputByteLen)) (fun i -> mult_plus_lt (v i) (v outBlocks) (v rateInBytes); squeeze_inner rateInBytes outputByteLen s (sub blocks (i *! rateInBytes) rateInBytes) i); storeState remOut s last; let h1 = ST.get() in Seq.lemma_split (as_seq h1 output) (v outBlocks * v rateInBytes); norm_spec [delta_only [`%S.squeeze]] (S.squeeze (as_seq h0 s) (v rateInBytes) (v outputByteLen)) val keccak: rate:size_t{v rate % 8 == 0 /\ v rate / 8 > 0 /\ v rate <= 1600} -> capacity:size_t{v capacity + v rate == 1600} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> outputByteLen:size_t -> output:lbuffer uint8 outputByteLen -> Stack unit (requires fun h -> live h input /\ live h output /\ disjoint input output) (ensures fun h0 _ h1 -> modifies1 output h0 h1 /\ as_seq h1 output == S.keccak (v rate) (v capacity) (v inputByteLen) (as_seq h0 input) delimitedSuffix (v outputByteLen))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val keccak: rate:size_t{v rate % 8 == 0 /\ v rate / 8 > 0 /\ v rate <= 1600} -> capacity:size_t{v capacity + v rate == 1600} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> outputByteLen:size_t -> output:lbuffer uint8 outputByteLen -> Stack unit (requires fun h -> live h input /\ live h output /\ disjoint input output) (ensures fun h0 _ h1 -> modifies1 output h0 h1 /\ as_seq h1 output == S.keccak (v rate) (v capacity) (v inputByteLen) (as_seq h0 input) delimitedSuffix (v outputByteLen))
[]
Hacl.Impl.SHA3.keccak
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
rate: Lib.IntTypes.size_t {Lib.IntTypes.v rate % 8 == 0 /\ Lib.IntTypes.v rate / 8 > 0 /\ Lib.IntTypes.v rate <= 1600} -> capacity: Lib.IntTypes.size_t{Lib.IntTypes.v capacity + Lib.IntTypes.v rate == 1600} -> inputByteLen: Lib.IntTypes.size_t -> input: Lib.Buffer.lbuffer Lib.IntTypes.uint8 inputByteLen -> delimitedSuffix: Lib.IntTypes.byte_t -> outputByteLen: Lib.IntTypes.size_t -> output: Lib.Buffer.lbuffer Lib.IntTypes.uint8 outputByteLen -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 13, "end_line": 532, "start_col": 2, "start_line": 527 }
FStar.HyperStack.ST.Stack
val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 storeState rateInBytes s res = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in [@ inline_let] let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block ); copy res (sub block 0ul rateInBytes); pop_frame()
val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s)) let storeState rateInBytes s res =
true
null
false
push_frame (); let h0 = ST.get () in let block = create 200ul (u8 0) in [@@ inline_let ]let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block); copy res (sub block 0ul rateInBytes); pop_frame ()
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThanOrEqual", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.SHA3.state", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Lib.Buffer.copy", "Lib.Buffer.MUT", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.Buffer.sub", "FStar.UInt32.__uint_to_t", "Lib.Buffer.loop1", "Prims.op_LessThan", "Hacl.Impl.SHA3.storeState_inner", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lseq", "Lib.Buffer.as_seq", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Prims.nat", "Prims.op_Subtraction", "Prims.pow2", "Spec.SHA3.storeState_inner", "Lib.IntTypes.uint64", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Lib.Buffer.create", "Lib.IntTypes.u8", "FStar.HyperStack.ST.push_frame" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj) private val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s))
[]
Hacl.Impl.SHA3.storeState
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
rateInBytes: Lib.IntTypes.size_t{Lib.IntTypes.v rateInBytes <= 200} -> s: Hacl.Impl.SHA3.state -> res: Lib.Buffer.lbuffer Lib.IntTypes.uint8 rateInBytes -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 13, "end_line": 364, "start_col": 2, "start_line": 352 }
FStar.HyperStack.ST.Stack
val absorb: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> Stack unit (requires fun h0 -> live h0 s /\ live h0 input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb (as_seq h0 s) (v rateInBytes) (v inputByteLen) (as_seq h0 input) delimitedSuffix)
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 absorb s rateInBytes inputByteLen input delimitedSuffix = let n_blocks = inputByteLen /. rateInBytes in let rem = inputByteLen %. rateInBytes in loop_blocks rateInBytes n_blocks rem input (S.absorb_inner (v rateInBytes)) (S.absorb_last delimitedSuffix (v rateInBytes)) (absorb_inner rateInBytes) (absorb_last delimitedSuffix rateInBytes) s
val absorb: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> Stack unit (requires fun h0 -> live h0 s /\ live h0 input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb (as_seq h0 s) (v rateInBytes) (v inputByteLen) (as_seq h0 input) delimitedSuffix) let absorb s rateInBytes inputByteLen input delimitedSuffix =
true
null
false
let n_blocks = inputByteLen /. rateInBytes in let rem = inputByteLen %. rateInBytes in loop_blocks rateInBytes n_blocks rem input (S.absorb_inner (v rateInBytes)) (S.absorb_last delimitedSuffix (v rateInBytes)) (absorb_inner rateInBytes) (absorb_last delimitedSuffix rateInBytes) s
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.op_LessThanOrEqual", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Lib.IntTypes.byte_t", "Lib.Buffer.loop_blocks", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Spec.SHA3.absorb_inner", "Spec.SHA3.absorb_last", "Hacl.Impl.SHA3.absorb_inner", "Hacl.Impl.SHA3.absorb_last", "Prims.unit", "Lib.IntTypes.int_t", "Lib.IntTypes.op_Percent_Dot", "Lib.IntTypes.op_Slash_Dot" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj) private val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s)) let storeState rateInBytes s res = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in [@ inline_let] let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block ); copy res (sub block 0ul rateInBytes); pop_frame() #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes)) let absorb_next s rateInBytes = push_frame(); let h0 = ST.get() in let nextBlock_ = create 200ul (u8 0) in let nextBlock = sub nextBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 nextBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); nextBlock.(rateInBytes -! 1ul) <- u8 0x80; loadState rateInBytes nextBlock s; state_permute s; pop_frame() inline_for_extraction noextract val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s)) let absorb_last delimitedSuffix rateInBytes rem input s = push_frame(); let h0 = ST.get() in let lastBlock_ = create 200ul (u8 0) in let lastBlock = sub lastBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 lastBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); let open Lib.RawIntTypes in update_sub lastBlock (size 0) rem input; lastBlock.(rem) <- byte_to_uint8 delimitedSuffix; loadState rateInBytes lastBlock s; if not ((delimitedSuffix &. byte 0x80) =. byte 0) && (size_to_UInt32 rem = size_to_UInt32 (rateInBytes -. 1ul)) then state_permute s; absorb_next s rateInBytes; pop_frame() val absorb_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> block:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_inner (v rateInBytes) (as_seq h0 block) (as_seq h0 s)) let absorb_inner rateInBytes block s = loadState rateInBytes block s; state_permute s #reset-options "--z3rlimit 100 --max_fuel 0 --max_ifuel 0" private val absorb: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> Stack unit (requires fun h0 -> live h0 s /\ live h0 input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb (as_seq h0 s) (v rateInBytes) (v inputByteLen)
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val absorb: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> Stack unit (requires fun h0 -> live h0 s /\ live h0 input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb (as_seq h0 s) (v rateInBytes) (v inputByteLen) (as_seq h0 input) delimitedSuffix)
[]
Hacl.Impl.SHA3.absorb
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> rateInBytes: Lib.IntTypes.size_t{0 < Lib.IntTypes.v rateInBytes /\ Lib.IntTypes.v rateInBytes <= 200} -> inputByteLen: Lib.IntTypes.size_t -> input: Lib.Buffer.lbuffer Lib.IntTypes.uint8 inputByteLen -> delimitedSuffix: Lib.IntTypes.byte_t -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 45, "end_line": 457, "start_col": 61, "start_line": 450 }
FStar.HyperStack.ST.Stack
val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 absorb_next s rateInBytes = push_frame(); let h0 = ST.get() in let nextBlock_ = create 200ul (u8 0) in let nextBlock = sub nextBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 nextBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); nextBlock.(rateInBytes -! 1ul) <- u8 0x80; loadState rateInBytes nextBlock s; state_permute s; pop_frame()
val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes)) let absorb_next s rateInBytes =
true
null
false
push_frame (); let h0 = ST.get () in let nextBlock_ = create 200ul (u8 0) in let nextBlock = sub nextBlock_ 0ul rateInBytes in let h1 = ST.get () in assert ((as_seq h1 nextBlock) `Seq.equal` (Lib.Sequence.create (v rateInBytes) (u8 0))); nextBlock.(rateInBytes -! 1ul) <- u8 0x80; loadState rateInBytes nextBlock s; state_permute s; pop_frame ()
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_GreaterThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.op_LessThanOrEqual", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Impl.SHA3.state_permute", "Hacl.Impl.SHA3.loadState", "Lib.Buffer.op_Array_Assignment", "Lib.IntTypes.uint8", "Lib.IntTypes.op_Subtraction_Bang", "FStar.UInt32.__uint_to_t", "Lib.IntTypes.u8", "Prims._assert", "FStar.Seq.Base.equal", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Lib.Sequence.create", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.Buffer.sub", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Lib.Buffer.create", "Lib.Buffer.lbuffer", "FStar.HyperStack.ST.push_frame" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj) private val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s)) let storeState rateInBytes s res = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in [@ inline_let] let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block ); copy res (sub block 0ul rateInBytes); pop_frame() #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes))
[]
Hacl.Impl.SHA3.absorb_next
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> rateInBytes: Lib.IntTypes.size_t{Lib.IntTypes.v rateInBytes > 0 /\ Lib.IntTypes.v rateInBytes <= 200} -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 13, "end_line": 388, "start_col": 2, "start_line": 379 }
FStar.HyperStack.ST.Stack
val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame()
val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s =
true
null
false
push_frame (); let h0 = ST.get () in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@@ inline_let ]let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get () in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x); pop_frame ()
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThanOrEqual", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Impl.SHA3.state", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Lib.Buffer.loop1", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Prims.op_LessThan", "Lib.Buffer.op_Array_Assignment", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Hat_Dot", "Lib.Buffer.op_Array_Access", "Lib.Buffer.MUT", "Lib.ByteBuffer.uint_from_bytes_le", "Lib.IntTypes.uint_t", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.U8", "Lib.IntTypes.mk_int", "Lib.Buffer.sub", "Lib.IntTypes.op_Star_Bang", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Lib.LoopCombinators.unfold_repeati", "Lib.Sequence.lseq", "Lib.Buffer.as_seq", "Prims.nat", "Prims.op_Subtraction", "Prims.pow2", "Spec.SHA3.loadState_inner", "Lib.Buffer.update_sub", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "Lib.Buffer.create", "Lib.IntTypes.u8", "FStar.HyperStack.ST.push_frame" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s))
[]
Hacl.Impl.SHA3.loadState
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
rateInBytes: Lib.IntTypes.size_t{Lib.IntTypes.v rateInBytes <= 200} -> input: Lib.Buffer.lbuffer Lib.IntTypes.uint8 rateInBytes -> s: Hacl.Impl.SHA3.state -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 13, "end_line": 323, "start_col": 2, "start_line": 309 }
FStar.HyperStack.ST.Stack
val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s'))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp
val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s =
true
null
false
assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Hacl.Impl.SHA3.state", "Lib.Buffer.op_Array_Assignment", "Prims.unit", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Hacl.Impl.SHA3.rotl", "Lib.Buffer.op_Array_Access", "Lib.Buffer.MUT", "Spec.SHA3.Constants.rotc_t", "Lib.Buffer.CONST", "FStar.UInt32.uint_to_t", "Hacl.Impl.SHA3.keccak_rotc", "Spec.SHA3.Constants.piln_t", "Hacl.Impl.SHA3.keccak_piln", "Hacl.Impl.SHA3.index_map", "Lib.IntTypes.range_t", "Spec.SHA3.Constants.piln_list", "Lib.Buffer.recall_contents", "Spec.SHA3.Constants.keccak_piln", "Spec.SHA3.Constants.keccak_rotc", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "FStar.Pervasives.assert_norm", "Prims.eq2", "Prims.int", "FStar.List.Tot.Base.length" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s'))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s'))
[]
Hacl.Impl.SHA3.state_pi_rho_inner
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
i: Lib.IntTypes.size_t{Lib.IntTypes.v i < 24} -> current: Lib.Buffer.lbuffer Lib.IntTypes.uint64 1ul -> s: Hacl.Impl.SHA3.state -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 23, "end_line": 187, "start_col": 2, "start_line": 178 }
FStar.HyperStack.ST.Stack
val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st))
val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y =
true
null
false
let h0 = ST.get () in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get () in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st))
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Hacl.Impl.SHA3.index", "Prims._assert", "Prims.eq2", "Lib.Sequence.lseq", "Lib.IntTypes.uint64", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "FStar.UInt32.__uint_to_t", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Spec.SHA3.Equivalence.state_chi_inner", "Prims.unit", "Lib.Buffer.modifies", "Lib.Buffer.loc", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Hacl.Impl.SHA3.set", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.IntTypes.op_Hat_Dot", "Lib.IntTypes.op_Amp_Dot", "Hacl.Impl.SHA3.get", "Lib.IntTypes.lognot" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st))
[]
Hacl.Impl.SHA3.state_chi_inner
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
st: Hacl.Impl.SHA3.state -> y: Hacl.Impl.SHA3.index -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 69, "end_line": 242, "start_col": 26, "start_line": 228 }
FStar.HyperStack.ST.Stack
val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame()
val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s =
true
null
false
push_frame (); let x = get s 1ul 0ul in let h0 = ST.get () in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@@ inline_let ]let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@@ inline_let ]let footprint i = loc_union (loc current) (loc s) in [@@ inline_let ]let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s); pop_frame ()
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Lib.Buffer.loop", "FStar.UInt32.__uint_to_t", "Spec.SHA3.state_pi_rho_s", "Lib.IntTypes.size_t", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Impl.SHA3.state_pi_rho_inner", "Lib.LoopCombinators.unfold_repeat_gen", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Prims.nat", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "FStar.Pervasives.Native.tuple2", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "Lib.Sequence.lseq", "Spec.SHA3.state_pi_rho_inner", "FStar.UInt32.uint_to_t", "FStar.UInt32.t", "LowStar.Monotonic.Buffer.loc", "Lib.IntTypes.size_nat", "LowStar.Monotonic.Buffer.loc_union", "Lib.Buffer.loc", "Lib.Buffer.MUT", "Lib.IntTypes.uint64", "Prims.int", "FStar.Pervasives.Native.Mktuple2", "Spec.SHA3.state", "Lib.Buffer.bget", "Lib.Buffer.as_seq", "Prims._assert", "Prims.eq2", "Spec.SHA3.get", "Lib.Buffer.lbuffer_t", "Lib.Buffer.create", "Lib.Buffer.lbuffer", "Hacl.Impl.SHA3.get", "FStar.HyperStack.ST.push_frame" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s))
[]
Hacl.Impl.SHA3.state_pi_rho
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 13, "end_line": 216, "start_col": 2, "start_line": 198 }
FStar.HyperStack.ST.Stack
val squeeze: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> output:lbuffer uint8 outputByteLen -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ as_seq h1 output == S.squeeze (as_seq h0 s) (v rateInBytes) (v outputByteLen))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 squeeze s rateInBytes outputByteLen output = let outBlocks = outputByteLen /. rateInBytes in let remOut = outputByteLen %. rateInBytes in assert_spinoff (v outputByteLen - v remOut == v outBlocks * v rateInBytes); let last = sub output (outputByteLen -. remOut) remOut in [@ inline_let] let a_spec (i:nat{i <= v outputByteLen / v rateInBytes}) = S.state in let blocks = sub output (size 0) (outBlocks *! rateInBytes) in let h0 = ST.get() in fill_blocks h0 rateInBytes outBlocks blocks a_spec (fun h i -> as_seq h s) (fun _ -> loc s) (fun h0 -> S.squeeze_inner (v rateInBytes) (v outputByteLen)) (fun i -> mult_plus_lt (v i) (v outBlocks) (v rateInBytes); squeeze_inner rateInBytes outputByteLen s (sub blocks (i *! rateInBytes) rateInBytes) i); storeState remOut s last; let h1 = ST.get() in Seq.lemma_split (as_seq h1 output) (v outBlocks * v rateInBytes); norm_spec [delta_only [`%S.squeeze]] (S.squeeze (as_seq h0 s) (v rateInBytes) (v outputByteLen))
val squeeze: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> output:lbuffer uint8 outputByteLen -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ as_seq h1 output == S.squeeze (as_seq h0 s) (v rateInBytes) (v outputByteLen)) let squeeze s rateInBytes outputByteLen output =
true
null
false
let outBlocks = outputByteLen /. rateInBytes in let remOut = outputByteLen %. rateInBytes in assert_spinoff (v outputByteLen - v remOut == v outBlocks * v rateInBytes); let last = sub output (outputByteLen -. remOut) remOut in [@@ inline_let ]let a_spec (i: nat{i <= v outputByteLen / v rateInBytes}) = S.state in let blocks = sub output (size 0) (outBlocks *! rateInBytes) in let h0 = ST.get () in fill_blocks h0 rateInBytes outBlocks blocks a_spec (fun h i -> as_seq h s) (fun _ -> loc s) (fun h0 -> S.squeeze_inner (v rateInBytes) (v outputByteLen)) (fun i -> mult_plus_lt (v i) (v outBlocks) (v rateInBytes); squeeze_inner rateInBytes outputByteLen s (sub blocks (i *! rateInBytes) rateInBytes) i); storeState remOut s last; let h1 = ST.get () in Seq.lemma_split (as_seq h1 output) (v outBlocks * v rateInBytes); norm_spec [delta_only [`%S.squeeze]] (S.squeeze (as_seq h0 s) (v rateInBytes) (v outputByteLen))
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Hacl.Impl.SHA3.state", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.op_LessThanOrEqual", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.Pervasives.norm_spec", "Prims.Cons", "FStar.Pervasives.norm_step", "FStar.Pervasives.delta_only", "Prims.string", "Prims.Nil", "Lib.ByteSequence.lbytes", "Spec.SHA3.squeeze", "Lib.Buffer.as_seq", "Lib.Buffer.MUT", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Prims.unit", "FStar.Seq.Properties.lemma_split", "FStar.Mul.op_Star", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Hacl.Impl.SHA3.storeState", "Lib.Buffer.fill_blocks", "Lib.IntTypes.size_nat", "Lib.Buffer.loc", "LowStar.Monotonic.Buffer.loc", "LowStar.Monotonic.Buffer.loc_disjoint", "LowStar.Monotonic.Buffer.loc_includes", "LowStar.Monotonic.Buffer.address_liveness_insensitive_locs", "Spec.SHA3.squeeze_inner", "FStar.Pervasives.Native.tuple2", "Prims.op_Addition", "Lib.Sequence.lseq", "Hacl.Impl.SHA3.squeeze_inner", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Lib.Buffer.sub", "Lib.IntTypes.op_Star_Bang", "Hacl.Impl.SHA3.mult_plus_lt", "Lib.IntTypes.mul", "Lib.IntTypes.size", "Prims.nat", "Prims.op_Division", "Spec.SHA3.state", "Lib.IntTypes.op_Subtraction_Dot", "FStar.Pervasives.assert_spinoff", "Prims.eq2", "Prims.int", "Prims.op_Subtraction", "Lib.IntTypes.op_Percent_Dot", "Lib.IntTypes.op_Slash_Dot" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj) private val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s)) let storeState rateInBytes s res = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in [@ inline_let] let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block ); copy res (sub block 0ul rateInBytes); pop_frame() #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes)) let absorb_next s rateInBytes = push_frame(); let h0 = ST.get() in let nextBlock_ = create 200ul (u8 0) in let nextBlock = sub nextBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 nextBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); nextBlock.(rateInBytes -! 1ul) <- u8 0x80; loadState rateInBytes nextBlock s; state_permute s; pop_frame() inline_for_extraction noextract val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s)) let absorb_last delimitedSuffix rateInBytes rem input s = push_frame(); let h0 = ST.get() in let lastBlock_ = create 200ul (u8 0) in let lastBlock = sub lastBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 lastBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); let open Lib.RawIntTypes in update_sub lastBlock (size 0) rem input; lastBlock.(rem) <- byte_to_uint8 delimitedSuffix; loadState rateInBytes lastBlock s; if not ((delimitedSuffix &. byte 0x80) =. byte 0) && (size_to_UInt32 rem = size_to_UInt32 (rateInBytes -. 1ul)) then state_permute s; absorb_next s rateInBytes; pop_frame() val absorb_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> block:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_inner (v rateInBytes) (as_seq h0 block) (as_seq h0 s)) let absorb_inner rateInBytes block s = loadState rateInBytes block s; state_permute s #reset-options "--z3rlimit 100 --max_fuel 0 --max_ifuel 0" private val absorb: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> inputByteLen:size_t -> input:lbuffer uint8 inputByteLen -> delimitedSuffix:byte_t -> Stack unit (requires fun h0 -> live h0 s /\ live h0 input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb (as_seq h0 s) (v rateInBytes) (v inputByteLen) (as_seq h0 input) delimitedSuffix) let absorb s rateInBytes inputByteLen input delimitedSuffix = let n_blocks = inputByteLen /. rateInBytes in let rem = inputByteLen %. rateInBytes in loop_blocks rateInBytes n_blocks rem input (S.absorb_inner (v rateInBytes)) (S.absorb_last delimitedSuffix (v rateInBytes)) (absorb_inner rateInBytes) (absorb_last delimitedSuffix rateInBytes) s inline_for_extraction noextract val squeeze_inner: rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> s:state -> output:lbuffer uint8 rateInBytes -> i:size_t{v i < v (outputByteLen /. rateInBytes)} -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ (as_seq h1 s, as_seq h1 output) == S.squeeze_inner (v rateInBytes) (v outputByteLen) (v i) (as_seq h0 s)) let squeeze_inner rateInBytes outputByteLen s output i = storeState rateInBytes s output; state_permute s private let mult_plus_lt (i a b:nat) : Lemma (requires i < a) (ensures i * b + b <= a * b) = assert (i <= a - 1) val squeeze: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> output:lbuffer uint8 outputByteLen -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 100, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val squeeze: s:state -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> outputByteLen:size_t -> output:lbuffer uint8 outputByteLen -> Stack unit (requires fun h0 -> live h0 s /\ live h0 output /\ disjoint s output) (ensures fun h0 _ h1 -> modifies2 s output h0 h1 /\ as_seq h1 output == S.squeeze (as_seq h0 s) (v rateInBytes) (v outputByteLen))
[]
Hacl.Impl.SHA3.squeeze
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.SHA3.state -> rateInBytes: Lib.IntTypes.size_t{0 < Lib.IntTypes.v rateInBytes /\ Lib.IntTypes.v rateInBytes <= 200} -> outputByteLen: Lib.IntTypes.size_t -> output: Lib.Buffer.lbuffer Lib.IntTypes.uint8 outputByteLen -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 98, "end_line": 510, "start_col": 48, "start_line": 491 }
FStar.HyperStack.ST.Stack
val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s))
[ { "abbrev": true, "full_module": "Spec.SHA3.Equivalence", "short_module": "Equiv" }, { "abbrev": true, "full_module": "Spec.SHA3", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.LoopCombinators", "short_module": "Loop" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "LB" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "LowStar.Buffer", "short_module": "B" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Spec.SHA3.Constants", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteBuffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "LowStar.BufferOps", "short_module": null }, { "abbrev": false, "full_module": "LowStar.Buffer", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.ST", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl", "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 absorb_last delimitedSuffix rateInBytes rem input s = push_frame(); let h0 = ST.get() in let lastBlock_ = create 200ul (u8 0) in let lastBlock = sub lastBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 lastBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); let open Lib.RawIntTypes in update_sub lastBlock (size 0) rem input; lastBlock.(rem) <- byte_to_uint8 delimitedSuffix; loadState rateInBytes lastBlock s; if not ((delimitedSuffix &. byte 0x80) =. byte 0) && (size_to_UInt32 rem = size_to_UInt32 (rateInBytes -. 1ul)) then state_permute s; absorb_next s rateInBytes; pop_frame()
val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s)) let absorb_last delimitedSuffix rateInBytes rem input s =
true
null
false
push_frame (); let h0 = ST.get () in let lastBlock_ = create 200ul (u8 0) in let lastBlock = sub lastBlock_ 0ul rateInBytes in let h1 = ST.get () in assert ((as_seq h1 lastBlock) `Seq.equal` (Lib.Sequence.create (v rateInBytes) (u8 0))); let open Lib.RawIntTypes in update_sub lastBlock (size 0) rem input; lastBlock.(rem) <- byte_to_uint8 delimitedSuffix; loadState rateInBytes lastBlock s; if not ((delimitedSuffix &. byte 0x80) =. byte 0) && (size_to_UInt32 rem = size_to_UInt32 (rateInBytes -. 1ul)) then state_permute s; absorb_next s rateInBytes; pop_frame ()
{ "checked_file": "Hacl.Impl.SHA3.fst.checked", "dependencies": [ "Spec.SHA3.Equivalence.fst.checked", "Spec.SHA3.Constants.fst.checked", "Spec.SHA3.fst.checked", "prims.fst.checked", "LowStar.BufferOps.fst.checked", "LowStar.Buffer.fst.checked", "Lib.Sequence.fsti.checked", "Lib.RawIntTypes.fsti.checked", "Lib.LoopCombinators.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.ByteBuffer.fsti.checked", "Lib.Buffer.fsti.checked", "FStar.UInt32.fsti.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.List.Tot.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.SHA3.fst" }
[]
[ "Lib.IntTypes.byte_t", "Lib.IntTypes.size_t", "Prims.l_and", "Prims.b2t", "Prims.op_LessThan", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Prims.op_LessThanOrEqual", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Impl.SHA3.state", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Impl.SHA3.absorb_next", "Prims.op_AmpAmp", "Prims.op_Negation", "Lib.IntTypes.op_Equals_Dot", "Lib.IntTypes.U8", "Lib.IntTypes.op_Amp_Dot", "Lib.IntTypes.byte", "Prims.op_Equality", "FStar.UInt32.t", "Prims.l_or", "Prims.int", "Lib.IntTypes.range", "FStar.UInt.size", "FStar.UInt32.n", "Lib.IntTypes.uint_v", "FStar.UInt32.v", "Lib.IntTypes.op_Subtraction_Dot", "FStar.UInt32.__uint_to_t", "Lib.RawIntTypes.size_to_UInt32", "Hacl.Impl.SHA3.state_permute", "Prims.bool", "Hacl.Impl.SHA3.loadState", "Lib.Buffer.op_Array_Assignment", "Lib.IntTypes.byte_to_uint8", "Lib.Buffer.update_sub", "Lib.Buffer.MUT", "Lib.IntTypes.size", "Prims._assert", "FStar.Seq.Base.equal", "Lib.Buffer.as_seq", "Lib.Sequence.create", "Lib.IntTypes.u8", "FStar.Monotonic.HyperStack.mem", "FStar.HyperStack.ST.get", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.IntTypes.SEC", "Lib.Buffer.sub", "FStar.UInt32.uint_to_t", "Lib.Buffer.create", "FStar.HyperStack.ST.push_frame" ]
[]
module Hacl.Impl.SHA3 open FStar.HyperStack.All open FStar.HyperStack open FStar.HyperStack.ST open FStar.Mul open LowStar.Buffer open LowStar.BufferOps open Lib.IntTypes open Lib.Buffer open Lib.ByteBuffer open Spec.SHA3.Constants module ST = FStar.HyperStack.ST module B = LowStar.Buffer module LSeq = Lib.Sequence module LB = Lib.ByteSequence module Loop = Lib.LoopCombinators module S = Spec.SHA3 module Equiv = Spec.SHA3.Equivalence private let keccak_rotc :x:glbuffer rotc_t 24ul{witnessed x keccak_rotc /\ recallable x} = createL_global rotc_list private let keccak_piln :x:glbuffer piln_t 24ul{witnessed x keccak_piln /\ recallable x} = createL_global piln_list private let keccak_rndc :x:glbuffer pub_uint64 24ul{witnessed x keccak_rndc /\ recallable x} = createL_global rndc_list #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0 --using_facts_from '* -FStar.Seq'" inline_for_extraction noextract let state = lbuffer uint64 25ul inline_for_extraction noextract let index = n:size_t{v n < 5} inline_for_extraction noextract val get: s:state -> x:index -> y:index -> Stack uint64 (requires fun h -> live h s) (ensures fun h0 r h1 -> modifies loc_none h0 h1 /\ r == S.get (as_seq h0 s) (v x) (v y)) let get s x y = s.(x +! 5ul *! y) inline_for_extraction noextract val set: s:state -> x:index -> y:index -> v:uint64 -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.set (as_seq h0 s) (size_v x) (size_v y) v) let set s x y v = s.(x +! 5ul *! y) <- v inline_for_extraction noextract let rotl (a:uint64) (b:size_t{0 < uint_v b /\ uint_v b < 64}) = rotate_left a b inline_for_extraction noextract val state_theta0: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h -> live h s /\ live h _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc _C) h0 h1 /\ as_seq h1 _C == S.state_theta0 (as_seq h0 s) (as_seq h0 _C)) let state_theta0 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_C (as_seq h0 s) in let h0 = ST.get () in loop1 h0 5ul _C spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 _C) (v x); _C.(x) <- get s x 0ul ^. get s x 1ul ^. get s x 2ul ^. get s x 3ul ^. get s x 4ul ) inline_for_extraction noextract val state_theta_inner_s: _C:lbuffer uint64 5ul -> x:index -> s:state -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta_inner_s (as_seq h0 _C) (v x) (as_seq h0 s)) let state_theta_inner_s _C x s = let _D = _C.((x +. 4ul) %. 5ul) ^. rotl _C.((x +. 1ul) %. 5ul) 1ul in [@ inline_let] let spec h0 = S.state_theta_inner_s_inner (v x) _D in let h0 = ST.get () in loop1 h0 5ul s spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v y); set s x y (get s x y ^. _D) ) inline_for_extraction noextract val state_theta1: s:state -> _C:lbuffer uint64 5ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 _C /\ disjoint _C s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta1 (as_seq h0 s) (as_seq h0 _C)) let state_theta1 s _C = [@ inline_let] let spec h0 = S.state_theta_inner_s (as_seq h0 _C) in let h0 = ST.get () in loop1 h0 5ul s spec (fun x -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 s) (v x); state_theta_inner_s _C x s ) inline_for_extraction noextract val state_theta: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_theta (as_seq h0 s)) let state_theta s = push_frame (); let h0 = ST.get() in let _C = create 5ul (u64 0) in state_theta0 s _C; state_theta1 s _C; pop_frame() #reset-options "--max_fuel 1 --max_ifuel 1 --z3rlimit 50" private val index_map: #a:Type -> #b:Type -> f:(a -> b) -> l:list a -> i:nat{i < List.Tot.length l} -> Lemma (List.Tot.index (List.Tot.map f l) i == f (List.Tot.index l i)) let rec index_map #a #b f l i = if i = 0 then () else match l with | [] -> () | _ :: l' -> index_map f l' (i - 1) #reset-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100" inline_for_extraction noextract val state_pi_rho_inner: i:size_t{v i < 24} -> current:lbuffer uint64 1ul -> s:state -> Stack unit (requires fun h -> live h s /\ live h current /\ disjoint current s) (ensures fun h0 _ h1 -> modifies (loc_union (loc s) (loc current)) h0 h1 /\ (let c', s' = S.state_pi_rho_inner (v i) (bget h0 current 0, as_seq h0 s) in bget h1 current 0 == c' /\ as_seq h1 s == s')) let state_pi_rho_inner i current s = assert_norm (List.Tot.length piln_list == 24); let h0 = ST.get () in recall_contents keccak_rotc Spec.SHA3.Constants.keccak_rotc; recall_contents keccak_piln Spec.SHA3.Constants.keccak_piln; index_map v piln_list (v i); let _Y = keccak_piln.(i) in let r = keccak_rotc.(i) in let temp = s.(_Y) in s.(_Y) <- rotl current.(0ul) r; current.(0ul) <- temp inline_for_extraction noextract val state_pi_rho: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_pi_rho (as_seq h0 s)) let state_pi_rho s = push_frame(); let x = get s 1ul 0ul in let h0 = ST.get() in let current = create 1ul x in let h1 = ST.get () in assert (bget h1 current 0 == S.get (as_seq h0 s) 1 0); [@ inline_let] let refl h i : GTot (uint64 & S.state) = bget h current 0, as_seq h s in [@ inline_let] let footprint i = loc_union (loc current) (loc s) in [@ inline_let] let spec h0 = S.state_pi_rho_inner in let h0 = ST.get () in loop h0 24ul S.state_pi_rho_s refl footprint spec (fun i -> Loop.unfold_repeat_gen 24 S.state_pi_rho_s (spec h0) (refl h0 0) (v i); state_pi_rho_inner i current s ); pop_frame() inline_for_extraction noextract val state_chi_inner: st:state -> y:index -> Stack unit (requires fun h0 -> live h0 st) (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\ as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) let state_chi_inner st y = let h0 = ST.get() in let v0 = get st 0ul y ^. ((lognot (get st 1ul y)) &. get st 2ul y) in let v1 = get st 1ul y ^. ((lognot (get st 2ul y)) &. get st 3ul y) in let v2 = get st 2ul y ^. ((lognot (get st 3ul y)) &. get st 4ul y) in let v3 = get st 3ul y ^. ((lognot (get st 4ul y)) &. get st 0ul y) in let v4 = get st 4ul y ^. ((lognot (get st 0ul y)) &. get st 1ul y) in set st 0ul y v0; set st 1ul y v1; set st 2ul y v2; set st 3ul y v3; set st 4ul y v4; let h1 = ST.get() in assert (modifies (loc st) h0 h1); assert (as_seq h1 st == Equiv.state_chi_inner (v y) (as_seq h0 st)) inline_for_extraction noextract val state_chi: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_chi (as_seq h0 s)) let state_chi st = let h0 = ST.get() in [@ inline_let] let spec h0 = Equiv.state_chi_inner in let h0 = ST.get () in loop1 h0 5ul st spec (fun y -> Loop.unfold_repeati 5 (spec h0) (as_seq h0 st) (v y); state_chi_inner st y ); let h1 = ST.get() in assert(as_seq h1 st == Equiv.state_chi (as_seq h0 st)); Equiv.state_chi_equivalence (as_seq h0 st) inline_for_extraction noextract val state_iota: s:state -> round:size_t{v round < 24} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_iota (as_seq h0 s) (v round)) let state_iota s round = recall_contents keccak_rndc Spec.SHA3.Constants.keccak_rndc; let c = keccak_rndc.(round) in set s 0ul 0ul (get s 0ul 0ul ^. secret c) private val state_permute: s:state -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.state_permute (as_seq h0 s)) let state_permute s = [@ inline_let] let spec h0 = S.state_permute1 in let h0 = ST.get () in loop1 h0 24ul s spec (fun round -> Loop.unfold_repeati 24 (spec h0) (as_seq h0 s) (v round); state_theta s; state_pi_rho s; state_chi s; state_iota s round) private val loadState: rateInBytes:size_t{v rateInBytes <= 200} -> input:lbuffer uint8 rateInBytes -> s:state -> Stack unit (requires fun h -> live h input /\ live h s /\ disjoint input s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.loadState (v rateInBytes) (as_seq h0 input) (as_seq h0 s)) let loadState rateInBytes input s = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in update_sub block 0ul rateInBytes input; [@ inline_let] let spec h0 = S.loadState_inner (as_seq h0 block) in let h0 = ST.get () in loop1 h0 25ul s spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 s) (v j); let h0 = ST.get() in let x = uint_from_bytes_le #U64 (sub block (j *! 8ul) 8ul) in s.(j) <- s.(j) ^. x ); pop_frame() inline_for_extraction noextract val storeState_inner: s:state -> j:size_t{v j < 25} -> block:lbuffer uint8 200ul -> Stack unit (requires fun h0 -> live h0 s /\ live h0 block /\ disjoint s block) (ensures fun h0 _ h1 -> modifies (loc block) h0 h1 /\ as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block)) let storeState_inner s j block = let sj = s.(j) in let h0 = ST.get () in update_sub_f h0 block (j *! 8ul) 8ul (fun h -> Lib.ByteSequence.uint_to_bytes_le sj) (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj) private val storeState: rateInBytes:size_t{v rateInBytes <= 200} -> s:state -> res:lbuffer uint8 rateInBytes -> Stack unit (requires fun h0 -> live h0 s /\ live h0 res) (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\ as_seq h1 res == S.storeState (v rateInBytes) (as_seq h0 s)) let storeState rateInBytes s res = push_frame(); let h0 = ST.get() in let block = create 200ul (u8 0) in [@ inline_let] let spec h0 = S.storeState_inner (as_seq h0 s) in let h0 = ST.get () in loop1 h0 25ul block spec (fun j -> Loop.unfold_repeati 25 (spec h0) (as_seq h0 block) (v j); storeState_inner s j block ); copy res (sub block 0ul rateInBytes); pop_frame() #reset-options "--z3rlimit 50 --max_fuel 0 --max_ifuel 0" inline_for_extraction noextract val absorb_next: s:state -> rateInBytes:size_t{v rateInBytes > 0 /\ v rateInBytes <= 200} -> Stack unit (requires fun h -> live h s) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_next (as_seq h0 s) (v rateInBytes)) let absorb_next s rateInBytes = push_frame(); let h0 = ST.get() in let nextBlock_ = create 200ul (u8 0) in let nextBlock = sub nextBlock_ 0ul rateInBytes in let h1 = ST.get () in assert (as_seq h1 nextBlock `Seq.equal` Lib.Sequence.create (v rateInBytes) (u8 0)); nextBlock.(rateInBytes -! 1ul) <- u8 0x80; loadState rateInBytes nextBlock s; state_permute s; pop_frame() inline_for_extraction noextract val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s))
false
false
Hacl.Impl.SHA3.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "initial_ifuel": 1, "max_fuel": 0, "max_ifuel": 0, "no_plugins": false, "no_smt": false, "no_tactics": false, "quake_hi": 1, "quake_keep": false, "quake_lo": 1, "retry": false, "reuse_hint_for": null, "smtencoding_elim_box": false, "smtencoding_l_arith_repr": "boxwrap", "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_valid_elim": false, "smtencoding_valid_intro": true, "tcnorm": true, "trivial_pre_for_unannotated_effectful_fns": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val absorb_last: delimitedSuffix:byte_t -> rateInBytes:size_t{0 < v rateInBytes /\ v rateInBytes <= 200} -> rem:size_t{v rem < v rateInBytes} -> input:lbuffer uint8 rem -> s:state -> Stack unit (requires fun h -> live h s /\ live h input /\ disjoint s input) (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\ as_seq h1 s == S.absorb_last delimitedSuffix (v rateInBytes) (v rem) (as_seq h0 input) (as_seq h0 s))
[]
Hacl.Impl.SHA3.absorb_last
{ "file_name": "code/sha3/Hacl.Impl.SHA3.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
delimitedSuffix: Lib.IntTypes.byte_t -> rateInBytes: Lib.IntTypes.size_t{0 < Lib.IntTypes.v rateInBytes /\ Lib.IntTypes.v rateInBytes <= 200} -> rem: Lib.IntTypes.size_t{Lib.IntTypes.v rem < Lib.IntTypes.v rateInBytes} -> input: Lib.Buffer.lbuffer Lib.IntTypes.uint8 rem -> s: Hacl.Impl.SHA3.state -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 13, "end_line": 419, "start_col": 2, "start_line": 405 }
Prims.Tot
val zero_vec (#n: pos) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let zero_vec (#n: pos) : Tot (bv_t n) = create n false
val zero_vec (#n: pos) : Tot (bv_t n) let zero_vec (#n: pos) : Tot (bv_t n) =
false
null
false
create n false
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.Seq.Base.create", "Prims.bool", "FStar.BitVector.bv_t" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *)
false
false
FStar.BitVector.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 zero_vec (#n: pos) : Tot (bv_t n)
[]
FStar.BitVector.zero_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
FStar.BitVector.bv_t n
{ "end_col": 54, "end_line": 36, "start_col": 40, "start_line": 36 }
Prims.Tot
val elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true
val elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) =
false
null
false
upd (create n false) i true
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "FStar.Seq.Base.upd", "Prims.bool", "FStar.Seq.Base.create", "FStar.BitVector.bv_t" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false
false
false
FStar.BitVector.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 elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n)
[]
FStar.BitVector.elem_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
i: Prims.nat{i < n} -> FStar.BitVector.bv_t n
{ "end_col": 83, "end_line": 39, "start_col": 56, "start_line": 39 }
Prims.Tot
val ones_vec (#n: pos) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let ones_vec (#n: pos) : Tot (bv_t n) = create n true
val ones_vec (#n: pos) : Tot (bv_t n) let ones_vec (#n: pos) : Tot (bv_t n) =
false
null
false
create n true
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.Seq.Base.create", "Prims.bool", "FStar.BitVector.bv_t" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true
false
false
FStar.BitVector.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 ones_vec (#n: pos) : Tot (bv_t n)
[]
FStar.BitVector.ones_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
FStar.BitVector.bv_t n
{ "end_col": 53, "end_line": 42, "start_col": 40, "start_line": 42 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let is_subset_vec (#n: pos) (a b: bv_t n) = forall (i: nat). i < n ==> index b i = false ==> index a i = false
let is_subset_vec (#n: pos) (a b: bv_t n) =
false
null
false
forall (i: nat). i < n ==> index b i = false ==> index a i = false
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.l_Forall", "Prims.nat", "Prims.l_imp", "Prims.b2t", "Prims.op_LessThan", "Prims.op_Equality", "Prims.bool", "FStar.Seq.Base.index", "Prims.logical" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical or *) let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logor] defined in terms of its indexing behavior *) let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] = if i = 0 then () else logor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise negation *) let rec lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (not (index a 0)) else append (create 1 (not (index a 0))) (lognot_vec #(n - 1) (slice a 1 n)) (** [lognot] defined in terms of its indexing behavior *) let rec lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)] = if i = 0 then () else lognot_vec_definition #(n - 1) (slice a 1 n) (i - 1) (* Bitwise lemmas *) (** If both [x] and [y] are false at a given index [i], then so is they logical xor at [i] *) let lemma_xor_bounded (m: pos) (n: nat) (x y: bv_t m) : Lemma (requires (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index x (m - 1 - i) = false /\ Seq.index y (m - 1 - i) = false))) (ensures (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index (logxor_vec x y) (m - 1 - i) = false))) = () (** The property that the zero bits of b are also zero in a. I.e. that a is a subset of b. *)
false
false
FStar.BitVector.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 is_subset_vec : a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> Prims.logical
[]
FStar.BitVector.is_subset_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> Prims.logical
{ "end_col": 68, "end_line": 108, "start_col": 2, "start_line": 108 }
Prims.Tot
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let is_superset_vec (#n: pos) (a b: bv_t n) = forall (i: nat). i < n ==> index b i = true ==> index a i = true
let is_superset_vec (#n: pos) (a b: bv_t n) =
false
null
false
forall (i: nat). i < n ==> index b i = true ==> index a i = true
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.l_Forall", "Prims.nat", "Prims.l_imp", "Prims.b2t", "Prims.op_LessThan", "Prims.op_Equality", "Prims.bool", "FStar.Seq.Base.index", "Prims.logical" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical or *) let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logor] defined in terms of its indexing behavior *) let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] = if i = 0 then () else logor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise negation *) let rec lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (not (index a 0)) else append (create 1 (not (index a 0))) (lognot_vec #(n - 1) (slice a 1 n)) (** [lognot] defined in terms of its indexing behavior *) let rec lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)] = if i = 0 then () else lognot_vec_definition #(n - 1) (slice a 1 n) (i - 1) (* Bitwise lemmas *) (** If both [x] and [y] are false at a given index [i], then so is they logical xor at [i] *) let lemma_xor_bounded (m: pos) (n: nat) (x y: bv_t m) : Lemma (requires (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index x (m - 1 - i) = false /\ Seq.index y (m - 1 - i) = false))) (ensures (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index (logxor_vec x y) (m - 1 - i) = false))) = () (** The property that the zero bits of b are also zero in a. I.e. that a is a subset of b. *) let is_subset_vec (#n: pos) (a b: bv_t n) = forall (i: nat). i < n ==> index b i = false ==> index a i = false (** The property that the non-zero bits of b are also non-zero in a. I.e. that a is a superset of b. *)
false
false
FStar.BitVector.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 is_superset_vec : a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> Prims.logical
[]
FStar.BitVector.is_superset_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> Prims.logical
{ "end_col": 66, "end_line": 113, "start_col": 2, "start_line": 113 }
Prims.Tot
val logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n))
val logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) =
false
null
false
if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n))
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.create", "Prims.bool", "Prims.op_AmpAmp", "FStar.Seq.Base.index", "FStar.Seq.Base.append", "FStar.BitVector.logand_vec", "Prims.op_Subtraction", "FStar.Seq.Base.slice" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *)
false
false
FStar.BitVector.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 logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n)
[ "recursion" ]
FStar.BitVector.logand_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> FStar.BitVector.bv_t n
{ "end_col": 99, "end_line": 48, "start_col": 2, "start_line": 46 }
Prims.Tot
val shift_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let shift_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) = if s >= n then zero_vec #n else if s = 0 then a else append (zero_vec #s) (slice a 0 (n - s))
val shift_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) let shift_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) =
false
null
false
if s >= n then zero_vec #n else if s = 0 then a else append (zero_vec #s) (slice a 0 (n - s))
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.nat", "Prims.op_GreaterThanOrEqual", "FStar.BitVector.zero_vec", "Prims.bool", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.append", "FStar.Seq.Base.slice", "Prims.op_Subtraction" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical or *) let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logor] defined in terms of its indexing behavior *) let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] = if i = 0 then () else logor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise negation *) let rec lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (not (index a 0)) else append (create 1 (not (index a 0))) (lognot_vec #(n - 1) (slice a 1 n)) (** [lognot] defined in terms of its indexing behavior *) let rec lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)] = if i = 0 then () else lognot_vec_definition #(n - 1) (slice a 1 n) (i - 1) (* Bitwise lemmas *) (** If both [x] and [y] are false at a given index [i], then so is they logical xor at [i] *) let lemma_xor_bounded (m: pos) (n: nat) (x y: bv_t m) : Lemma (requires (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index x (m - 1 - i) = false /\ Seq.index y (m - 1 - i) = false))) (ensures (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index (logxor_vec x y) (m - 1 - i) = false))) = () (** The property that the zero bits of b are also zero in a. I.e. that a is a subset of b. *) let is_subset_vec (#n: pos) (a b: bv_t n) = forall (i: nat). i < n ==> index b i = false ==> index a i = false (** The property that the non-zero bits of b are also non-zero in a. I.e. that a is a superset of b. *) let is_superset_vec (#n: pos) (a b: bv_t n) = forall (i: nat). i < n ==> index b i = true ==> index a i = true (** Proves that the subset property is conserved in subslices. *) let lemma_slice_subset_vec (#n: pos) (a b: bv_t n) (i: nat) (j: nat{i < j && j <= n}) : Lemma (requires is_subset_vec a b) (ensures (match n with | 1 -> True | _ -> is_subset_vec #(j - i) (slice a i j) (slice b i j))) = () (** Proves that the superset property is conserved in subslices. *) let lemma_slice_superset_vec (#n: pos) (a b: bv_t n) (i: nat) (j: nat{i < j && j <= n}) : Lemma (requires is_superset_vec a b) (ensures (match n with | 1 -> True | _ -> is_superset_vec #(j - i) (slice a i j) (slice b i j))) = () (**** Shift operators *) (* Note: the shift amount is extracted as a bitvector NS: Not sure what this remark means. *) (** Shift [a] left by [s] bits, filling with zeroes *) let shift_left_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) = if s >= n then zero_vec #n else if s = 0 then a else append (slice a s n) (zero_vec #s) (** The fill bits of a shift left are zero *) let shift_left_vec_lemma_1 (#n: pos) (a: bv_t n) (s: nat) (i: nat{i < n && i >= n - s}) : Lemma (ensures index (shift_left_vec #n a s) i = false) [SMTPat (index (shift_left_vec #n a s) i)] = () (** Relating the indexes of the shifted vector to the original *) let shift_left_vec_lemma_2 (#n: pos) (a: bv_t n) (s: nat) (i: nat{i < n && i < n - s}) : Lemma (ensures index (shift_left_vec #n a s) i = index a (i + s)) [SMTPat (index (shift_left_vec #n a s) i)] = () (** Shift [a] right by [s] bits, filling with zeroes *)
false
false
FStar.BitVector.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 shift_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n)
[]
FStar.BitVector.shift_right_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> s: Prims.nat -> FStar.BitVector.bv_t n
{ "end_col": 95, "end_line": 152, "start_col": 2, "start_line": 152 }
Prims.Tot
val shift_left_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let shift_left_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) = if s >= n then zero_vec #n else if s = 0 then a else append (slice a s n) (zero_vec #s)
val shift_left_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) let shift_left_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) =
false
null
false
if s >= n then zero_vec #n else if s = 0 then a else append (slice a s n) (zero_vec #s)
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.nat", "Prims.op_GreaterThanOrEqual", "FStar.BitVector.zero_vec", "Prims.bool", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.append", "FStar.Seq.Base.slice" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical or *) let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logor] defined in terms of its indexing behavior *) let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] = if i = 0 then () else logor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise negation *) let rec lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (not (index a 0)) else append (create 1 (not (index a 0))) (lognot_vec #(n - 1) (slice a 1 n)) (** [lognot] defined in terms of its indexing behavior *) let rec lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)] = if i = 0 then () else lognot_vec_definition #(n - 1) (slice a 1 n) (i - 1) (* Bitwise lemmas *) (** If both [x] and [y] are false at a given index [i], then so is they logical xor at [i] *) let lemma_xor_bounded (m: pos) (n: nat) (x y: bv_t m) : Lemma (requires (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index x (m - 1 - i) = false /\ Seq.index y (m - 1 - i) = false))) (ensures (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index (logxor_vec x y) (m - 1 - i) = false))) = () (** The property that the zero bits of b are also zero in a. I.e. that a is a subset of b. *) let is_subset_vec (#n: pos) (a b: bv_t n) = forall (i: nat). i < n ==> index b i = false ==> index a i = false (** The property that the non-zero bits of b are also non-zero in a. I.e. that a is a superset of b. *) let is_superset_vec (#n: pos) (a b: bv_t n) = forall (i: nat). i < n ==> index b i = true ==> index a i = true (** Proves that the subset property is conserved in subslices. *) let lemma_slice_subset_vec (#n: pos) (a b: bv_t n) (i: nat) (j: nat{i < j && j <= n}) : Lemma (requires is_subset_vec a b) (ensures (match n with | 1 -> True | _ -> is_subset_vec #(j - i) (slice a i j) (slice b i j))) = () (** Proves that the superset property is conserved in subslices. *) let lemma_slice_superset_vec (#n: pos) (a b: bv_t n) (i: nat) (j: nat{i < j && j <= n}) : Lemma (requires is_superset_vec a b) (ensures (match n with | 1 -> True | _ -> is_superset_vec #(j - i) (slice a i j) (slice b i j))) = () (**** Shift operators *) (* Note: the shift amount is extracted as a bitvector NS: Not sure what this remark means. *) (** Shift [a] left by [s] bits, filling with zeroes *)
false
false
FStar.BitVector.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 shift_left_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n)
[]
FStar.BitVector.shift_left_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> s: Prims.nat -> FStar.BitVector.bv_t n
{ "end_col": 89, "end_line": 138, "start_col": 2, "start_line": 138 }
Prims.Tot
val lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (not (index a 0)) else append (create 1 (not (index a 0))) (lognot_vec #(n - 1) (slice a 1 n))
val lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n) let rec lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n) =
false
null
false
if n = 1 then create 1 (not (index a 0)) else append (create 1 (not (index a 0))) (lognot_vec #(n - 1) (slice a 1 n))
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.create", "Prims.bool", "Prims.op_Negation", "FStar.Seq.Base.index", "FStar.Seq.Base.append", "FStar.BitVector.lognot_vec", "Prims.op_Subtraction", "FStar.Seq.Base.slice" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical or *) let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logor] defined in terms of its indexing behavior *) let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] = if i = 0 then () else logor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise negation *)
false
false
FStar.BitVector.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 lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n)
[ "recursion" ]
FStar.BitVector.lognot_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> FStar.BitVector.bv_t n
{ "end_col": 78, "end_line": 84, "start_col": 2, "start_line": 82 }
Prims.Tot
val shift_arithmetic_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let shift_arithmetic_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) = if index a 0 then if s >= n then ones_vec #n else if s = 0 then a else append (ones_vec #s) (slice a 0 (n - s)) else shift_right_vec a s
val shift_arithmetic_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) let shift_arithmetic_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) =
false
null
false
if index a 0 then if s >= n then ones_vec #n else if s = 0 then a else append (ones_vec #s) (slice a 0 (n - s)) else shift_right_vec a s
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.nat", "FStar.Seq.Base.index", "Prims.bool", "Prims.op_GreaterThanOrEqual", "FStar.BitVector.ones_vec", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.append", "FStar.Seq.Base.slice", "Prims.op_Subtraction", "FStar.BitVector.shift_right_vec" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical or *) let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logor] defined in terms of its indexing behavior *) let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] = if i = 0 then () else logor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise negation *) let rec lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (not (index a 0)) else append (create 1 (not (index a 0))) (lognot_vec #(n - 1) (slice a 1 n)) (** [lognot] defined in terms of its indexing behavior *) let rec lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)] = if i = 0 then () else lognot_vec_definition #(n - 1) (slice a 1 n) (i - 1) (* Bitwise lemmas *) (** If both [x] and [y] are false at a given index [i], then so is they logical xor at [i] *) let lemma_xor_bounded (m: pos) (n: nat) (x y: bv_t m) : Lemma (requires (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index x (m - 1 - i) = false /\ Seq.index y (m - 1 - i) = false))) (ensures (forall (i: nat). (i < m /\ i >= n) ==> (Seq.index (logxor_vec x y) (m - 1 - i) = false))) = () (** The property that the zero bits of b are also zero in a. I.e. that a is a subset of b. *) let is_subset_vec (#n: pos) (a b: bv_t n) = forall (i: nat). i < n ==> index b i = false ==> index a i = false (** The property that the non-zero bits of b are also non-zero in a. I.e. that a is a superset of b. *) let is_superset_vec (#n: pos) (a b: bv_t n) = forall (i: nat). i < n ==> index b i = true ==> index a i = true (** Proves that the subset property is conserved in subslices. *) let lemma_slice_subset_vec (#n: pos) (a b: bv_t n) (i: nat) (j: nat{i < j && j <= n}) : Lemma (requires is_subset_vec a b) (ensures (match n with | 1 -> True | _ -> is_subset_vec #(j - i) (slice a i j) (slice b i j))) = () (** Proves that the superset property is conserved in subslices. *) let lemma_slice_superset_vec (#n: pos) (a b: bv_t n) (i: nat) (j: nat{i < j && j <= n}) : Lemma (requires is_superset_vec a b) (ensures (match n with | 1 -> True | _ -> is_superset_vec #(j - i) (slice a i j) (slice b i j))) = () (**** Shift operators *) (* Note: the shift amount is extracted as a bitvector NS: Not sure what this remark means. *) (** Shift [a] left by [s] bits, filling with zeroes *) let shift_left_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) = if s >= n then zero_vec #n else if s = 0 then a else append (slice a s n) (zero_vec #s) (** The fill bits of a shift left are zero *) let shift_left_vec_lemma_1 (#n: pos) (a: bv_t n) (s: nat) (i: nat{i < n && i >= n - s}) : Lemma (ensures index (shift_left_vec #n a s) i = false) [SMTPat (index (shift_left_vec #n a s) i)] = () (** Relating the indexes of the shifted vector to the original *) let shift_left_vec_lemma_2 (#n: pos) (a: bv_t n) (s: nat) (i: nat{i < n && i < n - s}) : Lemma (ensures index (shift_left_vec #n a s) i = index a (i + s)) [SMTPat (index (shift_left_vec #n a s) i)] = () (** Shift [a] right by [s] bits, filling with zeroes *) let shift_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n) = if s >= n then zero_vec #n else if s = 0 then a else append (zero_vec #s) (slice a 0 (n - s)) (** The fill bits of a shift right are zero *) let shift_right_vec_lemma_1 (#n: pos) (a: bv_t n) (s: nat) (i: nat{i < n && i < s}) : Lemma (ensures index (shift_right_vec #n a s) i = false) [SMTPat (index (shift_right_vec #n a s) i)] = () (** Relating the indexes of the shifted vector to the original *) let shift_right_vec_lemma_2 (#n: pos) (a: bv_t n) (s: nat) (i: nat{i < n && i >= s}) : Lemma (ensures index (shift_right_vec #n a s) i = index a (i - s)) [SMTPat (index (shift_right_vec #n a s) i)] = () (** Arithmetic shift right of [a], interpreting position [0] as the most-significant bit, and using its value to fill *)
false
false
FStar.BitVector.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 shift_arithmetic_right_vec (#n: pos) (a: bv_t n) (s: nat) : Tot (bv_t n)
[]
FStar.BitVector.shift_arithmetic_right_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> s: Prims.nat -> FStar.BitVector.bv_t n
{ "end_col": 26, "end_line": 169, "start_col": 2, "start_line": 167 }
Prims.Tot
val logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n))
val logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) =
false
null
false
if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n))
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.create", "Prims.bool", "Prims.op_BarBar", "FStar.Seq.Base.index", "FStar.Seq.Base.append", "FStar.BitVector.logor_vec", "Prims.op_Subtraction", "FStar.Seq.Base.slice" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical or *)
false
false
FStar.BitVector.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 logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n)
[ "recursion" ]
FStar.BitVector.logor_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> FStar.BitVector.bv_t n
{ "end_col": 98, "end_line": 72, "start_col": 2, "start_line": 70 }
Prims.Tot
val logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n)
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n))
val logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) =
false
null
false
if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n))
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "total" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.op_Equality", "Prims.int", "FStar.Seq.Base.create", "Prims.bool", "Prims.op_disEquality", "FStar.Seq.Base.index", "FStar.Seq.Base.append", "FStar.BitVector.logxor_vec", "Prims.op_Subtraction", "FStar.Seq.Base.slice" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *)
false
false
FStar.BitVector.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 logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n)
[ "recursion" ]
FStar.BitVector.logxor_vec
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> FStar.BitVector.bv_t n
{ "end_col": 99, "end_line": 60, "start_col": 2, "start_line": 58 }
FStar.Pervasives.Lemma
val logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)]
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] = if i = 0 then () else logor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1)
val logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] =
false
null
true
if i = 0 then () else logor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1)
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "lemma" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Prims.op_Equality", "Prims.int", "Prims.bool", "FStar.BitVector.logor_vec_definition", "Prims.op_Subtraction", "FStar.Seq.Base.slice", "Prims.unit", "Prims.l_True", "Prims.squash", "FStar.Seq.Base.index", "FStar.BitVector.logor_vec", "Prims.op_BarBar", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical or *) let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logor] defined in terms of its indexing behavior *) let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i))
false
false
FStar.BitVector.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 logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)]
[ "recursion" ]
FStar.BitVector.logor_vec_definition
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> i: Prims.nat{i < n} -> FStar.Pervasives.Lemma (ensures FStar.Seq.Base.index (FStar.BitVector.logor_vec a b) i = (FStar.Seq.Base.index a i || FStar.Seq.Base.index b i)) [SMTPat (FStar.Seq.Base.index (FStar.BitVector.logor_vec a b) i)]
{ "end_col": 89, "end_line": 78, "start_col": 2, "start_line": 78 }
FStar.Pervasives.Lemma
val lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)]
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)] = if i = 0 then () else lognot_vec_definition #(n - 1) (slice a 1 n) (i - 1)
val lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)] let rec lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)] =
false
null
true
if i = 0 then () else lognot_vec_definition #(n - 1) (slice a 1 n) (i - 1)
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "lemma" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Prims.op_Equality", "Prims.int", "Prims.bool", "FStar.BitVector.lognot_vec_definition", "Prims.op_Subtraction", "FStar.Seq.Base.slice", "Prims.unit", "Prims.l_True", "Prims.squash", "FStar.Seq.Base.index", "FStar.BitVector.lognot_vec", "Prims.op_Negation", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical or *) let rec logor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 || index b 0) else append (create 1 (index a 0 || index b 0)) (logor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logor] defined in terms of its indexing behavior *) let rec logor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logor_vec #n a b) i = (index a i || index b i)) [SMTPat (index (logor_vec #n a b) i)] = if i = 0 then () else logor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise negation *) let rec lognot_vec (#n: pos) (a: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (not (index a 0)) else append (create 1 (not (index a 0))) (lognot_vec #(n - 1) (slice a 1 n)) (** [lognot] defined in terms of its indexing behavior *) let rec lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i))
false
false
FStar.BitVector.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 lognot_vec_definition (#n: pos) (a: bv_t n) (i: nat{i < n}) : Lemma (ensures index (lognot_vec #n a) i = not (index a i)) [SMTPat (index (lognot_vec #n a) i)]
[ "recursion" ]
FStar.BitVector.lognot_vec_definition
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> i: Prims.nat{i < n} -> FStar.Pervasives.Lemma (ensures FStar.Seq.Base.index (FStar.BitVector.lognot_vec a) i = Prims.op_Negation (FStar.Seq.Base.index a i)) [SMTPat (FStar.Seq.Base.index (FStar.BitVector.lognot_vec a) i)]
{ "end_col": 76, "end_line": 90, "start_col": 2, "start_line": 90 }
FStar.Pervasives.Lemma
val logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)]
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1)
val logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] =
false
null
true
if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1)
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "lemma" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Prims.op_Equality", "Prims.int", "Prims.bool", "FStar.BitVector.logand_vec_definition", "Prims.op_Subtraction", "FStar.Seq.Base.slice", "Prims.unit", "Prims.l_True", "Prims.squash", "FStar.Seq.Base.index", "FStar.BitVector.logand_vec", "Prims.op_AmpAmp", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i))
false
false
FStar.BitVector.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 logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)]
[ "recursion" ]
FStar.BitVector.logand_vec_definition
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> i: Prims.nat{i < n} -> FStar.Pervasives.Lemma (ensures FStar.Seq.Base.index (FStar.BitVector.logand_vec a b) i = (FStar.Seq.Base.index a i && FStar.Seq.Base.index b i)) [SMTPat (FStar.Seq.Base.index (FStar.BitVector.logand_vec a b) i)]
{ "end_col": 90, "end_line": 54, "start_col": 2, "start_line": 54 }
FStar.Pervasives.Lemma
val logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)]
[ { "abbrev": false, "full_module": "FStar.Seq", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] = if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1)
val logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)] =
false
null
true
if i = 0 then () else logxor_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1)
{ "checked_file": "FStar.BitVector.fst.checked", "dependencies": [ "prims.fst.checked", "FStar.Seq.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "FStar.BitVector.fst" }
[ "lemma" ]
[ "Prims.pos", "FStar.BitVector.bv_t", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Prims.op_Equality", "Prims.int", "Prims.bool", "FStar.BitVector.logxor_vec_definition", "Prims.op_Subtraction", "FStar.Seq.Base.slice", "Prims.unit", "Prims.l_True", "Prims.squash", "FStar.Seq.Base.index", "FStar.BitVector.logxor_vec", "Prims.op_disEquality", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ]
[]
(* Copyright 2008-2018 Microsoft Research Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *) module FStar.BitVector /// This module defines a bit vector as a sequence of booleans of a /// given length, and provides various utilities. /// /// NOTE: THE TYPE [bv_t] DEFINED IS UNRELATED TO THE SMT SOLVER'S /// THEORY OF BIT VECTORS. SEE [FStar.BV] FOR THAT. /// /// TODO: We might rename this module to FStar.Seq.Boolean? open FStar.Mul open FStar.Seq (** [bv_t n] is just a sequence of booleans of length [n] *) type bv_t (n: nat) = vec: seq bool {length vec = n} (**** Common constants *) (** A length [n] zero vector *) let zero_vec (#n: pos) : Tot (bv_t n) = create n false (** A vector of length [n] whose [i]th bit is set, only *) let elem_vec (#n: pos) (i: nat{i < n}) : Tot (bv_t n) = upd (create n false) i true (** A length [n] vector all of whose bits are set *) let ones_vec (#n: pos) : Tot (bv_t n) = create n true (** Bitwise logical and *) let rec logand_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 && index b 0) else append (create 1 (index a 0 && index b 0)) (logand_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logand] defined in terms of its indexing behavior *) let rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i)) [SMTPat (index (logand_vec #n a b) i)] = if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1) (** Bitwise logical exclusive or *) let rec logxor_vec (#n: pos) (a b: bv_t n) : Tot (bv_t n) = if n = 1 then create 1 (index a 0 <> index b 0) else append (create 1 (index a 0 <> index b 0)) (logxor_vec #(n - 1) (slice a 1 n) (slice b 1 n)) (** [logxor] defined in terms of its indexing behavior *) let rec logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i))
false
false
FStar.BitVector.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 logxor_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n}) : Lemma (ensures index (logxor_vec #n a b) i = (index a i <> index b i)) [SMTPat (index (logxor_vec #n a b) i)]
[ "recursion" ]
FStar.BitVector.logxor_vec_definition
{ "file_name": "ulib/FStar.BitVector.fst", "git_rev": "f4cbb7a38d67eeb13fbdb2f4fb8a44a65cbcdc1f", "git_url": "https://github.com/FStarLang/FStar.git", "project_name": "FStar" }
a: FStar.BitVector.bv_t n -> b: FStar.BitVector.bv_t n -> i: Prims.nat{i < n} -> FStar.Pervasives.Lemma (ensures FStar.Seq.Base.index (FStar.BitVector.logxor_vec a b) i = (FStar.Seq.Base.index a i <> FStar.Seq.Base.index b i)) [SMTPat (FStar.Seq.Base.index (FStar.BitVector.logxor_vec a b) i)]
{ "end_col": 90, "end_line": 66, "start_col": 2, "start_line": 66 }
FStar.HyperStack.ST.Stack
val set_zero: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 0)
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64", "short_module": "F64" }, { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field51", "short_module": "F51" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields.Core", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let set_zero #s f = match s with | M51 -> F51.set_zero f | M64 -> F64.set_zero f
val set_zero: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 0) let set_zero #s f =
true
null
false
match s with | M51 -> F51.set_zero f | M64 -> F64.set_zero f
{ "checked_file": "Hacl.Impl.Curve25519.Fields.fst.checked", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Meta.Attribute.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Curve25519.Fields.Core.fsti.checked", "Hacl.Impl.Curve25519.Field64.fst.checked", "Hacl.Impl.Curve25519.Field51.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Curve25519.Fields.fst" }
[]
[ "Hacl.Impl.Curve25519.Fields.Core.field_spec", "Hacl.Impl.Curve25519.Fields.Core.felem", "Hacl.Impl.Curve25519.Field51.set_zero", "Prims.unit", "Hacl.Impl.Curve25519.Field64.set_zero" ]
[]
module Hacl.Impl.Curve25519.Fields open FStar.HyperStack open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.Buffer include Hacl.Impl.Curve25519.Fields.Core module ST = FStar.HyperStack.ST module BSeq = Lib.ByteSequence module LSeq = Lib.Sequence module P = Spec.Curve25519 module F51 = Hacl.Impl.Curve25519.Field51 module F64 = Hacl.Impl.Curve25519.Field64 #set-options "--z3rlimit 50 --max_fuel 0 --initial_ifuel 1 --max_ifuel 1 --record_options" inline_for_extraction noextract val create_felem: s:field_spec -> StackInline (felem s) (requires fun h -> True) (ensures fun h0 f h1 -> stack_allocated f h0 h1 (LSeq.create (v (nlimb s)) (limb_zero s)) /\ as_nat h1 f == 0) let create_felem s = match s with | M51 -> (F51.create_felem ()) <: felem s | M64 -> (F64.create_felem ()) <: felem s inline_for_extraction noextract val load_felem: #s:field_spec -> f:felem s -> u64s:lbuffer uint64 4ul -> Stack unit (requires fun h -> live h f /\ live h u64s /\ disjoint f u64s /\ v (LSeq.index (as_seq h u64s) 3) < pow2 63) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ state_inv_t h1 f /\ as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s)) let load_felem #s f b = match s with | M51 -> F51.load_felem f b | M64 -> F64.load_felem f b val store_felem: #s:field_spec -> b:lbuffer uint64 4ul -> f:felem s -> Stack unit (requires fun h -> live h f /\ live h b /\ disjoint f b /\ state_inv_t h f) (ensures fun h0 _ h1 -> modifies (loc b |+| loc f) h0 h1 /\ as_seq h1 b == BSeq.nat_to_intseq_le 4 (feval h0 f)) [@ Meta.Attribute.specialize ] let store_felem #s b f = match s with | M51 -> F51.store_felem b f | M64 -> F64.store_felem b f inline_for_extraction noextract val set_zero: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 0)
false
false
Hacl.Impl.Curve25519.Fields.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val set_zero: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 0)
[]
Hacl.Impl.Curve25519.Fields.set_zero
{ "file_name": "code/curve25519/Hacl.Impl.Curve25519.Fields.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
f: Hacl.Impl.Curve25519.Fields.Core.felem s -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 25, "end_line": 81, "start_col": 2, "start_line": 79 }
FStar.HyperStack.ST.Stack
val set_one: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 1)
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64", "short_module": "F64" }, { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field51", "short_module": "F51" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields.Core", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let set_one #s f = match s with | M51 -> F51.set_one f | M64 -> F64.set_one f
val set_one: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 1) let set_one #s f =
true
null
false
match s with | M51 -> F51.set_one f | M64 -> F64.set_one f
{ "checked_file": "Hacl.Impl.Curve25519.Fields.fst.checked", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Meta.Attribute.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Curve25519.Fields.Core.fsti.checked", "Hacl.Impl.Curve25519.Field64.fst.checked", "Hacl.Impl.Curve25519.Field51.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Curve25519.Fields.fst" }
[]
[ "Hacl.Impl.Curve25519.Fields.Core.field_spec", "Hacl.Impl.Curve25519.Fields.Core.felem", "Hacl.Impl.Curve25519.Field51.set_one", "Prims.unit", "Hacl.Impl.Curve25519.Field64.set_one" ]
[]
module Hacl.Impl.Curve25519.Fields open FStar.HyperStack open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.Buffer include Hacl.Impl.Curve25519.Fields.Core module ST = FStar.HyperStack.ST module BSeq = Lib.ByteSequence module LSeq = Lib.Sequence module P = Spec.Curve25519 module F51 = Hacl.Impl.Curve25519.Field51 module F64 = Hacl.Impl.Curve25519.Field64 #set-options "--z3rlimit 50 --max_fuel 0 --initial_ifuel 1 --max_ifuel 1 --record_options" inline_for_extraction noextract val create_felem: s:field_spec -> StackInline (felem s) (requires fun h -> True) (ensures fun h0 f h1 -> stack_allocated f h0 h1 (LSeq.create (v (nlimb s)) (limb_zero s)) /\ as_nat h1 f == 0) let create_felem s = match s with | M51 -> (F51.create_felem ()) <: felem s | M64 -> (F64.create_felem ()) <: felem s inline_for_extraction noextract val load_felem: #s:field_spec -> f:felem s -> u64s:lbuffer uint64 4ul -> Stack unit (requires fun h -> live h f /\ live h u64s /\ disjoint f u64s /\ v (LSeq.index (as_seq h u64s) 3) < pow2 63) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ state_inv_t h1 f /\ as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s)) let load_felem #s f b = match s with | M51 -> F51.load_felem f b | M64 -> F64.load_felem f b val store_felem: #s:field_spec -> b:lbuffer uint64 4ul -> f:felem s -> Stack unit (requires fun h -> live h f /\ live h b /\ disjoint f b /\ state_inv_t h f) (ensures fun h0 _ h1 -> modifies (loc b |+| loc f) h0 h1 /\ as_seq h1 b == BSeq.nat_to_intseq_le 4 (feval h0 f)) [@ Meta.Attribute.specialize ] let store_felem #s b f = match s with | M51 -> F51.store_felem b f | M64 -> F64.store_felem b f inline_for_extraction noextract val set_zero: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 0) let set_zero #s f = match s with | M51 -> F51.set_zero f | M64 -> F64.set_zero f inline_for_extraction noextract val set_one: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 1)
false
false
Hacl.Impl.Curve25519.Fields.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val set_one: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 1)
[]
Hacl.Impl.Curve25519.Fields.set_one
{ "file_name": "code/curve25519/Hacl.Impl.Curve25519.Fields.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
f: Hacl.Impl.Curve25519.Fields.Core.felem s -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 24, "end_line": 95, "start_col": 2, "start_line": 93 }
FStar.HyperStack.ST.Stack
val copy_felem: #s:field_spec -> f:felem s -> f':felem s -> Stack unit (requires fun h -> live h f /\ live h f' /\ disjoint f f') (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_seq h1 f == as_seq h0 f')
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64", "short_module": "F64" }, { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field51", "short_module": "F51" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields.Core", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "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 copy_felem #s f f' = match s with | M51 -> F51.copy_felem f f' | M64 -> F64.copy_felem f f'
val copy_felem: #s:field_spec -> f:felem s -> f':felem s -> Stack unit (requires fun h -> live h f /\ live h f' /\ disjoint f f') (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_seq h1 f == as_seq h0 f') let copy_felem #s f f' =
true
null
false
match s with | M51 -> F51.copy_felem f f' | M64 -> F64.copy_felem f f'
{ "checked_file": "Hacl.Impl.Curve25519.Fields.fst.checked", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Meta.Attribute.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Curve25519.Fields.Core.fsti.checked", "Hacl.Impl.Curve25519.Field64.fst.checked", "Hacl.Impl.Curve25519.Field51.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Curve25519.Fields.fst" }
[]
[ "Hacl.Impl.Curve25519.Fields.Core.field_spec", "Hacl.Impl.Curve25519.Fields.Core.felem", "Hacl.Impl.Curve25519.Field51.copy_felem", "Prims.unit", "Hacl.Impl.Curve25519.Field64.copy_felem" ]
[]
module Hacl.Impl.Curve25519.Fields open FStar.HyperStack open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.Buffer include Hacl.Impl.Curve25519.Fields.Core module ST = FStar.HyperStack.ST module BSeq = Lib.ByteSequence module LSeq = Lib.Sequence module P = Spec.Curve25519 module F51 = Hacl.Impl.Curve25519.Field51 module F64 = Hacl.Impl.Curve25519.Field64 #set-options "--z3rlimit 50 --max_fuel 0 --initial_ifuel 1 --max_ifuel 1 --record_options" inline_for_extraction noextract val create_felem: s:field_spec -> StackInline (felem s) (requires fun h -> True) (ensures fun h0 f h1 -> stack_allocated f h0 h1 (LSeq.create (v (nlimb s)) (limb_zero s)) /\ as_nat h1 f == 0) let create_felem s = match s with | M51 -> (F51.create_felem ()) <: felem s | M64 -> (F64.create_felem ()) <: felem s inline_for_extraction noextract val load_felem: #s:field_spec -> f:felem s -> u64s:lbuffer uint64 4ul -> Stack unit (requires fun h -> live h f /\ live h u64s /\ disjoint f u64s /\ v (LSeq.index (as_seq h u64s) 3) < pow2 63) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ state_inv_t h1 f /\ as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s)) let load_felem #s f b = match s with | M51 -> F51.load_felem f b | M64 -> F64.load_felem f b val store_felem: #s:field_spec -> b:lbuffer uint64 4ul -> f:felem s -> Stack unit (requires fun h -> live h f /\ live h b /\ disjoint f b /\ state_inv_t h f) (ensures fun h0 _ h1 -> modifies (loc b |+| loc f) h0 h1 /\ as_seq h1 b == BSeq.nat_to_intseq_le 4 (feval h0 f)) [@ Meta.Attribute.specialize ] let store_felem #s b f = match s with | M51 -> F51.store_felem b f | M64 -> F64.store_felem b f inline_for_extraction noextract val set_zero: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 0) let set_zero #s f = match s with | M51 -> F51.set_zero f | M64 -> F64.set_zero f inline_for_extraction noextract val set_one: #s:field_spec -> f:felem s -> Stack unit (requires fun h -> live h f) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_nat h1 f == 1) let set_one #s f = match s with | M51 -> F51.set_one f | M64 -> F64.set_one f inline_for_extraction noextract val copy_felem: #s:field_spec -> f:felem s -> f':felem s -> Stack unit (requires fun h -> live h f /\ live h f' /\ disjoint f f') (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_seq h1 f == as_seq h0 f')
false
false
Hacl.Impl.Curve25519.Fields.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val copy_felem: #s:field_spec -> f:felem s -> f':felem s -> Stack unit (requires fun h -> live h f /\ live h f' /\ disjoint f f') (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ as_seq h1 f == as_seq h0 f')
[]
Hacl.Impl.Curve25519.Fields.copy_felem
{ "file_name": "code/curve25519/Hacl.Impl.Curve25519.Fields.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
f: Hacl.Impl.Curve25519.Fields.Core.felem s -> f': Hacl.Impl.Curve25519.Fields.Core.felem s -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 30, "end_line": 111, "start_col": 2, "start_line": 109 }
FStar.HyperStack.ST.StackInline
val create_felem: s:field_spec -> StackInline (felem s) (requires fun h -> True) (ensures fun h0 f h1 -> stack_allocated f h0 h1 (LSeq.create (v (nlimb s)) (limb_zero s)) /\ as_nat h1 f == 0)
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64", "short_module": "F64" }, { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field51", "short_module": "F51" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields.Core", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "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_felem s = match s with | M51 -> (F51.create_felem ()) <: felem s | M64 -> (F64.create_felem ()) <: felem s
val create_felem: s:field_spec -> StackInline (felem s) (requires fun h -> True) (ensures fun h0 f h1 -> stack_allocated f h0 h1 (LSeq.create (v (nlimb s)) (limb_zero s)) /\ as_nat h1 f == 0) let create_felem s =
true
null
false
match s with | M51 -> (F51.create_felem ()) <: felem s | M64 -> (F64.create_felem ()) <: felem s
{ "checked_file": "Hacl.Impl.Curve25519.Fields.fst.checked", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Meta.Attribute.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Curve25519.Fields.Core.fsti.checked", "Hacl.Impl.Curve25519.Field64.fst.checked", "Hacl.Impl.Curve25519.Field51.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Curve25519.Fields.fst" }
[]
[ "Hacl.Impl.Curve25519.Fields.Core.field_spec", "Hacl.Impl.Curve25519.Field51.create_felem", "Hacl.Impl.Curve25519.Field51.felem", "Hacl.Impl.Curve25519.Fields.Core.felem", "Hacl.Impl.Curve25519.Field64.create_felem", "Hacl.Impl.Curve25519.Field64.felem" ]
[]
module Hacl.Impl.Curve25519.Fields open FStar.HyperStack open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.Buffer include Hacl.Impl.Curve25519.Fields.Core module ST = FStar.HyperStack.ST module BSeq = Lib.ByteSequence module LSeq = Lib.Sequence module P = Spec.Curve25519 module F51 = Hacl.Impl.Curve25519.Field51 module F64 = Hacl.Impl.Curve25519.Field64 #set-options "--z3rlimit 50 --max_fuel 0 --initial_ifuel 1 --max_ifuel 1 --record_options" inline_for_extraction noextract val create_felem: s:field_spec -> StackInline (felem s) (requires fun h -> True) (ensures fun h0 f h1 -> stack_allocated f h0 h1 (LSeq.create (v (nlimb s)) (limb_zero s)) /\ as_nat h1 f == 0)
false
false
Hacl.Impl.Curve25519.Fields.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val create_felem: s:field_spec -> StackInline (felem s) (requires fun h -> True) (ensures fun h0 f h1 -> stack_allocated f h0 h1 (LSeq.create (v (nlimb s)) (limb_zero s)) /\ as_nat h1 f == 0)
[]
Hacl.Impl.Curve25519.Fields.create_felem
{ "file_name": "code/curve25519/Hacl.Impl.Curve25519.Fields.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> FStar.HyperStack.ST.StackInline (Hacl.Impl.Curve25519.Fields.Core.felem s)
{ "end_col": 43, "end_line": 34, "start_col": 2, "start_line": 32 }
FStar.HyperStack.ST.Stack
val load_felem: #s:field_spec -> f:felem s -> u64s:lbuffer uint64 4ul -> Stack unit (requires fun h -> live h f /\ live h u64s /\ disjoint f u64s /\ v (LSeq.index (as_seq h u64s) 3) < pow2 63) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ state_inv_t h1 f /\ as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s))
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64", "short_module": "F64" }, { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field51", "short_module": "F51" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields.Core", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "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 load_felem #s f b = match s with | M51 -> F51.load_felem f b | M64 -> F64.load_felem f b
val load_felem: #s:field_spec -> f:felem s -> u64s:lbuffer uint64 4ul -> Stack unit (requires fun h -> live h f /\ live h u64s /\ disjoint f u64s /\ v (LSeq.index (as_seq h u64s) 3) < pow2 63) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ state_inv_t h1 f /\ as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s)) let load_felem #s f b =
true
null
false
match s with | M51 -> F51.load_felem f b | M64 -> F64.load_felem f b
{ "checked_file": "Hacl.Impl.Curve25519.Fields.fst.checked", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Meta.Attribute.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Curve25519.Fields.Core.fsti.checked", "Hacl.Impl.Curve25519.Field64.fst.checked", "Hacl.Impl.Curve25519.Field51.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Curve25519.Fields.fst" }
[]
[ "Hacl.Impl.Curve25519.Fields.Core.field_spec", "Hacl.Impl.Curve25519.Fields.Core.felem", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Hacl.Impl.Curve25519.Field51.load_felem", "Prims.unit", "Hacl.Impl.Curve25519.Field64.load_felem" ]
[]
module Hacl.Impl.Curve25519.Fields open FStar.HyperStack open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.Buffer include Hacl.Impl.Curve25519.Fields.Core module ST = FStar.HyperStack.ST module BSeq = Lib.ByteSequence module LSeq = Lib.Sequence module P = Spec.Curve25519 module F51 = Hacl.Impl.Curve25519.Field51 module F64 = Hacl.Impl.Curve25519.Field64 #set-options "--z3rlimit 50 --max_fuel 0 --initial_ifuel 1 --max_ifuel 1 --record_options" inline_for_extraction noextract val create_felem: s:field_spec -> StackInline (felem s) (requires fun h -> True) (ensures fun h0 f h1 -> stack_allocated f h0 h1 (LSeq.create (v (nlimb s)) (limb_zero s)) /\ as_nat h1 f == 0) let create_felem s = match s with | M51 -> (F51.create_felem ()) <: felem s | M64 -> (F64.create_felem ()) <: felem s inline_for_extraction noextract val load_felem: #s:field_spec -> f:felem s -> u64s:lbuffer uint64 4ul -> Stack unit (requires fun h -> live h f /\ live h u64s /\ disjoint f u64s /\ v (LSeq.index (as_seq h u64s) 3) < pow2 63) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ state_inv_t h1 f /\ as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s))
false
false
Hacl.Impl.Curve25519.Fields.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val load_felem: #s:field_spec -> f:felem s -> u64s:lbuffer uint64 4ul -> Stack unit (requires fun h -> live h f /\ live h u64s /\ disjoint f u64s /\ v (LSeq.index (as_seq h u64s) 3) < pow2 63) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ state_inv_t h1 f /\ as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s))
[]
Hacl.Impl.Curve25519.Fields.load_felem
{ "file_name": "code/curve25519/Hacl.Impl.Curve25519.Fields.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
f: Hacl.Impl.Curve25519.Fields.Core.felem s -> u64s: Lib.Buffer.lbuffer Lib.IntTypes.uint64 4ul -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 29, "end_line": 51, "start_col": 2, "start_line": 49 }
FStar.HyperStack.ST.Stack
val store_felem: #s:field_spec -> b:lbuffer uint64 4ul -> f:felem s -> Stack unit (requires fun h -> live h f /\ live h b /\ disjoint f b /\ state_inv_t h f) (ensures fun h0 _ h1 -> modifies (loc b |+| loc f) h0 h1 /\ as_seq h1 b == BSeq.nat_to_intseq_le 4 (feval h0 f))
[ { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field64", "short_module": "F64" }, { "abbrev": true, "full_module": "Hacl.Impl.Curve25519.Field51", "short_module": "F51" }, { "abbrev": true, "full_module": "Spec.Curve25519", "short_module": "P" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": true, "full_module": "Lib.ByteSequence", "short_module": "BSeq" }, { "abbrev": true, "full_module": "FStar.HyperStack.ST", "short_module": "ST" }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519.Fields.Core", "short_module": null }, { "abbrev": false, "full_module": "Lib.Buffer", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack.All", "short_module": null }, { "abbrev": false, "full_module": "FStar.HyperStack", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Impl.Curve25519", "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 store_felem #s b f = match s with | M51 -> F51.store_felem b f | M64 -> F64.store_felem b f
val store_felem: #s:field_spec -> b:lbuffer uint64 4ul -> f:felem s -> Stack unit (requires fun h -> live h f /\ live h b /\ disjoint f b /\ state_inv_t h f) (ensures fun h0 _ h1 -> modifies (loc b |+| loc f) h0 h1 /\ as_seq h1 b == BSeq.nat_to_intseq_le 4 (feval h0 f)) let store_felem #s b f =
true
null
false
match s with | M51 -> F51.store_felem b f | M64 -> F64.store_felem b f
{ "checked_file": "Hacl.Impl.Curve25519.Fields.fst.checked", "dependencies": [ "Spec.Curve25519.fst.checked", "prims.fst.checked", "Meta.Attribute.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "Lib.Buffer.fsti.checked", "Hacl.Impl.Curve25519.Fields.Core.fsti.checked", "Hacl.Impl.Curve25519.Field64.fst.checked", "Hacl.Impl.Curve25519.Field51.fst.checked", "FStar.UInt32.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.HyperStack.ST.fsti.checked", "FStar.HyperStack.All.fst.checked", "FStar.HyperStack.fst.checked" ], "interface_file": false, "source_file": "Hacl.Impl.Curve25519.Fields.fst" }
[]
[ "Hacl.Impl.Curve25519.Fields.Core.field_spec", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint64", "FStar.UInt32.__uint_to_t", "Hacl.Impl.Curve25519.Fields.Core.felem", "Hacl.Impl.Curve25519.Field51.store_felem", "Prims.unit", "Hacl.Impl.Curve25519.Field64.store_felem" ]
[]
module Hacl.Impl.Curve25519.Fields open FStar.HyperStack open FStar.HyperStack.All open FStar.Mul open Lib.IntTypes open Lib.Buffer include Hacl.Impl.Curve25519.Fields.Core module ST = FStar.HyperStack.ST module BSeq = Lib.ByteSequence module LSeq = Lib.Sequence module P = Spec.Curve25519 module F51 = Hacl.Impl.Curve25519.Field51 module F64 = Hacl.Impl.Curve25519.Field64 #set-options "--z3rlimit 50 --max_fuel 0 --initial_ifuel 1 --max_ifuel 1 --record_options" inline_for_extraction noextract val create_felem: s:field_spec -> StackInline (felem s) (requires fun h -> True) (ensures fun h0 f h1 -> stack_allocated f h0 h1 (LSeq.create (v (nlimb s)) (limb_zero s)) /\ as_nat h1 f == 0) let create_felem s = match s with | M51 -> (F51.create_felem ()) <: felem s | M64 -> (F64.create_felem ()) <: felem s inline_for_extraction noextract val load_felem: #s:field_spec -> f:felem s -> u64s:lbuffer uint64 4ul -> Stack unit (requires fun h -> live h f /\ live h u64s /\ disjoint f u64s /\ v (LSeq.index (as_seq h u64s) 3) < pow2 63) (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\ state_inv_t h1 f /\ as_nat h1 f == BSeq.nat_from_intseq_le (as_seq h0 u64s)) let load_felem #s f b = match s with | M51 -> F51.load_felem f b | M64 -> F64.load_felem f b val store_felem: #s:field_spec -> b:lbuffer uint64 4ul -> f:felem s -> Stack unit (requires fun h -> live h f /\ live h b /\ disjoint f b /\ state_inv_t h f) (ensures fun h0 _ h1 -> modifies (loc b |+| loc f) h0 h1 /\ as_seq h1 b == BSeq.nat_to_intseq_le 4 (feval h0 f)) [@ Meta.Attribute.specialize ]
false
false
Hacl.Impl.Curve25519.Fields.fst
{ "detail_errors": false, "detail_hint_replay": false, "initial_fuel": 2, "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": false, "z3cliopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3smtopt": [], "z3version": "4.8.5" }
null
val store_felem: #s:field_spec -> b:lbuffer uint64 4ul -> f:felem s -> Stack unit (requires fun h -> live h f /\ live h b /\ disjoint f b /\ state_inv_t h f) (ensures fun h0 _ h1 -> modifies (loc b |+| loc f) h0 h1 /\ as_seq h1 b == BSeq.nat_to_intseq_le 4 (feval h0 f))
[]
Hacl.Impl.Curve25519.Fields.store_felem
{ "file_name": "code/curve25519/Hacl.Impl.Curve25519.Fields.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
b: Lib.Buffer.lbuffer Lib.IntTypes.uint64 4ul -> f: Hacl.Impl.Curve25519.Fields.Core.felem s -> FStar.HyperStack.ST.Stack Prims.unit
{ "end_col": 30, "end_line": 67, "start_col": 2, "start_line": 65 }
Prims.Tot
val crypto_kem_enc: a:frodo_alg -> gen_a:frodo_gen_a -> state:Spec.Frodo.Random.state_t -> pk:lbytes (crypto_publickeybytes a) -> lbytes (crypto_ciphertextbytes a) & lbytes (crypto_bytes a)
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 crypto_kem_enc a gen_a state pk = let mu, _ = Spec.Frodo.Random.randombytes_ state (bytes_mu a) in crypto_kem_enc_ a gen_a mu pk
val crypto_kem_enc: a:frodo_alg -> gen_a:frodo_gen_a -> state:Spec.Frodo.Random.state_t -> pk:lbytes (crypto_publickeybytes a) -> lbytes (crypto_ciphertextbytes a) & lbytes (crypto_bytes a) let crypto_kem_enc a gen_a state pk =
false
null
false
let mu, _ = Spec.Frodo.Random.randombytes_ state (bytes_mu a) in crypto_kem_enc_ a gen_a mu pk
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Spec.Frodo.Params.frodo_gen_a", "Spec.Frodo.Random.state_t", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.crypto_publickeybytes", "Lib.Sequence.lseq", "Lib.IntTypes.uint8", "Spec.Frodo.Params.bytes_mu", "Spec.Frodo.KEM.Encaps.crypto_kem_enc_", "FStar.Pervasives.Native.tuple2", "Spec.Frodo.Params.crypto_ciphertextbytes", "Spec.Frodo.Params.crypto_bytes", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Frodo.Random.randombytes_" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1 val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix = let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix in let mu_encode = frodo_key_encode (params_logq a) (params_extracted_bits a) params_nbar mu in let v_matrix = Matrix.add v_matrix mu_encode in v_matrix val crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a) let crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix in let ct2 = frodo_pack (params_logq a) v_matrix in ct2 val get_sp_ep_epp_matrices: a:frodo_alg -> seed_se:lbytes (crypto_bytes a) -> matrix params_nbar (params_n a) & matrix params_nbar (params_n a) & matrix params_nbar params_nbar let get_sp_ep_epp_matrices a seed_se = let s_bytes_len = secretmatrixbytes_len a in let r = KG.frodo_shake_r a (u8 0x96) seed_se (2 * s_bytes_len + 2 * params_nbar * params_nbar) in let sp_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r 0 s_bytes_len) in let ep_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r s_bytes_len s_bytes_len) in let epp_matrix = frodo_sample_matrix a params_nbar params_nbar (LSeq.sub r (2 * s_bytes_len) (2 * params_nbar * params_nbar)) in sp_matrix, ep_matrix, epp_matrix val crypto_kem_enc_ct: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> seed_se:lbytes (crypto_bytes a) -> lbytes (crypto_ciphertextbytes a) let crypto_kem_enc_ct a gen_a mu pk seed_se = expand_crypto_publickeybytes a; let seed_a = LSeq.sub pk 0 bytes_seed_a in let b = LSeq.sub pk bytes_seed_a (publicmatrixbytes_len a) in let sp_matrix, ep_matrix, epp_matrix = get_sp_ep_epp_matrices a seed_se in let c1 = crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix in let c2 = crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix in expand_crypto_ciphertextbytes a; let ct = concat c1 c2 in ct val crypto_kem_enc_ss: a:frodo_alg -> k:lbytes (crypto_bytes a) -> ct:lbytes (crypto_ciphertextbytes a) -> lbytes (crypto_bytes a) let crypto_kem_enc_ss a k ct = let shake_input_ss = concat ct k in let ss = frodo_shake a (crypto_ciphertextbytes a + crypto_bytes a) shake_input_ss (crypto_bytes a) in ss val crypto_kem_enc_seed_se_k: a:frodo_alg -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (2 * crypto_bytes a) let crypto_kem_enc_seed_se_k a mu pk = let pkh = frodo_shake a (crypto_publickeybytes a) pk (bytes_pkhash a) in let pkh_mu = concat pkh mu in let seed_se_k = frodo_shake a (bytes_pkhash a + bytes_mu a) pkh_mu (2 * crypto_bytes a) in seed_se_k val crypto_kem_enc_: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (crypto_ciphertextbytes a) & lbytes (crypto_bytes a) let crypto_kem_enc_ a gen_a mu pk = let seed_se_k = crypto_kem_enc_seed_se_k a mu pk in let seed_se = LSeq.sub seed_se_k 0 (crypto_bytes a) in let k = LSeq.sub seed_se_k (crypto_bytes a) (crypto_bytes a) in let ct = crypto_kem_enc_ct a gen_a mu pk seed_se in let ss = crypto_kem_enc_ss a k ct in ct, ss val crypto_kem_enc: a:frodo_alg -> gen_a:frodo_gen_a -> state:Spec.Frodo.Random.state_t -> pk:lbytes (crypto_publickeybytes a) -> lbytes (crypto_ciphertextbytes a) & lbytes (crypto_bytes a)
false
false
Spec.Frodo.KEM.Encaps.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 crypto_kem_enc: a:frodo_alg -> gen_a:frodo_gen_a -> state:Spec.Frodo.Random.state_t -> pk:lbytes (crypto_publickeybytes a) -> lbytes (crypto_ciphertextbytes a) & lbytes (crypto_bytes a)
[]
Spec.Frodo.KEM.Encaps.crypto_kem_enc
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> gen_a: Spec.Frodo.Params.frodo_gen_a -> state: Spec.Frodo.Random.state_t -> pk: Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_publickeybytes a) -> Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_ciphertextbytes a) * Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_bytes a)
{ "end_col": 31, "end_line": 178, "start_col": 37, "start_line": 176 }
Prims.Tot
val crypto_kem_enc_ss: a:frodo_alg -> k:lbytes (crypto_bytes a) -> ct:lbytes (crypto_ciphertextbytes a) -> lbytes (crypto_bytes a)
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 crypto_kem_enc_ss a k ct = let shake_input_ss = concat ct k in let ss = frodo_shake a (crypto_ciphertextbytes a + crypto_bytes a) shake_input_ss (crypto_bytes a) in ss
val crypto_kem_enc_ss: a:frodo_alg -> k:lbytes (crypto_bytes a) -> ct:lbytes (crypto_ciphertextbytes a) -> lbytes (crypto_bytes a) let crypto_kem_enc_ss a k ct =
false
null
false
let shake_input_ss = concat ct k in let ss = frodo_shake a (crypto_ciphertextbytes a + crypto_bytes a) shake_input_ss (crypto_bytes a) in ss
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.crypto_bytes", "Spec.Frodo.Params.crypto_ciphertextbytes", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Frodo.Params.frodo_shake", "Prims.op_Addition", "Prims.eq2", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.append", "Lib.Sequence.concat", "Lib.IntTypes.uint_t" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1 val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix = let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix in let mu_encode = frodo_key_encode (params_logq a) (params_extracted_bits a) params_nbar mu in let v_matrix = Matrix.add v_matrix mu_encode in v_matrix val crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a) let crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix in let ct2 = frodo_pack (params_logq a) v_matrix in ct2 val get_sp_ep_epp_matrices: a:frodo_alg -> seed_se:lbytes (crypto_bytes a) -> matrix params_nbar (params_n a) & matrix params_nbar (params_n a) & matrix params_nbar params_nbar let get_sp_ep_epp_matrices a seed_se = let s_bytes_len = secretmatrixbytes_len a in let r = KG.frodo_shake_r a (u8 0x96) seed_se (2 * s_bytes_len + 2 * params_nbar * params_nbar) in let sp_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r 0 s_bytes_len) in let ep_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r s_bytes_len s_bytes_len) in let epp_matrix = frodo_sample_matrix a params_nbar params_nbar (LSeq.sub r (2 * s_bytes_len) (2 * params_nbar * params_nbar)) in sp_matrix, ep_matrix, epp_matrix val crypto_kem_enc_ct: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> seed_se:lbytes (crypto_bytes a) -> lbytes (crypto_ciphertextbytes a) let crypto_kem_enc_ct a gen_a mu pk seed_se = expand_crypto_publickeybytes a; let seed_a = LSeq.sub pk 0 bytes_seed_a in let b = LSeq.sub pk bytes_seed_a (publicmatrixbytes_len a) in let sp_matrix, ep_matrix, epp_matrix = get_sp_ep_epp_matrices a seed_se in let c1 = crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix in let c2 = crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix in expand_crypto_ciphertextbytes a; let ct = concat c1 c2 in ct val crypto_kem_enc_ss: a:frodo_alg -> k:lbytes (crypto_bytes a) -> ct:lbytes (crypto_ciphertextbytes a) -> lbytes (crypto_bytes a)
false
false
Spec.Frodo.KEM.Encaps.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 crypto_kem_enc_ss: a:frodo_alg -> k:lbytes (crypto_bytes a) -> ct:lbytes (crypto_ciphertextbytes a) -> lbytes (crypto_bytes a)
[]
Spec.Frodo.KEM.Encaps.crypto_kem_enc_ss
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> k: Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_bytes a) -> ct: Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_ciphertextbytes a) -> Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_bytes a)
{ "end_col": 4, "end_line": 136, "start_col": 30, "start_line": 133 }
Prims.Tot
val crypto_kem_enc_: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (crypto_ciphertextbytes a) & lbytes (crypto_bytes a)
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 crypto_kem_enc_ a gen_a mu pk = let seed_se_k = crypto_kem_enc_seed_se_k a mu pk in let seed_se = LSeq.sub seed_se_k 0 (crypto_bytes a) in let k = LSeq.sub seed_se_k (crypto_bytes a) (crypto_bytes a) in let ct = crypto_kem_enc_ct a gen_a mu pk seed_se in let ss = crypto_kem_enc_ss a k ct in ct, ss
val crypto_kem_enc_: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (crypto_ciphertextbytes a) & lbytes (crypto_bytes a) let crypto_kem_enc_ a gen_a mu pk =
false
null
false
let seed_se_k = crypto_kem_enc_seed_se_k a mu pk in let seed_se = LSeq.sub seed_se_k 0 (crypto_bytes a) in let k = LSeq.sub seed_se_k (crypto_bytes a) (crypto_bytes a) in let ct = crypto_kem_enc_ct a gen_a mu pk seed_se in let ss = crypto_kem_enc_ss a k ct in ct, ss
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Spec.Frodo.Params.frodo_gen_a", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.bytes_mu", "Spec.Frodo.Params.crypto_publickeybytes", "FStar.Pervasives.Native.Mktuple2", "Spec.Frodo.Params.crypto_ciphertextbytes", "Spec.Frodo.Params.crypto_bytes", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Spec.Frodo.KEM.Encaps.crypto_kem_enc_ss", "Spec.Frodo.KEM.Encaps.crypto_kem_enc_ct", "Prims.l_and", "Prims.eq2", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.slice", "Prims.op_Multiply", "Prims.op_Addition", "Prims.l_Forall", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Prims.l_or", "FStar.Seq.Base.index", "Lib.Sequence.index", "Lib.Sequence.sub", "Lib.IntTypes.uint_t", "FStar.Mul.op_Star", "Spec.Frodo.KEM.Encaps.crypto_kem_enc_seed_se_k", "FStar.Pervasives.Native.tuple2" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1 val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix = let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix in let mu_encode = frodo_key_encode (params_logq a) (params_extracted_bits a) params_nbar mu in let v_matrix = Matrix.add v_matrix mu_encode in v_matrix val crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a) let crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix in let ct2 = frodo_pack (params_logq a) v_matrix in ct2 val get_sp_ep_epp_matrices: a:frodo_alg -> seed_se:lbytes (crypto_bytes a) -> matrix params_nbar (params_n a) & matrix params_nbar (params_n a) & matrix params_nbar params_nbar let get_sp_ep_epp_matrices a seed_se = let s_bytes_len = secretmatrixbytes_len a in let r = KG.frodo_shake_r a (u8 0x96) seed_se (2 * s_bytes_len + 2 * params_nbar * params_nbar) in let sp_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r 0 s_bytes_len) in let ep_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r s_bytes_len s_bytes_len) in let epp_matrix = frodo_sample_matrix a params_nbar params_nbar (LSeq.sub r (2 * s_bytes_len) (2 * params_nbar * params_nbar)) in sp_matrix, ep_matrix, epp_matrix val crypto_kem_enc_ct: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> seed_se:lbytes (crypto_bytes a) -> lbytes (crypto_ciphertextbytes a) let crypto_kem_enc_ct a gen_a mu pk seed_se = expand_crypto_publickeybytes a; let seed_a = LSeq.sub pk 0 bytes_seed_a in let b = LSeq.sub pk bytes_seed_a (publicmatrixbytes_len a) in let sp_matrix, ep_matrix, epp_matrix = get_sp_ep_epp_matrices a seed_se in let c1 = crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix in let c2 = crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix in expand_crypto_ciphertextbytes a; let ct = concat c1 c2 in ct val crypto_kem_enc_ss: a:frodo_alg -> k:lbytes (crypto_bytes a) -> ct:lbytes (crypto_ciphertextbytes a) -> lbytes (crypto_bytes a) let crypto_kem_enc_ss a k ct = let shake_input_ss = concat ct k in let ss = frodo_shake a (crypto_ciphertextbytes a + crypto_bytes a) shake_input_ss (crypto_bytes a) in ss val crypto_kem_enc_seed_se_k: a:frodo_alg -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (2 * crypto_bytes a) let crypto_kem_enc_seed_se_k a mu pk = let pkh = frodo_shake a (crypto_publickeybytes a) pk (bytes_pkhash a) in let pkh_mu = concat pkh mu in let seed_se_k = frodo_shake a (bytes_pkhash a + bytes_mu a) pkh_mu (2 * crypto_bytes a) in seed_se_k val crypto_kem_enc_: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (crypto_ciphertextbytes a) & lbytes (crypto_bytes a)
false
false
Spec.Frodo.KEM.Encaps.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 crypto_kem_enc_: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (crypto_ciphertextbytes a) & lbytes (crypto_bytes a)
[]
Spec.Frodo.KEM.Encaps.crypto_kem_enc_
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> gen_a: Spec.Frodo.Params.frodo_gen_a -> mu: Lib.ByteSequence.lbytes (Spec.Frodo.Params.bytes_mu a) -> pk: Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_publickeybytes a) -> Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_ciphertextbytes a) * Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_bytes a)
{ "end_col": 8, "end_line": 166, "start_col": 35, "start_line": 159 }
Prims.Tot
val crypto_kem_enc_seed_se_k: a:frodo_alg -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (2 * crypto_bytes a)
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 crypto_kem_enc_seed_se_k a mu pk = let pkh = frodo_shake a (crypto_publickeybytes a) pk (bytes_pkhash a) in let pkh_mu = concat pkh mu in let seed_se_k = frodo_shake a (bytes_pkhash a + bytes_mu a) pkh_mu (2 * crypto_bytes a) in seed_se_k
val crypto_kem_enc_seed_se_k: a:frodo_alg -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (2 * crypto_bytes a) let crypto_kem_enc_seed_se_k a mu pk =
false
null
false
let pkh = frodo_shake a (crypto_publickeybytes a) pk (bytes_pkhash a) in let pkh_mu = concat pkh mu in let seed_se_k = frodo_shake a (bytes_pkhash a + bytes_mu a) pkh_mu (2 * crypto_bytes a) in seed_se_k
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.bytes_mu", "Spec.Frodo.Params.crypto_publickeybytes", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.op_Multiply", "Spec.Frodo.Params.crypto_bytes", "Spec.Frodo.Params.frodo_shake", "Prims.op_Addition", "Spec.Frodo.Params.bytes_pkhash", "FStar.Mul.op_Star", "Prims.eq2", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.append", "Lib.Sequence.concat", "Lib.IntTypes.uint_t" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1 val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix = let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix in let mu_encode = frodo_key_encode (params_logq a) (params_extracted_bits a) params_nbar mu in let v_matrix = Matrix.add v_matrix mu_encode in v_matrix val crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a) let crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix in let ct2 = frodo_pack (params_logq a) v_matrix in ct2 val get_sp_ep_epp_matrices: a:frodo_alg -> seed_se:lbytes (crypto_bytes a) -> matrix params_nbar (params_n a) & matrix params_nbar (params_n a) & matrix params_nbar params_nbar let get_sp_ep_epp_matrices a seed_se = let s_bytes_len = secretmatrixbytes_len a in let r = KG.frodo_shake_r a (u8 0x96) seed_se (2 * s_bytes_len + 2 * params_nbar * params_nbar) in let sp_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r 0 s_bytes_len) in let ep_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r s_bytes_len s_bytes_len) in let epp_matrix = frodo_sample_matrix a params_nbar params_nbar (LSeq.sub r (2 * s_bytes_len) (2 * params_nbar * params_nbar)) in sp_matrix, ep_matrix, epp_matrix val crypto_kem_enc_ct: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> seed_se:lbytes (crypto_bytes a) -> lbytes (crypto_ciphertextbytes a) let crypto_kem_enc_ct a gen_a mu pk seed_se = expand_crypto_publickeybytes a; let seed_a = LSeq.sub pk 0 bytes_seed_a in let b = LSeq.sub pk bytes_seed_a (publicmatrixbytes_len a) in let sp_matrix, ep_matrix, epp_matrix = get_sp_ep_epp_matrices a seed_se in let c1 = crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix in let c2 = crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix in expand_crypto_ciphertextbytes a; let ct = concat c1 c2 in ct val crypto_kem_enc_ss: a:frodo_alg -> k:lbytes (crypto_bytes a) -> ct:lbytes (crypto_ciphertextbytes a) -> lbytes (crypto_bytes a) let crypto_kem_enc_ss a k ct = let shake_input_ss = concat ct k in let ss = frodo_shake a (crypto_ciphertextbytes a + crypto_bytes a) shake_input_ss (crypto_bytes a) in ss val crypto_kem_enc_seed_se_k: a:frodo_alg -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (2 * crypto_bytes a)
false
false
Spec.Frodo.KEM.Encaps.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 crypto_kem_enc_seed_se_k: a:frodo_alg -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> lbytes (2 * crypto_bytes a)
[]
Spec.Frodo.KEM.Encaps.crypto_kem_enc_seed_se_k
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> mu: Lib.ByteSequence.lbytes (Spec.Frodo.Params.bytes_mu a) -> pk: Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_publickeybytes a) -> Lib.ByteSequence.lbytes (2 * Spec.Frodo.Params.crypto_bytes a)
{ "end_col": 11, "end_line": 149, "start_col": 38, "start_line": 145 }
Prims.Tot
val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a)
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix
val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix =
false
null
false
let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Spec.Frodo.Params.frodo_gen_a", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.bytes_seed_a", "Spec.Matrix.matrix", "Spec.Frodo.Params.params_nbar", "Spec.Frodo.Params.params_n", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U16", "Lib.IntTypes.SEC", "Prims.op_Multiply", "Prims.l_Forall", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Prims.l_and", "Prims.op_LessThan", "Prims.eq2", "Spec.Matrix.mget", "Lib.IntTypes.add_mod", "Spec.Matrix.mul", "Spec.Matrix.add", "Spec.Frodo.Params.frodo_gen_matrix" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a)
false
false
Spec.Frodo.KEM.Encaps.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 frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a)
[]
Spec.Frodo.KEM.Encaps.frodo_mul_add_sa_plus_e
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> gen_a: Spec.Frodo.Params.frodo_gen_a -> seed_a: Lib.ByteSequence.lbytes Spec.Frodo.Params.bytes_seed_a -> sp_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a) -> ep_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a) -> Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a)
{ "end_col": 10, "end_line": 33, "start_col": 64, "start_line": 30 }
Prims.Tot
val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix = let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix
val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix =
false
null
false
let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.publicmatrixbytes_len", "Spec.Matrix.matrix", "Spec.Frodo.Params.params_nbar", "Spec.Frodo.Params.params_n", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U16", "Lib.IntTypes.SEC", "Prims.op_Multiply", "Prims.l_Forall", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Prims.l_and", "Prims.op_LessThan", "Prims.eq2", "Spec.Matrix.mget", "Lib.IntTypes.add_mod", "Spec.Matrix.mul", "Spec.Matrix.add", "Spec.Frodo.Pack.frodo_unpack", "Spec.Frodo.Params.params_logq" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1 val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar
false
false
Spec.Frodo.KEM.Encaps.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 frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar
[]
Spec.Frodo.KEM.Encaps.frodo_mul_add_sb_plus_e
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> b: Lib.ByteSequence.lbytes (Spec.Frodo.Params.publicmatrixbytes_len a) -> sp_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a) -> epp_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar Spec.Frodo.Params.params_nbar -> Spec.Matrix.matrix Spec.Frodo.Params.params_nbar Spec.Frodo.Params.params_nbar
{ "end_col": 10, "end_line": 60, "start_col": 54, "start_line": 57 }
Prims.Tot
val get_sp_ep_epp_matrices: a:frodo_alg -> seed_se:lbytes (crypto_bytes a) -> matrix params_nbar (params_n a) & matrix params_nbar (params_n a) & matrix params_nbar params_nbar
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "FStar.Pervasives", "short_module": null }, { "abbrev": false, "full_module": "Prims", "short_module": null }, { "abbrev": false, "full_module": "FStar", "short_module": null } ]
false
let get_sp_ep_epp_matrices a seed_se = let s_bytes_len = secretmatrixbytes_len a in let r = KG.frodo_shake_r a (u8 0x96) seed_se (2 * s_bytes_len + 2 * params_nbar * params_nbar) in let sp_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r 0 s_bytes_len) in let ep_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r s_bytes_len s_bytes_len) in let epp_matrix = frodo_sample_matrix a params_nbar params_nbar (LSeq.sub r (2 * s_bytes_len) (2 * params_nbar * params_nbar)) in sp_matrix, ep_matrix, epp_matrix
val get_sp_ep_epp_matrices: a:frodo_alg -> seed_se:lbytes (crypto_bytes a) -> matrix params_nbar (params_n a) & matrix params_nbar (params_n a) & matrix params_nbar params_nbar let get_sp_ep_epp_matrices a seed_se =
false
null
false
let s_bytes_len = secretmatrixbytes_len a in let r = KG.frodo_shake_r a (u8 0x96) seed_se (2 * s_bytes_len + (2 * params_nbar) * params_nbar) in let sp_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r 0 s_bytes_len) in let ep_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r s_bytes_len s_bytes_len) in let epp_matrix = frodo_sample_matrix a params_nbar params_nbar (LSeq.sub r (2 * s_bytes_len) ((2 * params_nbar) * params_nbar)) in sp_matrix, ep_matrix, epp_matrix
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.crypto_bytes", "FStar.Pervasives.Native.Mktuple3", "Spec.Matrix.matrix", "Spec.Frodo.Params.params_nbar", "Spec.Frodo.Params.params_n", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U16", "Lib.IntTypes.SEC", "Prims.op_Multiply", "Spec.Frodo.Sample.frodo_sample_matrix", "Lib.Sequence.sub", "Lib.IntTypes.uint_t", "Lib.IntTypes.U8", "Prims.op_Addition", "FStar.Mul.op_Star", "Spec.Frodo.KEM.KeyGen.frodo_shake_r", "Lib.IntTypes.u8", "Prims.pos", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Spec.Frodo.Params.secretmatrixbytes_len", "FStar.Pervasives.Native.tuple3" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1 val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix = let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix in let mu_encode = frodo_key_encode (params_logq a) (params_extracted_bits a) params_nbar mu in let v_matrix = Matrix.add v_matrix mu_encode in v_matrix val crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a) let crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix in let ct2 = frodo_pack (params_logq a) v_matrix in ct2 val get_sp_ep_epp_matrices: a:frodo_alg -> seed_se:lbytes (crypto_bytes a) -> matrix params_nbar (params_n a) & matrix params_nbar (params_n a) & matrix params_nbar params_nbar
false
false
Spec.Frodo.KEM.Encaps.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 get_sp_ep_epp_matrices: a:frodo_alg -> seed_se:lbytes (crypto_bytes a) -> matrix params_nbar (params_n a) & matrix params_nbar (params_n a) & matrix params_nbar params_nbar
[]
Spec.Frodo.KEM.Encaps.get_sp_ep_epp_matrices
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> seed_se: Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_bytes a) -> (Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a) * Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a)) * Spec.Matrix.matrix Spec.Frodo.Params.params_nbar Spec.Frodo.Params.params_nbar
{ "end_col": 34, "end_line": 103, "start_col": 38, "start_line": 97 }
Prims.Tot
val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix in let mu_encode = frodo_key_encode (params_logq a) (params_extracted_bits a) params_nbar mu in let v_matrix = Matrix.add v_matrix mu_encode in v_matrix
val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix =
false
null
false
let v_matrix = frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix in let mu_encode = frodo_key_encode (params_logq a) (params_extracted_bits a) params_nbar mu in let v_matrix = Matrix.add v_matrix mu_encode in v_matrix
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.bytes_mu", "Spec.Frodo.Params.publicmatrixbytes_len", "Spec.Matrix.matrix", "Spec.Frodo.Params.params_nbar", "Spec.Frodo.Params.params_n", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U16", "Lib.IntTypes.SEC", "Prims.op_Multiply", "Prims.l_Forall", "Prims.nat", "Prims.b2t", "Prims.op_LessThanOrEqual", "Prims.op_Subtraction", "Prims.pow2", "Prims.l_and", "Prims.op_LessThan", "Prims.eq2", "Spec.Matrix.mget", "Lib.IntTypes.add_mod", "Spec.Matrix.add", "Spec.Frodo.Encode.frodo_key_encode", "Spec.Frodo.Params.params_logq", "Spec.Frodo.Params.params_extracted_bits", "Spec.Frodo.KEM.Encaps.frodo_mul_add_sb_plus_e" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1 val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix = let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar
false
false
Spec.Frodo.KEM.Encaps.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 frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar
[]
Spec.Frodo.KEM.Encaps.frodo_mul_add_sb_plus_e_plus_mu
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> mu: Lib.ByteSequence.lbytes (Spec.Frodo.Params.bytes_mu a) -> b: Lib.ByteSequence.lbytes (Spec.Frodo.Params.publicmatrixbytes_len a) -> sp_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a) -> epp_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar Spec.Frodo.Params.params_nbar -> Spec.Matrix.matrix Spec.Frodo.Params.params_nbar Spec.Frodo.Params.params_nbar
{ "end_col": 10, "end_line": 75, "start_col": 65, "start_line": 71 }
Prims.Tot
val crypto_kem_enc_ct: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> seed_se:lbytes (crypto_bytes a) -> lbytes (crypto_ciphertextbytes a)
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 crypto_kem_enc_ct a gen_a mu pk seed_se = expand_crypto_publickeybytes a; let seed_a = LSeq.sub pk 0 bytes_seed_a in let b = LSeq.sub pk bytes_seed_a (publicmatrixbytes_len a) in let sp_matrix, ep_matrix, epp_matrix = get_sp_ep_epp_matrices a seed_se in let c1 = crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix in let c2 = crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix in expand_crypto_ciphertextbytes a; let ct = concat c1 c2 in ct
val crypto_kem_enc_ct: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> seed_se:lbytes (crypto_bytes a) -> lbytes (crypto_ciphertextbytes a) let crypto_kem_enc_ct a gen_a mu pk seed_se =
false
null
false
expand_crypto_publickeybytes a; let seed_a = LSeq.sub pk 0 bytes_seed_a in let b = LSeq.sub pk bytes_seed_a (publicmatrixbytes_len a) in let sp_matrix, ep_matrix, epp_matrix = get_sp_ep_epp_matrices a seed_se in let c1 = crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix in let c2 = crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix in expand_crypto_ciphertextbytes a; let ct = concat c1 c2 in ct
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Spec.Frodo.Params.frodo_gen_a", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.bytes_mu", "Spec.Frodo.Params.crypto_publickeybytes", "Spec.Frodo.Params.crypto_bytes", "Spec.Matrix.matrix", "Spec.Frodo.Params.params_nbar", "Spec.Frodo.Params.params_n", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.op_Addition", "Spec.Frodo.Params.ct1bytes_len", "Spec.Frodo.Params.ct2bytes_len", "Prims.eq2", "FStar.Seq.Base.seq", "Lib.Sequence.to_seq", "FStar.Seq.Base.append", "Lib.Sequence.concat", "Lib.IntTypes.uint_t", "Prims.unit", "Spec.Frodo.Params.expand_crypto_ciphertextbytes", "Spec.Frodo.KEM.Encaps.crypto_kem_enc_ct_pack_c2", "Spec.Frodo.KEM.Encaps.crypto_kem_enc_ct_pack_c1", "Spec.Frodo.Params.crypto_ciphertextbytes", "FStar.Pervasives.Native.tuple3", "Lib.IntTypes.U16", "Prims.op_Multiply", "Spec.Frodo.KEM.Encaps.get_sp_ep_epp_matrices", "Spec.Frodo.Params.publicmatrixbytes_len", "Prims.l_and", "FStar.Seq.Base.slice", "Spec.Frodo.Params.bytes_seed_a", "Prims.l_Forall", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Prims.l_or", "FStar.Seq.Base.index", "Lib.Sequence.index", "Lib.Sequence.sub", "Spec.Frodo.Params.expand_crypto_publickeybytes" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1 val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix = let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix in let mu_encode = frodo_key_encode (params_logq a) (params_extracted_bits a) params_nbar mu in let v_matrix = Matrix.add v_matrix mu_encode in v_matrix val crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a) let crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix in let ct2 = frodo_pack (params_logq a) v_matrix in ct2 val get_sp_ep_epp_matrices: a:frodo_alg -> seed_se:lbytes (crypto_bytes a) -> matrix params_nbar (params_n a) & matrix params_nbar (params_n a) & matrix params_nbar params_nbar let get_sp_ep_epp_matrices a seed_se = let s_bytes_len = secretmatrixbytes_len a in let r = KG.frodo_shake_r a (u8 0x96) seed_se (2 * s_bytes_len + 2 * params_nbar * params_nbar) in let sp_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r 0 s_bytes_len) in let ep_matrix = frodo_sample_matrix a params_nbar (params_n a) (LSeq.sub r s_bytes_len s_bytes_len) in let epp_matrix = frodo_sample_matrix a params_nbar params_nbar (LSeq.sub r (2 * s_bytes_len) (2 * params_nbar * params_nbar)) in sp_matrix, ep_matrix, epp_matrix val crypto_kem_enc_ct: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> seed_se:lbytes (crypto_bytes a) -> lbytes (crypto_ciphertextbytes a)
false
false
Spec.Frodo.KEM.Encaps.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 crypto_kem_enc_ct: a:frodo_alg -> gen_a:frodo_gen_a -> mu:lbytes (bytes_mu a) -> pk:lbytes (crypto_publickeybytes a) -> seed_se:lbytes (crypto_bytes a) -> lbytes (crypto_ciphertextbytes a)
[]
Spec.Frodo.KEM.Encaps.crypto_kem_enc_ct
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> gen_a: Spec.Frodo.Params.frodo_gen_a -> mu: Lib.ByteSequence.lbytes (Spec.Frodo.Params.bytes_mu a) -> pk: Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_publickeybytes a) -> seed_se: Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_bytes a) -> Lib.ByteSequence.lbytes (Spec.Frodo.Params.crypto_ciphertextbytes a)
{ "end_col": 4, "end_line": 124, "start_col": 2, "start_line": 115 }
Prims.Tot
val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a)
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1
val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix =
false
null
false
let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Spec.Frodo.Params.frodo_gen_a", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.bytes_seed_a", "Spec.Matrix.matrix", "Spec.Frodo.Params.params_nbar", "Spec.Frodo.Params.params_n", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.op_Multiply", "Spec.Frodo.Params.params_logq", "Prims.op_Division", "Spec.Frodo.Pack.frodo_pack", "Lib.IntTypes.U16", "Spec.Frodo.KEM.Encaps.frodo_mul_add_sa_plus_e", "Spec.Frodo.Params.ct1bytes_len" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a)
false
false
Spec.Frodo.KEM.Encaps.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 crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a)
[]
Spec.Frodo.KEM.Encaps.crypto_kem_enc_ct_pack_c1
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> gen_a: Spec.Frodo.Params.frodo_gen_a -> seed_a: Lib.ByteSequence.lbytes Spec.Frodo.Params.bytes_seed_a -> sp_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a) -> ep_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a) -> Lib.ByteSequence.lbytes (Spec.Frodo.Params.ct1bytes_len a)
{ "end_col": 5, "end_line": 47, "start_col": 66, "start_line": 44 }
Prims.Tot
val crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a)
[ { "abbrev": true, "full_module": "Spec.Frodo.KEM.KeyGen", "short_module": "KG" }, { "abbrev": true, "full_module": "Spec.Matrix", "short_module": "Matrix" }, { "abbrev": true, "full_module": "Lib.Sequence", "short_module": "LSeq" }, { "abbrev": false, "full_module": "Spec.Frodo.Sample", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Pack", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Encode", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Params", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.Lemmas", "short_module": null }, { "abbrev": false, "full_module": "Spec.Matrix", "short_module": null }, { "abbrev": false, "full_module": "Lib.ByteSequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.Sequence", "short_module": null }, { "abbrev": false, "full_module": "Lib.IntTypes", "short_module": null }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "short_module": null }, { "abbrev": false, "full_module": "Spec.Frodo.KEM", "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 crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix in let ct2 = frodo_pack (params_logq a) v_matrix in ct2
val crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a) let crypto_kem_enc_ct_pack_c2 a mu b sp_matrix epp_matrix =
false
null
false
let v_matrix = frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix in let ct2 = frodo_pack (params_logq a) v_matrix in ct2
{ "checked_file": "Spec.Frodo.KEM.Encaps.fst.checked", "dependencies": [ "Spec.Matrix.fst.checked", "Spec.Frodo.Sample.fst.checked", "Spec.Frodo.Random.fst.checked", "Spec.Frodo.Params.fst.checked", "Spec.Frodo.Pack.fst.checked", "Spec.Frodo.Lemmas.fst.checked", "Spec.Frodo.KEM.KeyGen.fst.checked", "Spec.Frodo.Encode.fst.checked", "prims.fst.checked", "Lib.Sequence.fsti.checked", "Lib.IntTypes.fsti.checked", "Lib.ByteSequence.fsti.checked", "FStar.Pervasives.Native.fst.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked" ], "interface_file": false, "source_file": "Spec.Frodo.KEM.Encaps.fst" }
[ "total" ]
[ "Spec.Frodo.Params.frodo_alg", "Lib.ByteSequence.lbytes", "Spec.Frodo.Params.bytes_mu", "Spec.Frodo.Params.publicmatrixbytes_len", "Spec.Matrix.matrix", "Spec.Frodo.Params.params_nbar", "Spec.Frodo.Params.params_n", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "Prims.op_Multiply", "Spec.Frodo.Params.params_logq", "Prims.op_Division", "Spec.Frodo.Pack.frodo_pack", "Lib.IntTypes.U16", "Spec.Frodo.KEM.Encaps.frodo_mul_add_sb_plus_e_plus_mu", "Spec.Frodo.Params.ct2bytes_len" ]
[]
module Spec.Frodo.KEM.Encaps open FStar.Mul open Lib.IntTypes open Lib.Sequence open Lib.ByteSequence open Spec.Matrix open Spec.Frodo.Lemmas open Spec.Frodo.Params open Spec.Frodo.Encode open Spec.Frodo.Pack open Spec.Frodo.Sample module LSeq = Lib.Sequence module Matrix = Spec.Matrix module KG = Spec.Frodo.KEM.KeyGen #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" val frodo_mul_add_sa_plus_e: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> matrix params_nbar (params_n a) let frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix = let a_matrix = frodo_gen_matrix gen_a (params_n a) seed_a in let b_matrix = Matrix.add (Matrix.mul sp_matrix a_matrix) ep_matrix in b_matrix val crypto_kem_enc_ct_pack_c1: a:frodo_alg -> gen_a:frodo_gen_a -> seed_a:lbytes bytes_seed_a -> sp_matrix:matrix params_nbar (params_n a) -> ep_matrix:matrix params_nbar (params_n a) -> lbytes (ct1bytes_len a) let crypto_kem_enc_ct_pack_c1 a gen_a seed_a sp_matrix ep_matrix = let bp_matrix = frodo_mul_add_sa_plus_e a gen_a seed_a sp_matrix ep_matrix in let ct1 = frodo_pack (params_logq a) bp_matrix in ct1 val frodo_mul_add_sb_plus_e: a:frodo_alg -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix = let b_matrix = frodo_unpack #(params_n a) #params_nbar (params_logq a) b in let v_matrix = Matrix.add (Matrix.mul sp_matrix b_matrix) epp_matrix in v_matrix val frodo_mul_add_sb_plus_e_plus_mu: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> matrix params_nbar params_nbar let frodo_mul_add_sb_plus_e_plus_mu a mu b sp_matrix epp_matrix = let v_matrix = frodo_mul_add_sb_plus_e a b sp_matrix epp_matrix in let mu_encode = frodo_key_encode (params_logq a) (params_extracted_bits a) params_nbar mu in let v_matrix = Matrix.add v_matrix mu_encode in v_matrix val crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a)
false
false
Spec.Frodo.KEM.Encaps.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 crypto_kem_enc_ct_pack_c2: a:frodo_alg -> mu:lbytes (bytes_mu a) -> b:lbytes (publicmatrixbytes_len a) -> sp_matrix:matrix params_nbar (params_n a) -> epp_matrix:matrix params_nbar params_nbar -> lbytes (ct2bytes_len a)
[]
Spec.Frodo.KEM.Encaps.crypto_kem_enc_ct_pack_c2
{ "file_name": "specs/frodo/Spec.Frodo.KEM.Encaps.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.Frodo.Params.frodo_alg -> mu: Lib.ByteSequence.lbytes (Spec.Frodo.Params.bytes_mu a) -> b: Lib.ByteSequence.lbytes (Spec.Frodo.Params.publicmatrixbytes_len a) -> sp_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar (Spec.Frodo.Params.params_n a) -> epp_matrix: Spec.Matrix.matrix Spec.Frodo.Params.params_nbar Spec.Frodo.Params.params_nbar -> Lib.ByteSequence.lbytes (Spec.Frodo.Params.ct2bytes_len a)
{ "end_col": 5, "end_line": 89, "start_col": 59, "start_line": 86 }
Prims.Tot
val qsquare_times (a: S.qelem) (b: nat) : S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 qsquare_times (a:S.qelem) (b:nat) : S.qelem = SE.exp_pow2 mk_nat_mod_concrete_ops a b
val qsquare_times (a: S.qelem) (b: nat) : S.qelem let qsquare_times (a: S.qelem) (b: nat) : S.qelem =
false
null
false
SE.exp_pow2 mk_nat_mod_concrete_ops a b
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Prims.nat", "Spec.Exponentiation.exp_pow2", "Hacl.Spec.K256.Qinv.mk_nat_mod_concrete_ops" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q let mk_to_nat_mod_comm_monoid : SE.to_comm_monoid S.qelem = { SE.a_spec = S.qelem; SE.comm_monoid = nat_mod_comm_monoid; SE.refl = (fun (x:S.qelem) -> x); } val one_mod : SE.one_st S.qelem mk_to_nat_mod_comm_monoid let one_mod _ = 1 val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid let mul_mod x y = S.qmul x y val sqr_mod : SE.sqr_st S.qelem mk_to_nat_mod_comm_monoid let sqr_mod x = S.qmul x x let mk_nat_mod_concrete_ops : SE.concrete_ops S.qelem = { SE.to = mk_to_nat_mod_comm_monoid; SE.one = one_mod; SE.mul = mul_mod; SE.sqr = sqr_mod; }
false
true
Hacl.Spec.K256.Qinv.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 qsquare_times (a: S.qelem) (b: nat) : S.qelem
[]
Hacl.Spec.K256.Qinv.qsquare_times
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
a: Spec.K256.PointOps.qelem -> b: Prims.nat -> Spec.K256.PointOps.qelem
{ "end_col": 41, "end_line": 37, "start_col": 2, "start_line": 37 }
Prims.Tot
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q
let nat_mod_comm_monoid =
false
null
false
M.mk_nat_mod_comm_monoid S.q
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Lib.NatMod.mk_nat_mod_comm_monoid", "Spec.K256.PointOps.q" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
false
true
Hacl.Spec.K256.Qinv.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 nat_mod_comm_monoid : Lib.Exponentiation.Definition.comm_monoid (Lib.NatMod.nat_mod Spec.K256.PointOps.q)
[]
Hacl.Spec.K256.Qinv.nat_mod_comm_monoid
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Lib.Exponentiation.Definition.comm_monoid (Lib.NatMod.nat_mod Spec.K256.PointOps.q)
{ "end_col": 54, "end_line": 12, "start_col": 26, "start_line": 12 }
Prims.Tot
val qinv_r2_r8 (r1 x_101 x_111 x_1011: S.qelem) : S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 qinv_r2_r8 r1 x_101 x_111 x_1011 = let r2 = S.qmul (qsquare_times r1 3) x_101 in let r3 = S.qmul (qsquare_times r2 4) x_111 in let r4 = S.qmul (qsquare_times r3 4) x_101 in let r5 = S.qmul (qsquare_times r4 5) x_1011 in let r6 = S.qmul (qsquare_times r5 4) x_1011 in let r7 = S.qmul (qsquare_times r6 4) x_111 in let r8 = S.qmul (qsquare_times r7 5) x_111 in r8
val qinv_r2_r8 (r1 x_101 x_111 x_1011: S.qelem) : S.qelem let qinv_r2_r8 r1 x_101 x_111 x_1011 =
false
null
false
let r2 = S.qmul (qsquare_times r1 3) x_101 in let r3 = S.qmul (qsquare_times r2 4) x_111 in let r4 = S.qmul (qsquare_times r3 4) x_101 in let r5 = S.qmul (qsquare_times r4 5) x_1011 in let r6 = S.qmul (qsquare_times r5 4) x_1011 in let r7 = S.qmul (qsquare_times r6 4) x_111 in let r8 = S.qmul (qsquare_times r7 5) x_111 in r8
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.qmul", "Hacl.Spec.K256.Qinv.qsquare_times" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q let mk_to_nat_mod_comm_monoid : SE.to_comm_monoid S.qelem = { SE.a_spec = S.qelem; SE.comm_monoid = nat_mod_comm_monoid; SE.refl = (fun (x:S.qelem) -> x); } val one_mod : SE.one_st S.qelem mk_to_nat_mod_comm_monoid let one_mod _ = 1 val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid let mul_mod x y = S.qmul x y val sqr_mod : SE.sqr_st S.qelem mk_to_nat_mod_comm_monoid let sqr_mod x = S.qmul x x let mk_nat_mod_concrete_ops : SE.concrete_ops S.qelem = { SE.to = mk_to_nat_mod_comm_monoid; SE.one = one_mod; SE.mul = mul_mod; SE.sqr = sqr_mod; } let qsquare_times (a:S.qelem) (b:nat) : S.qelem = SE.exp_pow2 mk_nat_mod_concrete_ops a b val qsquare_times_lemma: a:S.qelem -> b:nat -> Lemma (qsquare_times a b == M.pow a (pow2 b) % S.q) let qsquare_times_lemma a b = SE.exp_pow2_lemma mk_nat_mod_concrete_ops a b; LE.exp_pow2_lemma nat_mod_comm_monoid a b; assert (qsquare_times a b == LE.pow nat_mod_comm_monoid a (pow2 b)); M.lemma_pow_nat_mod_is_pow #S.q a (pow2 b) (** The algorithm is taken from https://briansmith.org/ecc-inversion-addition-chains-01 *) val qinv_r0_r1 (x14: S.qelem) : S.qelem let qinv_r0_r1 x14 = let x28 = S.qmul (qsquare_times x14 14) x14 in let x56 = S.qmul (qsquare_times x28 28) x28 in let r0 = S.qmul (qsquare_times x56 56) x56 in let r1 = S.qmul (qsquare_times r0 14) x14 in r1
false
true
Hacl.Spec.K256.Qinv.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 qinv_r2_r8 (r1 x_101 x_111 x_1011: S.qelem) : S.qelem
[]
Hacl.Spec.K256.Qinv.qinv_r2_r8
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r1: Spec.K256.PointOps.qelem -> x_101: Spec.K256.PointOps.qelem -> x_111: Spec.K256.PointOps.qelem -> x_1011: Spec.K256.PointOps.qelem -> Spec.K256.PointOps.qelem
{ "end_col": 4, "end_line": 71, "start_col": 38, "start_line": 63 }
Prims.Tot
val qinv_r0_r1 (x14: S.qelem) : S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 qinv_r0_r1 x14 = let x28 = S.qmul (qsquare_times x14 14) x14 in let x56 = S.qmul (qsquare_times x28 28) x28 in let r0 = S.qmul (qsquare_times x56 56) x56 in let r1 = S.qmul (qsquare_times r0 14) x14 in r1
val qinv_r0_r1 (x14: S.qelem) : S.qelem let qinv_r0_r1 x14 =
false
null
false
let x28 = S.qmul (qsquare_times x14 14) x14 in let x56 = S.qmul (qsquare_times x28 28) x28 in let r0 = S.qmul (qsquare_times x56 56) x56 in let r1 = S.qmul (qsquare_times r0 14) x14 in r1
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.qmul", "Hacl.Spec.K256.Qinv.qsquare_times" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q let mk_to_nat_mod_comm_monoid : SE.to_comm_monoid S.qelem = { SE.a_spec = S.qelem; SE.comm_monoid = nat_mod_comm_monoid; SE.refl = (fun (x:S.qelem) -> x); } val one_mod : SE.one_st S.qelem mk_to_nat_mod_comm_monoid let one_mod _ = 1 val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid let mul_mod x y = S.qmul x y val sqr_mod : SE.sqr_st S.qelem mk_to_nat_mod_comm_monoid let sqr_mod x = S.qmul x x let mk_nat_mod_concrete_ops : SE.concrete_ops S.qelem = { SE.to = mk_to_nat_mod_comm_monoid; SE.one = one_mod; SE.mul = mul_mod; SE.sqr = sqr_mod; } let qsquare_times (a:S.qelem) (b:nat) : S.qelem = SE.exp_pow2 mk_nat_mod_concrete_ops a b val qsquare_times_lemma: a:S.qelem -> b:nat -> Lemma (qsquare_times a b == M.pow a (pow2 b) % S.q) let qsquare_times_lemma a b = SE.exp_pow2_lemma mk_nat_mod_concrete_ops a b; LE.exp_pow2_lemma nat_mod_comm_monoid a b; assert (qsquare_times a b == LE.pow nat_mod_comm_monoid a (pow2 b)); M.lemma_pow_nat_mod_is_pow #S.q a (pow2 b) (** The algorithm is taken from https://briansmith.org/ecc-inversion-addition-chains-01 *)
false
true
Hacl.Spec.K256.Qinv.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 qinv_r0_r1 (x14: S.qelem) : S.qelem
[]
Hacl.Spec.K256.Qinv.qinv_r0_r1
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
x14: Spec.K256.PointOps.qelem -> Spec.K256.PointOps.qelem
{ "end_col": 4, "end_line": 59, "start_col": 20, "start_line": 54 }
Prims.Tot
val qinv_r24_r25 (r23 x_1 x6: S.qelem) : S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 qinv_r24_r25 r23 x_1 x6 = let r24 = S.qmul (qsquare_times r23 6) x_1 in let r25 = S.qmul (qsquare_times r24 8) x6 in r25
val qinv_r24_r25 (r23 x_1 x6: S.qelem) : S.qelem let qinv_r24_r25 r23 x_1 x6 =
false
null
false
let r24 = S.qmul (qsquare_times r23 6) x_1 in let r25 = S.qmul (qsquare_times r24 8) x6 in r25
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.qmul", "Hacl.Spec.K256.Qinv.qsquare_times" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q let mk_to_nat_mod_comm_monoid : SE.to_comm_monoid S.qelem = { SE.a_spec = S.qelem; SE.comm_monoid = nat_mod_comm_monoid; SE.refl = (fun (x:S.qelem) -> x); } val one_mod : SE.one_st S.qelem mk_to_nat_mod_comm_monoid let one_mod _ = 1 val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid let mul_mod x y = S.qmul x y val sqr_mod : SE.sqr_st S.qelem mk_to_nat_mod_comm_monoid let sqr_mod x = S.qmul x x let mk_nat_mod_concrete_ops : SE.concrete_ops S.qelem = { SE.to = mk_to_nat_mod_comm_monoid; SE.one = one_mod; SE.mul = mul_mod; SE.sqr = sqr_mod; } let qsquare_times (a:S.qelem) (b:nat) : S.qelem = SE.exp_pow2 mk_nat_mod_concrete_ops a b val qsquare_times_lemma: a:S.qelem -> b:nat -> Lemma (qsquare_times a b == M.pow a (pow2 b) % S.q) let qsquare_times_lemma a b = SE.exp_pow2_lemma mk_nat_mod_concrete_ops a b; LE.exp_pow2_lemma nat_mod_comm_monoid a b; assert (qsquare_times a b == LE.pow nat_mod_comm_monoid a (pow2 b)); M.lemma_pow_nat_mod_is_pow #S.q a (pow2 b) (** The algorithm is taken from https://briansmith.org/ecc-inversion-addition-chains-01 *) val qinv_r0_r1 (x14: S.qelem) : S.qelem let qinv_r0_r1 x14 = let x28 = S.qmul (qsquare_times x14 14) x14 in let x56 = S.qmul (qsquare_times x28 28) x28 in let r0 = S.qmul (qsquare_times x56 56) x56 in let r1 = S.qmul (qsquare_times r0 14) x14 in r1 val qinv_r2_r8 (r1 x_101 x_111 x_1011: S.qelem) : S.qelem let qinv_r2_r8 r1 x_101 x_111 x_1011 = let r2 = S.qmul (qsquare_times r1 3) x_101 in let r3 = S.qmul (qsquare_times r2 4) x_111 in let r4 = S.qmul (qsquare_times r3 4) x_101 in let r5 = S.qmul (qsquare_times r4 5) x_1011 in let r6 = S.qmul (qsquare_times r5 4) x_1011 in let r7 = S.qmul (qsquare_times r6 4) x_111 in let r8 = S.qmul (qsquare_times r7 5) x_111 in r8 val qinv_r9_r15 (r8 x_101 x_111 x_1001 x_1101: S.qelem) : S.qelem let qinv_r9_r15 r8 x_101 x_111 x_1001 x_1101 = let r9 = S.qmul (qsquare_times r8 6) x_1101 in let r10 = S.qmul (qsquare_times r9 4) x_101 in let r11 = S.qmul (qsquare_times r10 3) x_111 in let r12 = S.qmul (qsquare_times r11 5) x_1001 in let r13 = S.qmul (qsquare_times r12 6) x_101 in let r14 = S.qmul (qsquare_times r13 10) x_111 in let r15 = S.qmul (qsquare_times r14 4) x_111 in r15 val qinv_r16_r23 (r15 x8 x_11 x_1001 x_1011 x_1101: S.qelem) : S.qelem let qinv_r16_r23 r15 x8 x_11 x_1001 x_1011 x_1101 = let r16 = S.qmul (qsquare_times r15 9) x8 in let r17 = S.qmul (qsquare_times r16 5) x_1001 in let r18 = S.qmul (qsquare_times r17 6) x_1011 in let r19 = S.qmul (qsquare_times r18 4) x_1101 in let r20 = S.qmul (qsquare_times r19 5) x_11 in let r21 = S.qmul (qsquare_times r20 6) x_1101 in let r22 = S.qmul (qsquare_times r21 10) x_1101 in let r23 = S.qmul (qsquare_times r22 4) x_1001 in r23
false
true
Hacl.Spec.K256.Qinv.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 qinv_r24_r25 (r23 x_1 x6: S.qelem) : S.qelem
[]
Hacl.Spec.K256.Qinv.qinv_r24_r25
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r23: Spec.K256.PointOps.qelem -> x_1: Spec.K256.PointOps.qelem -> x6: Spec.K256.PointOps.qelem -> Spec.K256.PointOps.qelem
{ "end_col": 5, "end_line": 103, "start_col": 29, "start_line": 100 }
Prims.Tot
val qinv_r9_r15 (r8 x_101 x_111 x_1001 x_1101: S.qelem) : S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 qinv_r9_r15 r8 x_101 x_111 x_1001 x_1101 = let r9 = S.qmul (qsquare_times r8 6) x_1101 in let r10 = S.qmul (qsquare_times r9 4) x_101 in let r11 = S.qmul (qsquare_times r10 3) x_111 in let r12 = S.qmul (qsquare_times r11 5) x_1001 in let r13 = S.qmul (qsquare_times r12 6) x_101 in let r14 = S.qmul (qsquare_times r13 10) x_111 in let r15 = S.qmul (qsquare_times r14 4) x_111 in r15
val qinv_r9_r15 (r8 x_101 x_111 x_1001 x_1101: S.qelem) : S.qelem let qinv_r9_r15 r8 x_101 x_111 x_1001 x_1101 =
false
null
false
let r9 = S.qmul (qsquare_times r8 6) x_1101 in let r10 = S.qmul (qsquare_times r9 4) x_101 in let r11 = S.qmul (qsquare_times r10 3) x_111 in let r12 = S.qmul (qsquare_times r11 5) x_1001 in let r13 = S.qmul (qsquare_times r12 6) x_101 in let r14 = S.qmul (qsquare_times r13 10) x_111 in let r15 = S.qmul (qsquare_times r14 4) x_111 in r15
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.qmul", "Hacl.Spec.K256.Qinv.qsquare_times" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q let mk_to_nat_mod_comm_monoid : SE.to_comm_monoid S.qelem = { SE.a_spec = S.qelem; SE.comm_monoid = nat_mod_comm_monoid; SE.refl = (fun (x:S.qelem) -> x); } val one_mod : SE.one_st S.qelem mk_to_nat_mod_comm_monoid let one_mod _ = 1 val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid let mul_mod x y = S.qmul x y val sqr_mod : SE.sqr_st S.qelem mk_to_nat_mod_comm_monoid let sqr_mod x = S.qmul x x let mk_nat_mod_concrete_ops : SE.concrete_ops S.qelem = { SE.to = mk_to_nat_mod_comm_monoid; SE.one = one_mod; SE.mul = mul_mod; SE.sqr = sqr_mod; } let qsquare_times (a:S.qelem) (b:nat) : S.qelem = SE.exp_pow2 mk_nat_mod_concrete_ops a b val qsquare_times_lemma: a:S.qelem -> b:nat -> Lemma (qsquare_times a b == M.pow a (pow2 b) % S.q) let qsquare_times_lemma a b = SE.exp_pow2_lemma mk_nat_mod_concrete_ops a b; LE.exp_pow2_lemma nat_mod_comm_monoid a b; assert (qsquare_times a b == LE.pow nat_mod_comm_monoid a (pow2 b)); M.lemma_pow_nat_mod_is_pow #S.q a (pow2 b) (** The algorithm is taken from https://briansmith.org/ecc-inversion-addition-chains-01 *) val qinv_r0_r1 (x14: S.qelem) : S.qelem let qinv_r0_r1 x14 = let x28 = S.qmul (qsquare_times x14 14) x14 in let x56 = S.qmul (qsquare_times x28 28) x28 in let r0 = S.qmul (qsquare_times x56 56) x56 in let r1 = S.qmul (qsquare_times r0 14) x14 in r1 val qinv_r2_r8 (r1 x_101 x_111 x_1011: S.qelem) : S.qelem let qinv_r2_r8 r1 x_101 x_111 x_1011 = let r2 = S.qmul (qsquare_times r1 3) x_101 in let r3 = S.qmul (qsquare_times r2 4) x_111 in let r4 = S.qmul (qsquare_times r3 4) x_101 in let r5 = S.qmul (qsquare_times r4 5) x_1011 in let r6 = S.qmul (qsquare_times r5 4) x_1011 in let r7 = S.qmul (qsquare_times r6 4) x_111 in let r8 = S.qmul (qsquare_times r7 5) x_111 in r8
false
true
Hacl.Spec.K256.Qinv.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 qinv_r9_r15 (r8 x_101 x_111 x_1001 x_1101: S.qelem) : S.qelem
[]
Hacl.Spec.K256.Qinv.qinv_r9_r15
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r8: Spec.K256.PointOps.qelem -> x_101: Spec.K256.PointOps.qelem -> x_111: Spec.K256.PointOps.qelem -> x_1001: Spec.K256.PointOps.qelem -> x_1101: Spec.K256.PointOps.qelem -> Spec.K256.PointOps.qelem
{ "end_col": 5, "end_line": 83, "start_col": 46, "start_line": 75 }
Prims.Tot
val qinv_r0_r25 (x_1 x_11 x_101 x_111 x_1001 x_1011 x_1101: S.qelem) : S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 qinv_r0_r25 x_1 x_11 x_101 x_111 x_1001 x_1011 x_1101 = let x6 = S.qmul (qsquare_times x_1101 2) x_1011 in let x8 = S.qmul (qsquare_times x6 2) x_11 in let x14 = S.qmul (qsquare_times x8 6) x6 in let r1 = qinv_r0_r1 x14 in let r8 = qinv_r2_r8 r1 x_101 x_111 x_1011 in let r15 = qinv_r9_r15 r8 x_101 x_111 x_1001 x_1101 in let r23 = qinv_r16_r23 r15 x8 x_11 x_1001 x_1011 x_1101 in qinv_r24_r25 r23 x_1 x6
val qinv_r0_r25 (x_1 x_11 x_101 x_111 x_1001 x_1011 x_1101: S.qelem) : S.qelem let qinv_r0_r25 x_1 x_11 x_101 x_111 x_1001 x_1011 x_1101 =
false
null
false
let x6 = S.qmul (qsquare_times x_1101 2) x_1011 in let x8 = S.qmul (qsquare_times x6 2) x_11 in let x14 = S.qmul (qsquare_times x8 6) x6 in let r1 = qinv_r0_r1 x14 in let r8 = qinv_r2_r8 r1 x_101 x_111 x_1011 in let r15 = qinv_r9_r15 r8 x_101 x_111 x_1001 x_1101 in let r23 = qinv_r16_r23 r15 x8 x_11 x_1001 x_1011 x_1101 in qinv_r24_r25 r23 x_1 x6
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Hacl.Spec.K256.Qinv.qinv_r24_r25", "Hacl.Spec.K256.Qinv.qinv_r16_r23", "Hacl.Spec.K256.Qinv.qinv_r9_r15", "Hacl.Spec.K256.Qinv.qinv_r2_r8", "Hacl.Spec.K256.Qinv.qinv_r0_r1", "Spec.K256.PointOps.qmul", "Hacl.Spec.K256.Qinv.qsquare_times" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q let mk_to_nat_mod_comm_monoid : SE.to_comm_monoid S.qelem = { SE.a_spec = S.qelem; SE.comm_monoid = nat_mod_comm_monoid; SE.refl = (fun (x:S.qelem) -> x); } val one_mod : SE.one_st S.qelem mk_to_nat_mod_comm_monoid let one_mod _ = 1 val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid let mul_mod x y = S.qmul x y val sqr_mod : SE.sqr_st S.qelem mk_to_nat_mod_comm_monoid let sqr_mod x = S.qmul x x let mk_nat_mod_concrete_ops : SE.concrete_ops S.qelem = { SE.to = mk_to_nat_mod_comm_monoid; SE.one = one_mod; SE.mul = mul_mod; SE.sqr = sqr_mod; } let qsquare_times (a:S.qelem) (b:nat) : S.qelem = SE.exp_pow2 mk_nat_mod_concrete_ops a b val qsquare_times_lemma: a:S.qelem -> b:nat -> Lemma (qsquare_times a b == M.pow a (pow2 b) % S.q) let qsquare_times_lemma a b = SE.exp_pow2_lemma mk_nat_mod_concrete_ops a b; LE.exp_pow2_lemma nat_mod_comm_monoid a b; assert (qsquare_times a b == LE.pow nat_mod_comm_monoid a (pow2 b)); M.lemma_pow_nat_mod_is_pow #S.q a (pow2 b) (** The algorithm is taken from https://briansmith.org/ecc-inversion-addition-chains-01 *) val qinv_r0_r1 (x14: S.qelem) : S.qelem let qinv_r0_r1 x14 = let x28 = S.qmul (qsquare_times x14 14) x14 in let x56 = S.qmul (qsquare_times x28 28) x28 in let r0 = S.qmul (qsquare_times x56 56) x56 in let r1 = S.qmul (qsquare_times r0 14) x14 in r1 val qinv_r2_r8 (r1 x_101 x_111 x_1011: S.qelem) : S.qelem let qinv_r2_r8 r1 x_101 x_111 x_1011 = let r2 = S.qmul (qsquare_times r1 3) x_101 in let r3 = S.qmul (qsquare_times r2 4) x_111 in let r4 = S.qmul (qsquare_times r3 4) x_101 in let r5 = S.qmul (qsquare_times r4 5) x_1011 in let r6 = S.qmul (qsquare_times r5 4) x_1011 in let r7 = S.qmul (qsquare_times r6 4) x_111 in let r8 = S.qmul (qsquare_times r7 5) x_111 in r8 val qinv_r9_r15 (r8 x_101 x_111 x_1001 x_1101: S.qelem) : S.qelem let qinv_r9_r15 r8 x_101 x_111 x_1001 x_1101 = let r9 = S.qmul (qsquare_times r8 6) x_1101 in let r10 = S.qmul (qsquare_times r9 4) x_101 in let r11 = S.qmul (qsquare_times r10 3) x_111 in let r12 = S.qmul (qsquare_times r11 5) x_1001 in let r13 = S.qmul (qsquare_times r12 6) x_101 in let r14 = S.qmul (qsquare_times r13 10) x_111 in let r15 = S.qmul (qsquare_times r14 4) x_111 in r15 val qinv_r16_r23 (r15 x8 x_11 x_1001 x_1011 x_1101: S.qelem) : S.qelem let qinv_r16_r23 r15 x8 x_11 x_1001 x_1011 x_1101 = let r16 = S.qmul (qsquare_times r15 9) x8 in let r17 = S.qmul (qsquare_times r16 5) x_1001 in let r18 = S.qmul (qsquare_times r17 6) x_1011 in let r19 = S.qmul (qsquare_times r18 4) x_1101 in let r20 = S.qmul (qsquare_times r19 5) x_11 in let r21 = S.qmul (qsquare_times r20 6) x_1101 in let r22 = S.qmul (qsquare_times r21 10) x_1101 in let r23 = S.qmul (qsquare_times r22 4) x_1001 in r23 val qinv_r24_r25 (r23 x_1 x6: S.qelem) : S.qelem let qinv_r24_r25 r23 x_1 x6 = let r24 = S.qmul (qsquare_times r23 6) x_1 in let r25 = S.qmul (qsquare_times r24 8) x6 in r25
false
true
Hacl.Spec.K256.Qinv.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 qinv_r0_r25 (x_1 x_11 x_101 x_111 x_1001 x_1011 x_1101: S.qelem) : S.qelem
[]
Hacl.Spec.K256.Qinv.qinv_r0_r25
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
x_1: Spec.K256.PointOps.qelem -> x_11: Spec.K256.PointOps.qelem -> x_101: Spec.K256.PointOps.qelem -> x_111: Spec.K256.PointOps.qelem -> x_1001: Spec.K256.PointOps.qelem -> x_1011: Spec.K256.PointOps.qelem -> x_1101: Spec.K256.PointOps.qelem -> Spec.K256.PointOps.qelem
{ "end_col": 25, "end_line": 116, "start_col": 59, "start_line": 107 }
Prims.Tot
val qinv: f:S.qelem -> S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 qinv f = let x_1 = f in let x_10 = qsquare_times f 1 in let x_11 = S.qmul x_10 x_1 in let x_101 = S.qmul x_10 x_11 in let x_111 = S.qmul x_10 x_101 in let x_1001 = S.qmul x_10 x_111 in let x_1011 = S.qmul x_10 x_1001 in let x_1101 = S.qmul x_10 x_1011 in qinv_r0_r25 x_1 x_11 x_101 x_111 x_1001 x_1011 x_1101
val qinv: f:S.qelem -> S.qelem let qinv f =
false
null
false
let x_1 = f in let x_10 = qsquare_times f 1 in let x_11 = S.qmul x_10 x_1 in let x_101 = S.qmul x_10 x_11 in let x_111 = S.qmul x_10 x_101 in let x_1001 = S.qmul x_10 x_111 in let x_1011 = S.qmul x_10 x_1001 in let x_1101 = S.qmul x_10 x_1011 in qinv_r0_r25 x_1 x_11 x_101 x_111 x_1001 x_1011 x_1101
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Hacl.Spec.K256.Qinv.qinv_r0_r25", "Spec.K256.PointOps.qmul", "Hacl.Spec.K256.Qinv.qsquare_times" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q let mk_to_nat_mod_comm_monoid : SE.to_comm_monoid S.qelem = { SE.a_spec = S.qelem; SE.comm_monoid = nat_mod_comm_monoid; SE.refl = (fun (x:S.qelem) -> x); } val one_mod : SE.one_st S.qelem mk_to_nat_mod_comm_monoid let one_mod _ = 1 val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid let mul_mod x y = S.qmul x y val sqr_mod : SE.sqr_st S.qelem mk_to_nat_mod_comm_monoid let sqr_mod x = S.qmul x x let mk_nat_mod_concrete_ops : SE.concrete_ops S.qelem = { SE.to = mk_to_nat_mod_comm_monoid; SE.one = one_mod; SE.mul = mul_mod; SE.sqr = sqr_mod; } let qsquare_times (a:S.qelem) (b:nat) : S.qelem = SE.exp_pow2 mk_nat_mod_concrete_ops a b val qsquare_times_lemma: a:S.qelem -> b:nat -> Lemma (qsquare_times a b == M.pow a (pow2 b) % S.q) let qsquare_times_lemma a b = SE.exp_pow2_lemma mk_nat_mod_concrete_ops a b; LE.exp_pow2_lemma nat_mod_comm_monoid a b; assert (qsquare_times a b == LE.pow nat_mod_comm_monoid a (pow2 b)); M.lemma_pow_nat_mod_is_pow #S.q a (pow2 b) (** The algorithm is taken from https://briansmith.org/ecc-inversion-addition-chains-01 *) val qinv_r0_r1 (x14: S.qelem) : S.qelem let qinv_r0_r1 x14 = let x28 = S.qmul (qsquare_times x14 14) x14 in let x56 = S.qmul (qsquare_times x28 28) x28 in let r0 = S.qmul (qsquare_times x56 56) x56 in let r1 = S.qmul (qsquare_times r0 14) x14 in r1 val qinv_r2_r8 (r1 x_101 x_111 x_1011: S.qelem) : S.qelem let qinv_r2_r8 r1 x_101 x_111 x_1011 = let r2 = S.qmul (qsquare_times r1 3) x_101 in let r3 = S.qmul (qsquare_times r2 4) x_111 in let r4 = S.qmul (qsquare_times r3 4) x_101 in let r5 = S.qmul (qsquare_times r4 5) x_1011 in let r6 = S.qmul (qsquare_times r5 4) x_1011 in let r7 = S.qmul (qsquare_times r6 4) x_111 in let r8 = S.qmul (qsquare_times r7 5) x_111 in r8 val qinv_r9_r15 (r8 x_101 x_111 x_1001 x_1101: S.qelem) : S.qelem let qinv_r9_r15 r8 x_101 x_111 x_1001 x_1101 = let r9 = S.qmul (qsquare_times r8 6) x_1101 in let r10 = S.qmul (qsquare_times r9 4) x_101 in let r11 = S.qmul (qsquare_times r10 3) x_111 in let r12 = S.qmul (qsquare_times r11 5) x_1001 in let r13 = S.qmul (qsquare_times r12 6) x_101 in let r14 = S.qmul (qsquare_times r13 10) x_111 in let r15 = S.qmul (qsquare_times r14 4) x_111 in r15 val qinv_r16_r23 (r15 x8 x_11 x_1001 x_1011 x_1101: S.qelem) : S.qelem let qinv_r16_r23 r15 x8 x_11 x_1001 x_1011 x_1101 = let r16 = S.qmul (qsquare_times r15 9) x8 in let r17 = S.qmul (qsquare_times r16 5) x_1001 in let r18 = S.qmul (qsquare_times r17 6) x_1011 in let r19 = S.qmul (qsquare_times r18 4) x_1101 in let r20 = S.qmul (qsquare_times r19 5) x_11 in let r21 = S.qmul (qsquare_times r20 6) x_1101 in let r22 = S.qmul (qsquare_times r21 10) x_1101 in let r23 = S.qmul (qsquare_times r22 4) x_1001 in r23 val qinv_r24_r25 (r23 x_1 x6: S.qelem) : S.qelem let qinv_r24_r25 r23 x_1 x6 = let r24 = S.qmul (qsquare_times r23 6) x_1 in let r25 = S.qmul (qsquare_times r24 8) x6 in r25 val qinv_r0_r25 (x_1 x_11 x_101 x_111 x_1001 x_1011 x_1101: S.qelem) : S.qelem let qinv_r0_r25 x_1 x_11 x_101 x_111 x_1001 x_1011 x_1101 = let x6 = S.qmul (qsquare_times x_1101 2) x_1011 in let x8 = S.qmul (qsquare_times x6 2) x_11 in let x14 = S.qmul (qsquare_times x8 6) x6 in let r1 = qinv_r0_r1 x14 in let r8 = qinv_r2_r8 r1 x_101 x_111 x_1011 in let r15 = qinv_r9_r15 r8 x_101 x_111 x_1001 x_1101 in let r23 = qinv_r16_r23 r15 x8 x_11 x_1001 x_1011 x_1101 in qinv_r24_r25 r23 x_1 x6
false
true
Hacl.Spec.K256.Qinv.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 qinv: f:S.qelem -> S.qelem
[]
Hacl.Spec.K256.Qinv.qinv
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
f: Spec.K256.PointOps.qelem -> Spec.K256.PointOps.qelem
{ "end_col": 55, "end_line": 130, "start_col": 12, "start_line": 120 }
Prims.Tot
val qinv_r16_r23 (r15 x8 x_11 x_1001 x_1011 x_1101: S.qelem) : S.qelem
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 qinv_r16_r23 r15 x8 x_11 x_1001 x_1011 x_1101 = let r16 = S.qmul (qsquare_times r15 9) x8 in let r17 = S.qmul (qsquare_times r16 5) x_1001 in let r18 = S.qmul (qsquare_times r17 6) x_1011 in let r19 = S.qmul (qsquare_times r18 4) x_1101 in let r20 = S.qmul (qsquare_times r19 5) x_11 in let r21 = S.qmul (qsquare_times r20 6) x_1101 in let r22 = S.qmul (qsquare_times r21 10) x_1101 in let r23 = S.qmul (qsquare_times r22 4) x_1001 in r23
val qinv_r16_r23 (r15 x8 x_11 x_1001 x_1011 x_1101: S.qelem) : S.qelem let qinv_r16_r23 r15 x8 x_11 x_1001 x_1011 x_1101 =
false
null
false
let r16 = S.qmul (qsquare_times r15 9) x8 in let r17 = S.qmul (qsquare_times r16 5) x_1001 in let r18 = S.qmul (qsquare_times r17 6) x_1011 in let r19 = S.qmul (qsquare_times r18 4) x_1101 in let r20 = S.qmul (qsquare_times r19 5) x_11 in let r21 = S.qmul (qsquare_times r20 6) x_1101 in let r22 = S.qmul (qsquare_times r21 10) x_1101 in let r23 = S.qmul (qsquare_times r22 4) x_1001 in r23
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.qmul", "Hacl.Spec.K256.Qinv.qsquare_times" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q let mk_to_nat_mod_comm_monoid : SE.to_comm_monoid S.qelem = { SE.a_spec = S.qelem; SE.comm_monoid = nat_mod_comm_monoid; SE.refl = (fun (x:S.qelem) -> x); } val one_mod : SE.one_st S.qelem mk_to_nat_mod_comm_monoid let one_mod _ = 1 val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid let mul_mod x y = S.qmul x y val sqr_mod : SE.sqr_st S.qelem mk_to_nat_mod_comm_monoid let sqr_mod x = S.qmul x x let mk_nat_mod_concrete_ops : SE.concrete_ops S.qelem = { SE.to = mk_to_nat_mod_comm_monoid; SE.one = one_mod; SE.mul = mul_mod; SE.sqr = sqr_mod; } let qsquare_times (a:S.qelem) (b:nat) : S.qelem = SE.exp_pow2 mk_nat_mod_concrete_ops a b val qsquare_times_lemma: a:S.qelem -> b:nat -> Lemma (qsquare_times a b == M.pow a (pow2 b) % S.q) let qsquare_times_lemma a b = SE.exp_pow2_lemma mk_nat_mod_concrete_ops a b; LE.exp_pow2_lemma nat_mod_comm_monoid a b; assert (qsquare_times a b == LE.pow nat_mod_comm_monoid a (pow2 b)); M.lemma_pow_nat_mod_is_pow #S.q a (pow2 b) (** The algorithm is taken from https://briansmith.org/ecc-inversion-addition-chains-01 *) val qinv_r0_r1 (x14: S.qelem) : S.qelem let qinv_r0_r1 x14 = let x28 = S.qmul (qsquare_times x14 14) x14 in let x56 = S.qmul (qsquare_times x28 28) x28 in let r0 = S.qmul (qsquare_times x56 56) x56 in let r1 = S.qmul (qsquare_times r0 14) x14 in r1 val qinv_r2_r8 (r1 x_101 x_111 x_1011: S.qelem) : S.qelem let qinv_r2_r8 r1 x_101 x_111 x_1011 = let r2 = S.qmul (qsquare_times r1 3) x_101 in let r3 = S.qmul (qsquare_times r2 4) x_111 in let r4 = S.qmul (qsquare_times r3 4) x_101 in let r5 = S.qmul (qsquare_times r4 5) x_1011 in let r6 = S.qmul (qsquare_times r5 4) x_1011 in let r7 = S.qmul (qsquare_times r6 4) x_111 in let r8 = S.qmul (qsquare_times r7 5) x_111 in r8 val qinv_r9_r15 (r8 x_101 x_111 x_1001 x_1101: S.qelem) : S.qelem let qinv_r9_r15 r8 x_101 x_111 x_1001 x_1101 = let r9 = S.qmul (qsquare_times r8 6) x_1101 in let r10 = S.qmul (qsquare_times r9 4) x_101 in let r11 = S.qmul (qsquare_times r10 3) x_111 in let r12 = S.qmul (qsquare_times r11 5) x_1001 in let r13 = S.qmul (qsquare_times r12 6) x_101 in let r14 = S.qmul (qsquare_times r13 10) x_111 in let r15 = S.qmul (qsquare_times r14 4) x_111 in r15
false
true
Hacl.Spec.K256.Qinv.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 qinv_r16_r23 (r15 x8 x_11 x_1001 x_1011 x_1101: S.qelem) : S.qelem
[]
Hacl.Spec.K256.Qinv.qinv_r16_r23
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
r15: Spec.K256.PointOps.qelem -> x8: Spec.K256.PointOps.qelem -> x_11: Spec.K256.PointOps.qelem -> x_1001: Spec.K256.PointOps.qelem -> x_1011: Spec.K256.PointOps.qelem -> x_1101: Spec.K256.PointOps.qelem -> Spec.K256.PointOps.qelem
{ "end_col": 5, "end_line": 96, "start_col": 51, "start_line": 87 }
Prims.Tot
val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid
[ { "abbrev": true, "full_module": "Spec.K256", "short_module": "S" }, { "abbrev": true, "full_module": "Lib.NatMod", "short_module": "M" }, { "abbrev": true, "full_module": "Lib.Exponentiation", "short_module": "LE" }, { "abbrev": true, "full_module": "Spec.Exponentiation", "short_module": "SE" }, { "abbrev": false, "full_module": "FStar.Mul", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "short_module": null }, { "abbrev": false, "full_module": "Hacl.Spec.K256", "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 mul_mod x y = S.qmul x y
val mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid let mul_mod x y =
false
null
false
S.qmul x y
{ "checked_file": "Hacl.Spec.K256.Qinv.fst.checked", "dependencies": [ "Spec.K256.fst.checked", "Spec.Exponentiation.fsti.checked", "prims.fst.checked", "Lib.NatMod.fsti.checked", "Lib.Exponentiation.fsti.checked", "FStar.Pervasives.fsti.checked", "FStar.Mul.fst.checked", "FStar.Math.Lemmas.fst.checked", "FStar.Calc.fsti.checked" ], "interface_file": false, "source_file": "Hacl.Spec.K256.Qinv.fst" }
[ "total" ]
[ "Spec.K256.PointOps.qelem", "Spec.K256.PointOps.qmul" ]
[]
module Hacl.Spec.K256.Qinv open FStar.Mul module SE = Spec.Exponentiation module LE = Lib.Exponentiation module M = Lib.NatMod module S = Spec.K256 #set-options "--z3rlimit 50 --fuel 0 --ifuel 0" let nat_mod_comm_monoid = M.mk_nat_mod_comm_monoid S.q let mk_to_nat_mod_comm_monoid : SE.to_comm_monoid S.qelem = { SE.a_spec = S.qelem; SE.comm_monoid = nat_mod_comm_monoid; SE.refl = (fun (x:S.qelem) -> x); } val one_mod : SE.one_st S.qelem mk_to_nat_mod_comm_monoid let one_mod _ = 1
false
true
Hacl.Spec.K256.Qinv.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 mul_mod : SE.mul_st S.qelem mk_to_nat_mod_comm_monoid
[]
Hacl.Spec.K256.Qinv.mul_mod
{ "file_name": "code/k256/Hacl.Spec.K256.Qinv.fst", "git_rev": "12c5e9539c7e3c366c26409d3b86493548c4483e", "git_url": "https://github.com/hacl-star/hacl-star.git", "project_name": "hacl-star" }
Spec.Exponentiation.mul_st Spec.K256.PointOps.qelem Hacl.Spec.K256.Qinv.mk_to_nat_mod_comm_monoid
{ "end_col": 28, "end_line": 24, "start_col": 18, "start_line": 24 }