file_name
stringlengths 5
52
| name
stringlengths 4
95
| original_source_type
stringlengths 0
23k
| source_type
stringlengths 9
23k
| source_definition
stringlengths 9
57.9k
| source
dict | source_range
dict | file_context
stringlengths 0
721k
| dependencies
dict | opens_and_abbrevs
listlengths 2
94
| vconfig
dict | interleaved
bool 1
class | verbose_type
stringlengths 1
7.42k
| effect
stringclasses 118
values | effect_flags
sequencelengths 0
2
| mutual_with
sequencelengths 0
11
| ideal_premises
sequencelengths 0
236
| proof_features
sequencelengths 0
1
| is_simple_lemma
bool 2
classes | is_div
bool 2
classes | is_proof
bool 2
classes | is_simply_typed
bool 2
classes | is_type
bool 2
classes | partial_definition
stringlengths 5
3.99k
| completed_definiton
stringlengths 1
1.63M
| isa_cross_project_example
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Pulse.Checker.fst | Pulse.Checker.gen_names_for_unknowns | val gen_names_for_unknowns (g: env) (t: term) (ws: list term)
: T.Tac (list (nvar & term) & term & list term) | val gen_names_for_unknowns (g: env) (t: term) (ws: list term)
: T.Tac (list (nvar & term) & term & list term) | let rec gen_names_for_unknowns (g:env) (t:term) (ws:list term)
: T.Tac (list (nvar & term) & // new names with their types
term & // opened vprop
list term) // new list of witnesses with _ replaced with corresponding new names
= match ws with
| [] -> [], t, []
| w::ws ->
match t.t with
| Tm_ExistsSL _ b body ->
let xopt, w, g =
match w.t with
| Tm_Unknown ->
let x = fresh g in
Some x,
tm_var {nm_index=x;nm_ppname=b.binder_ppname},
push_binding g x b.binder_ppname b.binder_ty
| _ -> None, w, g in
let t : term = open_term' body w 0 in
let new_names, t, ws = gen_names_for_unknowns g t ws in
(match xopt with
| Some x ->
((b.binder_ppname, x), b.binder_ty)::new_names,
t,
w::ws
| None -> new_names, t, w::ws)
| _ -> fail g (Some t.range) "intro exists with non-existential" | {
"file_name": "lib/steel/pulse/Pulse.Checker.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 70,
"end_line": 84,
"start_col": 0,
"start_line": 59
} | (*
Copyright 2023 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 Pulse.Checker
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.Typing.Combinators
open Pulse.Checker.Pure
open Pulse.Checker.Bind
open Pulse.Checker.VPropEquiv
open Pulse.Checker.Base
module P = Pulse.Syntax.Printer
module RTB = FStar.Tactics.Builtins
module FV = Pulse.Typing.FV
module RU = Pulse.RuntimeUtils
module Metatheory = Pulse.Typing.Metatheory
module Abs = Pulse.Checker.Abs
module If = Pulse.Checker.If
module Bind = Pulse.Checker.Bind
module Match = Pulse.Checker.Match
module WithLocal = Pulse.Checker.WithLocal
module WithLocalArray = Pulse.Checker.WithLocalArray
module While = Pulse.Checker.While
module STApp = Pulse.Checker.STApp
module Exists = Pulse.Checker.Exists
module Par = Pulse.Checker.Par
module Admit = Pulse.Checker.Admit
module Return = Pulse.Checker.Return
module Rewrite = Pulse.Checker.Rewrite
module WithInv = Pulse.Checker.WithInv
let terms_to_string (t:list term)
: T.Tac string
= String.concat "\n" (T.map Pulse.Syntax.Printer.term_to_string t)
let default_binder_annot = mk_binder_ppname tm_unknown ppname_default | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.fsti.checked",
"Pulse.Typing.FV.fsti.checked",
"Pulse.Typing.Env.fsti.checked",
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.Printer.fsti.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Reflection.Util.fst.checked",
"Pulse.Checker.WithLocalArray.fsti.checked",
"Pulse.Checker.WithLocal.fsti.checked",
"Pulse.Checker.WithInv.fsti.checked",
"Pulse.Checker.While.fsti.checked",
"Pulse.Checker.VPropEquiv.fsti.checked",
"Pulse.Checker.Unreachable.fsti.checked",
"Pulse.Checker.STApp.fsti.checked",
"Pulse.Checker.Rewrite.fsti.checked",
"Pulse.Checker.Return.fsti.checked",
"Pulse.Checker.Pure.fsti.checked",
"Pulse.Checker.Prover.fsti.checked",
"Pulse.Checker.Par.fsti.checked",
"Pulse.Checker.Match.fsti.checked",
"Pulse.Checker.IntroPure.fsti.checked",
"Pulse.Checker.If.fsti.checked",
"Pulse.Checker.Exists.fsti.checked",
"Pulse.Checker.Bind.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"Pulse.Checker.AssertWithBinders.fsti.checked",
"Pulse.Checker.Admit.fsti.checked",
"Pulse.Checker.Abs.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Tactics.Builtins.fsti.checked",
"FStar.String.fsti.checked",
"FStar.Reflection.V2.fst.checked",
"FStar.Reflection.Typing.fsti.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Checker.WithInv",
"short_module": "WithInv"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Rewrite",
"short_module": "Rewrite"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Return",
"short_module": "Return"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Admit",
"short_module": "Admit"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Par",
"short_module": "Par"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Exists",
"short_module": "Exists"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.STApp",
"short_module": "STApp"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.While",
"short_module": "While"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.WithLocalArray",
"short_module": "WithLocalArray"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.WithLocal",
"short_module": "WithLocal"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Match",
"short_module": "Match"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Bind",
"short_module": "Bind"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.If",
"short_module": "If"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Abs",
"short_module": "Abs"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": true,
"full_module": "Pulse.Typing.FV",
"short_module": "FV"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.Builtins",
"short_module": "RTB"
},
{
"abbrev": true,
"full_module": "Pulse.Syntax.Printer",
"short_module": "P"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.VPropEquiv",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Bind",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Pure",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"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.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Elaborate.Pure",
"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",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term -> ws: Prims.list Pulse.Syntax.Base.term
-> FStar.Tactics.Effect.Tac
((Prims.list (Pulse.Syntax.Base.nvar * Pulse.Syntax.Base.term) * Pulse.Syntax.Base.term) *
Prims.list Pulse.Syntax.Base.term) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.term",
"Prims.list",
"FStar.Pervasives.Native.Mktuple3",
"FStar.Pervasives.Native.tuple2",
"Pulse.Syntax.Base.nvar",
"Prims.Nil",
"FStar.Pervasives.Native.tuple3",
"Pulse.Syntax.Base.__proj__Mkterm__item__t",
"Pulse.Syntax.Base.universe",
"Pulse.Syntax.Base.binder",
"FStar.Pervasives.Native.option",
"Pulse.Syntax.Base.var",
"Prims.Cons",
"FStar.Pervasives.Native.Mktuple2",
"Pulse.Syntax.Base.ppname",
"Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ppname",
"Pulse.Syntax.Base.__proj__Mkbinder__item__binder_ty",
"Pulse.Checker.gen_names_for_unknowns",
"Pulse.Syntax.Naming.open_term'",
"FStar.Pervasives.Native.Some",
"Pulse.Syntax.Pure.tm_var",
"Pulse.Syntax.Base.Mknm",
"Pulse.Typing.Env.push_binding",
"Prims.l_not",
"Prims.b2t",
"FStar.Set.mem",
"Pulse.Typing.Env.dom",
"Pulse.Typing.Env.fresh",
"Pulse.Syntax.Base.term'",
"FStar.Pervasives.Native.None",
"Pulse.Typing.Env.fail",
"Pulse.Syntax.Base.range",
"Pulse.Syntax.Base.__proj__Mkterm__item__range"
] | [
"recursion"
] | false | true | false | false | false | let rec gen_names_for_unknowns (g: env) (t: term) (ws: list term)
: T.Tac (list (nvar & term) & term & list term) =
| match ws with
| [] -> [], t, []
| w :: ws ->
match t.t with
| Tm_ExistsSL _ b body ->
let xopt, w, g =
match w.t with
| Tm_Unknown ->
let x = fresh g in
Some x,
tm_var ({ nm_index = x; nm_ppname = b.binder_ppname }),
push_binding g x b.binder_ppname b.binder_ty
| _ -> None, w, g
in
let t:term = open_term' body w 0 in
let new_names, t, ws = gen_names_for_unknowns g t ws in
(match xopt with
| Some x -> ((b.binder_ppname, x), b.binder_ty) :: new_names, t, w :: ws
| None -> new_names, t, w :: ws)
| _ -> fail g (Some t.range) "intro exists with non-existential" | false |
Pulse.Checker.Prover.Base.fst | Pulse.Checker.Prover.Base.elim_all | val elim_all
(#g: env)
(f: (vprop -> T.Tac bool))
(mk: mk_t)
(#ctxt #frame: term)
(ctxt_frame_typing: tot_typing g (tm_star ctxt frame) tm_vprop)
(uvs: env{disjoint uvs g})
: T.Tac
(bool &
(g': env{env_extends g' g /\ disjoint uvs g'} &
ctxt': term &
tot_typing g' (tm_star ctxt' frame) tm_vprop &
continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame))) | val elim_all
(#g: env)
(f: (vprop -> T.Tac bool))
(mk: mk_t)
(#ctxt #frame: term)
(ctxt_frame_typing: tot_typing g (tm_star ctxt frame) tm_vprop)
(uvs: env{disjoint uvs g})
: T.Tac
(bool &
(g': env{env_extends g' g /\ disjoint uvs g'} &
ctxt': term &
tot_typing g' (tm_star ctxt' frame) tm_vprop &
continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame))) | let rec elim_all (#g:env)
(f:vprop -> T.Tac bool)
(mk:mk_t)
(#ctxt:term) (#frame:term) (ctxt_frame_typing:tot_typing g (tm_star ctxt frame) tm_vprop)
(uvs:env { disjoint uvs g })
: T.Tac (bool &
(g':env { env_extends g' g /\ disjoint uvs g' } &
ctxt':term &
tot_typing g' (tm_star ctxt' frame) tm_vprop &
continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame)))
= match ctxt.t with
| Tm_Star ctxt' p ->
let p_typing =
star_typing_inversion_r #_ #ctxt' #p (star_typing_inversion_l ctxt_frame_typing) in
if f p
then match mk #_ #p p_typing with
| Some (| nx, e1, c1, e1_typing |) ->
let (| g', _, ctxt_typing', k |) =
elim_one ctxt' frame p (RU.magic ()) nx e1 c1 e1_typing uvs in
let k
: continuation_elaborator g (tm_star (tm_star ctxt' frame) p)
g' (tm_star _ frame) = k in
let k
: continuation_elaborator g (tm_star (tm_star ctxt' p) frame)
g' (tm_star _ frame) =
k_elab_equiv k
(RU.magic ()) (VE_Refl _ _) in
let _, (| g'', ctxt'', ctxt_typing'', k' |) =
elim_all #g' f mk ctxt_typing' uvs in
true, (| g'', ctxt'', ctxt_typing'', k_elab_trans k k' |)
| None ->
false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)
else begin
false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)
end
| _ ->
false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |) | {
"file_name": "lib/steel/pulse/Pulse.Checker.Prover.Base.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 63,
"end_line": 155,
"start_col": 0,
"start_line": 119
} | (*
Copyright 2023 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 Pulse.Checker.Prover.Base
open Pulse.Syntax
open Pulse.Typing
open Pulse.Checker.Base
open Pulse.Typing.Combinators
module RU = Pulse.RuntimeUtils
module T = FStar.Tactics.V2
module PS = Pulse.Checker.Prover.Substs
let rec list_as_vprop' (vp:vprop) (fvps:list vprop)
: Tot vprop (decreases fvps) =
match fvps with
| [] -> vp
| hd::tl -> list_as_vprop' (tm_star vp hd) tl
let rec canon_right_aux (g:env) (vps:list vprop) (f:vprop -> T.Tac bool)
: T.Tac (vps' : list vprop &
fvps : list vprop &
vprop_equiv g (list_as_vprop vps) (list_as_vprop' (list_as_vprop vps') fvps)) =
match vps with
| [] -> (| [], [], VE_Refl _ _ |)
| hd::rest ->
if f hd
then begin
let (| vps', fvps, _ |) = canon_right_aux g rest f in
let v_eq = RU.magic #(vprop_equiv _ _ _) () in
// let v_eq
// : vprop_equiv g (list_as_vprop vps)
// (list_as_vprop (hd :: (vps' @ fvps)))
// = list_as_vprop_ctx g [hd] _ rest (vps' @ fvps) (VE_Refl _ _) v_eq
// in
// let v_eq
// : vprop_equiv g (list_as_vprop vps)
// (list_as_vprop ((vps'@[hd]) @ fvps))
// = VE_Trans _ _ _ _ v_eq (VE_Sym _ _ _ (vprop_equiv_swap_equiv _ _ _ hd _ (VE_Refl _ _)))
// in
// let v_eq
// : vprop_equiv g (list_as_vprop vps)
// (list_as_vprop (vps'@(hd::fvps)))
// = VE_Trans _ _ _ _ v_eq (VE_Sym _ _ _ (list_as_vprop_assoc _ _ _ _)) in
(| vps', hd :: fvps, v_eq |)
end
else begin
let (| vps', pures, _ |) = canon_right_aux g rest f in
let v_eq = RU.magic #(vprop_equiv _ _ _ ) () in //list_as_vprop_ctx g [hd] _ _ _ (VE_Refl _ _) v_eq in
(| hd::vps', pures, v_eq |)
end
module VP = Pulse.Checker.VPropEquiv
let canon_right (#g:env) (#ctxt:term) (#frame:term)
(ctxt_frame_typing:tot_typing g (tm_star ctxt frame) tm_vprop)
(f:vprop -> T.Tac bool)
: T.Tac (ctxt':term &
tot_typing g (tm_star ctxt' frame) tm_vprop &
continuation_elaborator g (tm_star ctxt frame) g (tm_star ctxt' frame))
= let (| vps', pures, veq |) = canon_right_aux g (vprop_as_list ctxt) f in
let veq : vprop_equiv g ctxt (list_as_vprop' (list_as_vprop vps') pures)
= RU.magic () in
let veq : vprop_equiv g (tm_star ctxt frame) (tm_star (list_as_vprop' (list_as_vprop vps') pures) frame)
= VE_Ctxt _ _ _ _ _ veq (VE_Refl _ _) in
(| _, VP.vprop_equiv_typing_fwd ctxt_frame_typing veq, k_elab_equiv (k_elab_unit _ _) (VE_Refl _ _) veq |)
let elim_one (#g:env)
(ctxt:term) (frame:vprop) (p:vprop)
(ctxt_frame_p_typing:tot_typing g (tm_star (tm_star ctxt frame) p) tm_vprop)
(nx:ppname) (e1:st_term) (c1:comp { stateful_comp c1 /\ comp_pre c1 == p })
(e1_typing:st_typing g e1 c1)
(uvs:env { disjoint uvs g })
: T.Tac (g':env { env_extends g' g /\ disjoint uvs g' } &
ctxt':term &
tot_typing g' (tm_star ctxt' frame) tm_vprop &
continuation_elaborator g (tm_star (tm_star ctxt frame) p) g' (tm_star ctxt' frame)) =
let ctxt_frame_typing = star_typing_inversion_l ctxt_frame_p_typing in
let x = fresh (push_env g uvs) in
let k =
continuation_elaborator_with_bind (tm_star ctxt frame) e1_typing ctxt_frame_p_typing (nx, x) in
let g' = push_binding g x nx (comp_res c1) in
let ctxt' = tm_star (open_term_nv (comp_post c1) (nx, x)) ctxt in
let veq
: vprop_equiv g' (tm_star (open_term_nv (comp_post c1) (nx, x)) (tm_star ctxt frame))
(tm_star ctxt' frame) = VE_Assoc _ _ _ _ in
let k
: continuation_elaborator
g (tm_star (tm_star ctxt frame) p)
g' (tm_star ctxt' frame) =
k_elab_equiv
#g #g'
#(tm_star (tm_star ctxt frame) p)
#(tm_star (tm_star ctxt frame) p)
#(tm_star (open_term_nv (comp_post c1) (nx, x)) (tm_star ctxt frame))
#(tm_star ctxt' frame)
k (VE_Refl g (tm_star (tm_star ctxt frame) p)) veq in
let ctxt'_frame_typing : tot_typing g' (tm_star ctxt' frame) tm_vprop = RU.magic () in
env_extends_push g x ppname_default (comp_res c1);
(| g', ctxt', ctxt'_frame_typing, k |) | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Combinators.fsti.checked",
"Pulse.Typing.fst.checked",
"Pulse.Syntax.fst.checked",
"Pulse.RuntimeUtils.fsti.checked",
"Pulse.Checker.VPropEquiv.fsti.checked",
"Pulse.Checker.Prover.Substs.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Prover.Base.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Checker.VPropEquiv",
"short_module": "VP"
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Prover.Substs",
"short_module": "PS"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": true,
"full_module": "Pulse.RuntimeUtils",
"short_module": "RU"
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": true,
"full_module": "Pulse.Checker.Prover.Substs",
"short_module": "PS"
},
{
"abbrev": true,
"full_module": "FStar.Tactics.V2",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Syntax",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
f: (_: Pulse.Syntax.Base.vprop -> FStar.Tactics.Effect.Tac Prims.bool) ->
mk: Pulse.Checker.Prover.Base.mk_t ->
ctxt_frame_typing:
Pulse.Typing.tot_typing g (Pulse.Syntax.Base.tm_star ctxt frame) Pulse.Syntax.Base.tm_vprop ->
uvs: Pulse.Typing.Env.env{Pulse.Typing.Env.disjoint uvs g}
-> FStar.Tactics.Effect.Tac
(Prims.bool *
FStar.Pervasives.dtuple4 (g':
Pulse.Typing.Env.env
{Pulse.Typing.Env.env_extends g' g /\ Pulse.Typing.Env.disjoint uvs g'})
(fun _ -> Pulse.Syntax.Base.term)
(fun g' ctxt' ->
Pulse.Typing.tot_typing g'
(Pulse.Syntax.Base.tm_star ctxt' frame)
Pulse.Syntax.Base.tm_vprop)
(fun g' ctxt' _ ->
Pulse.Checker.Base.continuation_elaborator g
(Pulse.Syntax.Base.tm_star ctxt frame)
g'
(Pulse.Syntax.Base.tm_star ctxt' frame))) | FStar.Tactics.Effect.Tac | [] | [] | [
"Pulse.Typing.Env.env",
"Pulse.Syntax.Base.vprop",
"Prims.bool",
"Pulse.Checker.Prover.Base.mk_t",
"Pulse.Syntax.Base.term",
"Pulse.Typing.tot_typing",
"Pulse.Syntax.Base.tm_star",
"Pulse.Syntax.Base.tm_vprop",
"Pulse.Typing.Env.disjoint",
"Pulse.Syntax.Base.__proj__Mkterm__item__t",
"Pulse.Syntax.Base.ppname",
"Pulse.Syntax.Base.st_term",
"Pulse.Syntax.Base.comp",
"Prims.l_and",
"Prims.b2t",
"Pulse.Syntax.Base.stateful_comp",
"Prims.eq2",
"Pulse.Syntax.Base.comp_pre",
"Pulse.Typing.st_typing",
"Pulse.Typing.Env.env_extends",
"Pulse.Checker.Base.continuation_elaborator",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.dtuple4",
"FStar.Pervasives.Mkdtuple4",
"Pulse.Checker.Base.k_elab_trans",
"FStar.Pervasives.Native.tuple2",
"Pulse.Checker.Prover.Base.elim_all",
"Pulse.Checker.Base.k_elab_equiv",
"Pulse.RuntimeUtils.magic",
"Pulse.Typing.vprop_equiv",
"Pulse.Typing.VE_Refl",
"Pulse.Checker.Prover.Base.elim_one",
"Pulse.Checker.Base.k_elab_unit",
"FStar.Pervasives.Native.option",
"Pulse.Typing.star_typing_inversion_r",
"Pulse.Typing.star_typing_inversion_l",
"Pulse.Syntax.Base.term'"
] | [
"recursion"
] | false | true | false | false | false | let rec elim_all
(#g: env)
(f: (vprop -> T.Tac bool))
(mk: mk_t)
(#ctxt #frame: term)
(ctxt_frame_typing: tot_typing g (tm_star ctxt frame) tm_vprop)
(uvs: env{disjoint uvs g})
: T.Tac
(bool &
(g': env{env_extends g' g /\ disjoint uvs g'} &
ctxt': term &
tot_typing g' (tm_star ctxt' frame) tm_vprop &
continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame))) =
| match ctxt.t with
| Tm_Star ctxt' p ->
let p_typing = star_typing_inversion_r #_ #ctxt' #p (star_typing_inversion_l ctxt_frame_typing) in
if f p
then
match mk #_ #p p_typing with
| Some (| nx , e1 , c1 , e1_typing |) ->
let (| g' , _ , ctxt_typing' , k |) =
elim_one ctxt' frame p (RU.magic ()) nx e1 c1 e1_typing uvs
in
let k:continuation_elaborator g (tm_star (tm_star ctxt' frame) p) g' (tm_star _ frame) = k in
let k:continuation_elaborator g (tm_star (tm_star ctxt' p) frame) g' (tm_star _ frame) =
k_elab_equiv k (RU.magic ()) (VE_Refl _ _)
in
let _, (| g'' , ctxt'' , ctxt_typing'' , k' |) = elim_all #g' f mk ctxt_typing' uvs in
true, (| g'', ctxt'', ctxt_typing'', k_elab_trans k k' |)
| None -> false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)
else false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)
| _ -> false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |) | false |
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.update_multi_s | val update_multi_s : a: Hacl.Streaming.MD.alg ->
_: Prims.unit ->
acc: Spec.Hash.Definitions.words_state a ->
prevlen: Prims.nat ->
input: Spec.Hash.Definitions.bytes_blocks a
-> Spec.Hash.Definitions.words_state a | let update_multi_s (a : alg) () acc (prevlen : nat) input =
Agile.(update_multi a acc () input) | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 37,
"end_line": 54,
"start_col": 0,
"start_line": 53
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg
inline_for_extraction noextract
let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0
inline_for_extraction noextract
let state_t (a : alg) = stateful_buffer (word a) (D.impl_state_len (|a, ()|)) (init_elem a) unit | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Hacl.Streaming.MD.alg ->
_: Prims.unit ->
acc: Spec.Hash.Definitions.words_state a ->
prevlen: Prims.nat ->
input: Spec.Hash.Definitions.bytes_blocks a
-> Spec.Hash.Definitions.words_state a | Prims.Tot | [
"total"
] | [] | [
"Hacl.Streaming.MD.alg",
"Prims.unit",
"Spec.Hash.Definitions.words_state",
"Prims.nat",
"Spec.Hash.Definitions.bytes_blocks",
"Spec.Agile.Hash.update_multi"
] | [] | false | false | false | false | false | let update_multi_s (a: alg) () acc (prevlen: nat) input =
| let open Agile in update_multi a acc () input | false |
|
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind_t_at_most | val kind_t_at_most
: parser_kind false WeakKindStrongPrefix | val kind_t_at_most
: parser_kind false WeakKindStrongPrefix | let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 14,
"end_line": 94,
"start_col": 0,
"start_line": 92
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind false EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Kinds.kind_nlist",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind_t_at_most:parser_kind false WeakKindStrongPrefix =
| kind_nlist | false |
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.init_elem | val init_elem (a: alg) : word a | val init_elem (a: alg) : word a | let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0 | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 45,
"end_line": 47,
"start_col": 0,
"start_line": 44
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Hacl.Streaming.MD.alg -> Spec.Hash.Definitions.word a | Prims.Tot | [
"total"
] | [] | [
"Hacl.Streaming.MD.alg",
"Lib.IntTypes.u32",
"Lib.IntTypes.u64",
"Spec.Hash.Definitions.word"
] | [] | false | false | false | false | false | let init_elem (a: alg) : word a =
| match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0 | false |
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.hacl_sha2_512 | val hacl_sha2_512 : Hacl.Streaming.Interface.block Prims.unit | let hacl_sha2_512 = hacl_md SHA2_512 | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 195,
"start_col": 0,
"start_line": 195
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg
inline_for_extraction noextract
let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0
inline_for_extraction noextract
let state_t (a : alg) = stateful_buffer (word a) (D.impl_state_len (|a, ()|)) (init_elem a) unit
inline_for_extraction noextract
let update_multi_s (a : alg) () acc (prevlen : nat) input =
Agile.(update_multi a acc () input)
noextract
let update_multi_zero (a : alg) () acc (prevlen : nat) :
Lemma(update_multi_s a () acc prevlen S.empty == acc) = Spec.Hash.Lemmas.update_multi_zero a acc
#push-options "--ifuel 1"
// TODO: this is the third copy of this lemma!! why?!
noextract
let update_multi_associative (a : alg) () acc (prevlen1 prevlen2 : nat)
(input1 input2 : S.seq uint8) :
Lemma
(requires (
S.length input1 % U32.v (D.block_len a) = 0 /\
S.length input2 % U32.v (D.block_len a) = 0))
(ensures (
let input = S.append input1 input2 in
S.length input % U32.v (D.block_len a) = 0 /\
update_multi_s a () (update_multi_s a () acc prevlen1 input1) prevlen2 input2 ==
update_multi_s a () acc prevlen1 input)) =
Spec.Hash.Lemmas.update_multi_associative a acc input1 input2
#pop-options
inline_for_extraction noextract
let md_prevlen (a: alg) (len: D.(len: U64.t { U64.v len % U32.v (block_len a) = 0 })): D.prev_len_t a =
if a = SHA2_384 || a = SHA2_512 then FStar.Int.Cast.Full.uint64_to_uint128 len else len
/// This proof usually succeeds fast but we increase the rlimit for safety
#push-options "--z3rlimit 500 --ifuel 1"
inline_for_extraction noextract
let hacl_md (a:alg)// : block unit =
=
Block
Erased
(state_t a) (* state *)
(stateful_unused unit) (* key *)
unit
(fun () -> max_input_len64 a) (* max_input_len *)
(fun () () -> Spec.Hash.Definitions.hash_length a) (* output_len *)
(fun () -> Hacl.Hash.Definitions.block_len a) (* block_len *)
(fun () -> Hacl.Hash.Definitions.block_len a) (* blocks_state_len *)
(fun () -> 0ul) (* init_input_len *)
(fun () _k -> S.empty) (* init_input_s *)
(* init_s *)
(fun () _ -> Spec.Agile.Hash.init a)
(* update_multi_s *)
(fun () acc prevlen blocks -> update_multi_s a () acc prevlen blocks)
(* update_last_s *)
(fun () acc prevlen input -> Spec.Hash.Incremental.(update_last a acc prevlen input))
(* finish_s *)
(fun () _ acc () -> Spec.Agile.Hash.(finish a acc ()))
(* spec_s *)
(fun () _ s () -> Spec.Agile.Hash.(hash a s))
(* update_multi_zero *)
(fun i h prevlen -> update_multi_zero a i h prevlen)
(* update_multi_associative *)
(fun i acc prevlen1 prevlen2 input1 input2 -> update_multi_associative a i acc prevlen1 prevlen2 input1 input2)
(* spec_is_incremental *)
(fun _ key input () ->
let input1 = S.append S.empty input in
assert (S.equal input1 input);
Spec.Hash.Incremental.hash_is_hash_incremental' a input ())
(* index_of_state *)
(fun _ _ -> ())
(* init *)
(fun _ _ _ s ->
match a with
| MD5 -> Hacl.Hash.MD5.init s
| SHA1 -> Hacl.Hash.SHA1.init s
| SHA2_224 -> Hacl.Hash.SHA2.init_224 s
| SHA2_256 -> Hacl.Hash.SHA2.init_256 s
| SHA2_384 -> Hacl.Hash.SHA2.init_384 s
| SHA2_512 -> Hacl.Hash.SHA2.init_512 s
)
(* update_multi *)
(fun _ s prevlen blocks len ->
[@inline_let]
let update_multi : update_multi_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.update_multi
| SHA1 -> Hacl.Hash.SHA1.update_multi
| SHA2_224 -> Hacl.Hash.SHA2.update_multi_224
| SHA2_256 -> Hacl.Hash.SHA2.update_multi_256
| SHA2_384 -> Hacl.Hash.SHA2.update_multi_384
| SHA2_512 -> Hacl.Hash.SHA2.update_multi_512
in
update_multi s () blocks (len `U32.div` Hacl.Hash.Definitions.(block_len a)))
(* update_last *)
(fun _ s prevlen last last_len ->
[@inline_let]
let update_last : update_last_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.update_last
| SHA1 -> Hacl.Hash.SHA1.update_last
| SHA2_224 -> Hacl.Hash.SHA2.update_last_224
| SHA2_256 -> Hacl.Hash.SHA2.update_last_256
| SHA2_384 -> Hacl.Hash.SHA2.update_last_384
| SHA2_512 -> Hacl.Hash.SHA2.update_last_512
in
update_last s (md_prevlen a prevlen) last last_len)
(* finish *)
(fun _ _ s dst _ ->
[@inline_let]
let finish : finish_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.finish
| SHA1 -> Hacl.Hash.SHA1.finish
| SHA2_224 -> Hacl.Hash.SHA2.finish_224
| SHA2_256 -> Hacl.Hash.SHA2.finish_256
| SHA2_384 -> Hacl.Hash.SHA2.finish_384
| SHA2_512 -> Hacl.Hash.SHA2.finish_512
in
finish s dst)
#pop-options
// Putting some type abbreviations here, so that they appear in a separate file that can then be included by all streaming algorithms, rather than having e.g. SHA1 depend on e.g. MD5
// Could be anything that's 32-bit
inline_for_extraction noextract
let hacl_sha2_256 = hacl_md SHA2_256
let state_32 = F.state_s hacl_sha2_256 () ((state_t SHA2_256).s ()) (G.erased unit) | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Streaming.Interface.block Prims.unit | Prims.Tot | [
"total"
] | [] | [
"Hacl.Streaming.MD.hacl_md",
"Spec.Hash.Definitions.SHA2_512"
] | [] | false | false | false | true | false | let hacl_sha2_512 =
| hacl_md SHA2_512 | false |
|
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.hacl_sha2_256 | val hacl_sha2_256 : Hacl.Streaming.Interface.block Prims.unit | let hacl_sha2_256 = hacl_md SHA2_256 | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 190,
"start_col": 0,
"start_line": 190
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg
inline_for_extraction noextract
let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0
inline_for_extraction noextract
let state_t (a : alg) = stateful_buffer (word a) (D.impl_state_len (|a, ()|)) (init_elem a) unit
inline_for_extraction noextract
let update_multi_s (a : alg) () acc (prevlen : nat) input =
Agile.(update_multi a acc () input)
noextract
let update_multi_zero (a : alg) () acc (prevlen : nat) :
Lemma(update_multi_s a () acc prevlen S.empty == acc) = Spec.Hash.Lemmas.update_multi_zero a acc
#push-options "--ifuel 1"
// TODO: this is the third copy of this lemma!! why?!
noextract
let update_multi_associative (a : alg) () acc (prevlen1 prevlen2 : nat)
(input1 input2 : S.seq uint8) :
Lemma
(requires (
S.length input1 % U32.v (D.block_len a) = 0 /\
S.length input2 % U32.v (D.block_len a) = 0))
(ensures (
let input = S.append input1 input2 in
S.length input % U32.v (D.block_len a) = 0 /\
update_multi_s a () (update_multi_s a () acc prevlen1 input1) prevlen2 input2 ==
update_multi_s a () acc prevlen1 input)) =
Spec.Hash.Lemmas.update_multi_associative a acc input1 input2
#pop-options
inline_for_extraction noextract
let md_prevlen (a: alg) (len: D.(len: U64.t { U64.v len % U32.v (block_len a) = 0 })): D.prev_len_t a =
if a = SHA2_384 || a = SHA2_512 then FStar.Int.Cast.Full.uint64_to_uint128 len else len
/// This proof usually succeeds fast but we increase the rlimit for safety
#push-options "--z3rlimit 500 --ifuel 1"
inline_for_extraction noextract
let hacl_md (a:alg)// : block unit =
=
Block
Erased
(state_t a) (* state *)
(stateful_unused unit) (* key *)
unit
(fun () -> max_input_len64 a) (* max_input_len *)
(fun () () -> Spec.Hash.Definitions.hash_length a) (* output_len *)
(fun () -> Hacl.Hash.Definitions.block_len a) (* block_len *)
(fun () -> Hacl.Hash.Definitions.block_len a) (* blocks_state_len *)
(fun () -> 0ul) (* init_input_len *)
(fun () _k -> S.empty) (* init_input_s *)
(* init_s *)
(fun () _ -> Spec.Agile.Hash.init a)
(* update_multi_s *)
(fun () acc prevlen blocks -> update_multi_s a () acc prevlen blocks)
(* update_last_s *)
(fun () acc prevlen input -> Spec.Hash.Incremental.(update_last a acc prevlen input))
(* finish_s *)
(fun () _ acc () -> Spec.Agile.Hash.(finish a acc ()))
(* spec_s *)
(fun () _ s () -> Spec.Agile.Hash.(hash a s))
(* update_multi_zero *)
(fun i h prevlen -> update_multi_zero a i h prevlen)
(* update_multi_associative *)
(fun i acc prevlen1 prevlen2 input1 input2 -> update_multi_associative a i acc prevlen1 prevlen2 input1 input2)
(* spec_is_incremental *)
(fun _ key input () ->
let input1 = S.append S.empty input in
assert (S.equal input1 input);
Spec.Hash.Incremental.hash_is_hash_incremental' a input ())
(* index_of_state *)
(fun _ _ -> ())
(* init *)
(fun _ _ _ s ->
match a with
| MD5 -> Hacl.Hash.MD5.init s
| SHA1 -> Hacl.Hash.SHA1.init s
| SHA2_224 -> Hacl.Hash.SHA2.init_224 s
| SHA2_256 -> Hacl.Hash.SHA2.init_256 s
| SHA2_384 -> Hacl.Hash.SHA2.init_384 s
| SHA2_512 -> Hacl.Hash.SHA2.init_512 s
)
(* update_multi *)
(fun _ s prevlen blocks len ->
[@inline_let]
let update_multi : update_multi_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.update_multi
| SHA1 -> Hacl.Hash.SHA1.update_multi
| SHA2_224 -> Hacl.Hash.SHA2.update_multi_224
| SHA2_256 -> Hacl.Hash.SHA2.update_multi_256
| SHA2_384 -> Hacl.Hash.SHA2.update_multi_384
| SHA2_512 -> Hacl.Hash.SHA2.update_multi_512
in
update_multi s () blocks (len `U32.div` Hacl.Hash.Definitions.(block_len a)))
(* update_last *)
(fun _ s prevlen last last_len ->
[@inline_let]
let update_last : update_last_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.update_last
| SHA1 -> Hacl.Hash.SHA1.update_last
| SHA2_224 -> Hacl.Hash.SHA2.update_last_224
| SHA2_256 -> Hacl.Hash.SHA2.update_last_256
| SHA2_384 -> Hacl.Hash.SHA2.update_last_384
| SHA2_512 -> Hacl.Hash.SHA2.update_last_512
in
update_last s (md_prevlen a prevlen) last last_len)
(* finish *)
(fun _ _ s dst _ ->
[@inline_let]
let finish : finish_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.finish
| SHA1 -> Hacl.Hash.SHA1.finish
| SHA2_224 -> Hacl.Hash.SHA2.finish_224
| SHA2_256 -> Hacl.Hash.SHA2.finish_256
| SHA2_384 -> Hacl.Hash.SHA2.finish_384
| SHA2_512 -> Hacl.Hash.SHA2.finish_512
in
finish s dst)
#pop-options
// Putting some type abbreviations here, so that they appear in a separate file that can then be included by all streaming algorithms, rather than having e.g. SHA1 depend on e.g. MD5
// Could be anything that's 32-bit | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Hacl.Streaming.Interface.block Prims.unit | Prims.Tot | [
"total"
] | [] | [
"Hacl.Streaming.MD.hacl_md",
"Spec.Hash.Definitions.SHA2_256"
] | [] | false | false | false | true | false | let hacl_sha2_256 =
| hacl_md SHA2_256 | false |
|
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind_t_exact | val kind_t_exact
: parser_kind false WeakKindStrongPrefix | val kind_t_exact
: parser_kind false WeakKindStrongPrefix | let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 14,
"end_line": 98,
"start_col": 0,
"start_line": 96
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind false EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"EverParse3d.Kinds.kind_nlist",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind_t_exact:parser_kind false WeakKindStrongPrefix =
| kind_nlist | false |
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.state_t | val state_t : a: Hacl.Streaming.MD.alg -> Hacl.Streaming.Interface.stateful Prims.unit | let state_t (a : alg) = stateful_buffer (word a) (D.impl_state_len (|a, ()|)) (init_elem a) unit | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 96,
"end_line": 50,
"start_col": 0,
"start_line": 50
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg
inline_for_extraction noextract
let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Hacl.Streaming.MD.alg -> Hacl.Streaming.Interface.stateful Prims.unit | Prims.Tot | [
"total"
] | [] | [
"Hacl.Streaming.MD.alg",
"Hacl.Streaming.Interface.stateful_buffer",
"Spec.Hash.Definitions.word",
"Hacl.Hash.Definitions.impl_state_len",
"Prims.Mkdtuple2",
"Spec.Hash.Definitions.hash_alg",
"Hacl.Hash.Definitions.m_spec",
"Hacl.Streaming.MD.init_elem",
"Prims.unit",
"Hacl.Streaming.Interface.stateful"
] | [] | false | false | false | true | false | let state_t (a: alg) =
| stateful_buffer (word a) (D.impl_state_len (| a, () |)) (init_elem a) unit | false |
|
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.state_32 | val state_32 : Type0 | let state_32 = F.state_s hacl_sha2_256 () ((state_t SHA2_256).s ()) (G.erased unit) | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 83,
"end_line": 192,
"start_col": 0,
"start_line": 192
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg
inline_for_extraction noextract
let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0
inline_for_extraction noextract
let state_t (a : alg) = stateful_buffer (word a) (D.impl_state_len (|a, ()|)) (init_elem a) unit
inline_for_extraction noextract
let update_multi_s (a : alg) () acc (prevlen : nat) input =
Agile.(update_multi a acc () input)
noextract
let update_multi_zero (a : alg) () acc (prevlen : nat) :
Lemma(update_multi_s a () acc prevlen S.empty == acc) = Spec.Hash.Lemmas.update_multi_zero a acc
#push-options "--ifuel 1"
// TODO: this is the third copy of this lemma!! why?!
noextract
let update_multi_associative (a : alg) () acc (prevlen1 prevlen2 : nat)
(input1 input2 : S.seq uint8) :
Lemma
(requires (
S.length input1 % U32.v (D.block_len a) = 0 /\
S.length input2 % U32.v (D.block_len a) = 0))
(ensures (
let input = S.append input1 input2 in
S.length input % U32.v (D.block_len a) = 0 /\
update_multi_s a () (update_multi_s a () acc prevlen1 input1) prevlen2 input2 ==
update_multi_s a () acc prevlen1 input)) =
Spec.Hash.Lemmas.update_multi_associative a acc input1 input2
#pop-options
inline_for_extraction noextract
let md_prevlen (a: alg) (len: D.(len: U64.t { U64.v len % U32.v (block_len a) = 0 })): D.prev_len_t a =
if a = SHA2_384 || a = SHA2_512 then FStar.Int.Cast.Full.uint64_to_uint128 len else len
/// This proof usually succeeds fast but we increase the rlimit for safety
#push-options "--z3rlimit 500 --ifuel 1"
inline_for_extraction noextract
let hacl_md (a:alg)// : block unit =
=
Block
Erased
(state_t a) (* state *)
(stateful_unused unit) (* key *)
unit
(fun () -> max_input_len64 a) (* max_input_len *)
(fun () () -> Spec.Hash.Definitions.hash_length a) (* output_len *)
(fun () -> Hacl.Hash.Definitions.block_len a) (* block_len *)
(fun () -> Hacl.Hash.Definitions.block_len a) (* blocks_state_len *)
(fun () -> 0ul) (* init_input_len *)
(fun () _k -> S.empty) (* init_input_s *)
(* init_s *)
(fun () _ -> Spec.Agile.Hash.init a)
(* update_multi_s *)
(fun () acc prevlen blocks -> update_multi_s a () acc prevlen blocks)
(* update_last_s *)
(fun () acc prevlen input -> Spec.Hash.Incremental.(update_last a acc prevlen input))
(* finish_s *)
(fun () _ acc () -> Spec.Agile.Hash.(finish a acc ()))
(* spec_s *)
(fun () _ s () -> Spec.Agile.Hash.(hash a s))
(* update_multi_zero *)
(fun i h prevlen -> update_multi_zero a i h prevlen)
(* update_multi_associative *)
(fun i acc prevlen1 prevlen2 input1 input2 -> update_multi_associative a i acc prevlen1 prevlen2 input1 input2)
(* spec_is_incremental *)
(fun _ key input () ->
let input1 = S.append S.empty input in
assert (S.equal input1 input);
Spec.Hash.Incremental.hash_is_hash_incremental' a input ())
(* index_of_state *)
(fun _ _ -> ())
(* init *)
(fun _ _ _ s ->
match a with
| MD5 -> Hacl.Hash.MD5.init s
| SHA1 -> Hacl.Hash.SHA1.init s
| SHA2_224 -> Hacl.Hash.SHA2.init_224 s
| SHA2_256 -> Hacl.Hash.SHA2.init_256 s
| SHA2_384 -> Hacl.Hash.SHA2.init_384 s
| SHA2_512 -> Hacl.Hash.SHA2.init_512 s
)
(* update_multi *)
(fun _ s prevlen blocks len ->
[@inline_let]
let update_multi : update_multi_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.update_multi
| SHA1 -> Hacl.Hash.SHA1.update_multi
| SHA2_224 -> Hacl.Hash.SHA2.update_multi_224
| SHA2_256 -> Hacl.Hash.SHA2.update_multi_256
| SHA2_384 -> Hacl.Hash.SHA2.update_multi_384
| SHA2_512 -> Hacl.Hash.SHA2.update_multi_512
in
update_multi s () blocks (len `U32.div` Hacl.Hash.Definitions.(block_len a)))
(* update_last *)
(fun _ s prevlen last last_len ->
[@inline_let]
let update_last : update_last_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.update_last
| SHA1 -> Hacl.Hash.SHA1.update_last
| SHA2_224 -> Hacl.Hash.SHA2.update_last_224
| SHA2_256 -> Hacl.Hash.SHA2.update_last_256
| SHA2_384 -> Hacl.Hash.SHA2.update_last_384
| SHA2_512 -> Hacl.Hash.SHA2.update_last_512
in
update_last s (md_prevlen a prevlen) last last_len)
(* finish *)
(fun _ _ s dst _ ->
[@inline_let]
let finish : finish_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.finish
| SHA1 -> Hacl.Hash.SHA1.finish
| SHA2_224 -> Hacl.Hash.SHA2.finish_224
| SHA2_256 -> Hacl.Hash.SHA2.finish_256
| SHA2_384 -> Hacl.Hash.SHA2.finish_384
| SHA2_512 -> Hacl.Hash.SHA2.finish_512
in
finish s dst)
#pop-options
// Putting some type abbreviations here, so that they appear in a separate file that can then be included by all streaming algorithms, rather than having e.g. SHA1 depend on e.g. MD5
// Could be anything that's 32-bit
inline_for_extraction noextract
let hacl_sha2_256 = hacl_md SHA2_256 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Streaming.Functor.state_s",
"Prims.unit",
"Hacl.Streaming.MD.hacl_sha2_256",
"Hacl.Streaming.Interface.__proj__Stateful__item__s",
"Hacl.Streaming.MD.state_t",
"Spec.Hash.Definitions.SHA2_256",
"FStar.Ghost.erased"
] | [] | false | false | false | true | true | let state_32 =
| F.state_s hacl_sha2_256 () ((state_t SHA2_256).s ()) (G.erased unit) | false |
|
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.update_multi_associative | val update_multi_associative:
a: alg ->
Prims.unit ->
acc: _ ->
prevlen1: nat ->
prevlen2: nat ->
input1: S.seq uint8 ->
input2: S.seq uint8
-> Lemma
(requires
(S.length input1 % U32.v (D.block_len a) = 0 /\ S.length input2 % U32.v (D.block_len a) = 0)
)
(ensures
(let input = S.append input1 input2 in
S.length input % U32.v (D.block_len a) = 0 /\
update_multi_s a () (update_multi_s a () acc prevlen1 input1) prevlen2 input2 ==
update_multi_s a () acc prevlen1 input)) | val update_multi_associative:
a: alg ->
Prims.unit ->
acc: _ ->
prevlen1: nat ->
prevlen2: nat ->
input1: S.seq uint8 ->
input2: S.seq uint8
-> Lemma
(requires
(S.length input1 % U32.v (D.block_len a) = 0 /\ S.length input2 % U32.v (D.block_len a) = 0)
)
(ensures
(let input = S.append input1 input2 in
S.length input % U32.v (D.block_len a) = 0 /\
update_multi_s a () (update_multi_s a () acc prevlen1 input1) prevlen2 input2 ==
update_multi_s a () acc prevlen1 input)) | let update_multi_associative (a : alg) () acc (prevlen1 prevlen2 : nat)
(input1 input2 : S.seq uint8) :
Lemma
(requires (
S.length input1 % U32.v (D.block_len a) = 0 /\
S.length input2 % U32.v (D.block_len a) = 0))
(ensures (
let input = S.append input1 input2 in
S.length input % U32.v (D.block_len a) = 0 /\
update_multi_s a () (update_multi_s a () acc prevlen1 input1) prevlen2 input2 ==
update_multi_s a () acc prevlen1 input)) =
Spec.Hash.Lemmas.update_multi_associative a acc input1 input2 | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 63,
"end_line": 75,
"start_col": 0,
"start_line": 64
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg
inline_for_extraction noextract
let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0
inline_for_extraction noextract
let state_t (a : alg) = stateful_buffer (word a) (D.impl_state_len (|a, ()|)) (init_elem a) unit
inline_for_extraction noextract
let update_multi_s (a : alg) () acc (prevlen : nat) input =
Agile.(update_multi a acc () input)
noextract
let update_multi_zero (a : alg) () acc (prevlen : nat) :
Lemma(update_multi_s a () acc prevlen S.empty == acc) = Spec.Hash.Lemmas.update_multi_zero a acc
#push-options "--ifuel 1"
// TODO: this is the third copy of this lemma!! why?! | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 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": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Hacl.Streaming.MD.alg ->
_: Prims.unit ->
acc: Spec.Hash.Definitions.words_state a ->
prevlen1: Prims.nat ->
prevlen2: Prims.nat ->
input1: FStar.Seq.Base.seq Hacl.Streaming.Interface.uint8 ->
input2: FStar.Seq.Base.seq Hacl.Streaming.Interface.uint8
-> FStar.Pervasives.Lemma
(requires
FStar.Seq.Base.length input1 % FStar.UInt32.v (Hacl.Hash.Definitions.block_len a) = 0 /\
FStar.Seq.Base.length input2 % FStar.UInt32.v (Hacl.Hash.Definitions.block_len a) = 0)
(ensures
(let input = FStar.Seq.Base.append input1 input2 in
FStar.Seq.Base.length input % FStar.UInt32.v (Hacl.Hash.Definitions.block_len a) = 0 /\
Hacl.Streaming.MD.update_multi_s a
()
(Hacl.Streaming.MD.update_multi_s a () acc prevlen1 input1)
prevlen2
input2 ==
Hacl.Streaming.MD.update_multi_s a () acc prevlen1 input)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.MD.alg",
"Prims.unit",
"Spec.Hash.Definitions.words_state",
"Prims.nat",
"FStar.Seq.Base.seq",
"Hacl.Streaming.Interface.uint8",
"Spec.Hash.Lemmas.update_multi_associative",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"FStar.UInt32.v",
"Hacl.Hash.Definitions.block_len",
"Prims.squash",
"Prims.eq2",
"Hacl.Streaming.MD.update_multi_s",
"FStar.Seq.Base.append",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let update_multi_associative
(a: alg)
()
acc
(prevlen1: nat)
(prevlen2: nat)
(input1: S.seq uint8)
(input2: S.seq uint8)
: Lemma
(requires
(S.length input1 % U32.v (D.block_len a) = 0 /\ S.length input2 % U32.v (D.block_len a) = 0)
)
(ensures
(let input = S.append input1 input2 in
S.length input % U32.v (D.block_len a) = 0 /\
update_multi_s a () (update_multi_s a () acc prevlen1 input1) prevlen2 input2 ==
update_multi_s a () acc prevlen1 input)) =
| Spec.Hash.Lemmas.update_multi_associative a acc input1 input2 | false |
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.md_prevlen | val md_prevlen (a: alg) (len: D.(len: U64.t{U64.v len % U32.v (block_len a) = 0})) : D.prev_len_t a | val md_prevlen (a: alg) (len: D.(len: U64.t{U64.v len % U32.v (block_len a) = 0})) : D.prev_len_t a | let md_prevlen (a: alg) (len: D.(len: U64.t { U64.v len % U32.v (block_len a) = 0 })): D.prev_len_t a =
if a = SHA2_384 || a = SHA2_512 then FStar.Int.Cast.Full.uint64_to_uint128 len else len | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 89,
"end_line": 80,
"start_col": 0,
"start_line": 79
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg
inline_for_extraction noextract
let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0
inline_for_extraction noextract
let state_t (a : alg) = stateful_buffer (word a) (D.impl_state_len (|a, ()|)) (init_elem a) unit
inline_for_extraction noextract
let update_multi_s (a : alg) () acc (prevlen : nat) input =
Agile.(update_multi a acc () input)
noextract
let update_multi_zero (a : alg) () acc (prevlen : nat) :
Lemma(update_multi_s a () acc prevlen S.empty == acc) = Spec.Hash.Lemmas.update_multi_zero a acc
#push-options "--ifuel 1"
// TODO: this is the third copy of this lemma!! why?!
noextract
let update_multi_associative (a : alg) () acc (prevlen1 prevlen2 : nat)
(input1 input2 : S.seq uint8) :
Lemma
(requires (
S.length input1 % U32.v (D.block_len a) = 0 /\
S.length input2 % U32.v (D.block_len a) = 0))
(ensures (
let input = S.append input1 input2 in
S.length input % U32.v (D.block_len a) = 0 /\
update_multi_s a () (update_multi_s a () acc prevlen1 input1) prevlen2 input2 ==
update_multi_s a () acc prevlen1 input)) =
Spec.Hash.Lemmas.update_multi_associative a acc input1 input2
#pop-options | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Hacl.Streaming.MD.alg ->
len: FStar.UInt64.t{FStar.UInt64.v len % FStar.UInt32.v (Hacl.Hash.Definitions.block_len a) = 0}
-> Hacl.Hash.Definitions.prev_len_t a | Prims.Tot | [
"total"
] | [] | [
"Hacl.Streaming.MD.alg",
"FStar.UInt64.t",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"FStar.UInt64.v",
"FStar.UInt32.v",
"Hacl.Hash.Definitions.block_len",
"Prims.op_BarBar",
"Spec.Hash.Definitions.hash_alg",
"Spec.Hash.Definitions.SHA2_384",
"Spec.Hash.Definitions.SHA2_512",
"FStar.Int.Cast.Full.uint64_to_uint128",
"Prims.bool",
"Hacl.Hash.Definitions.prev_len_t"
] | [] | false | false | false | false | false | let md_prevlen (a: alg) (len: D.(len: U64.t{U64.v len % U32.v (block_len a) = 0})) : D.prev_len_t a =
| if a = SHA2_384 || a = SHA2_512 then FStar.Int.Cast.Full.uint64_to_uint128 len else len | false |
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.update_multi_zero | val update_multi_zero: a: alg -> Prims.unit -> acc: _ -> prevlen: nat
-> Lemma (update_multi_s a () acc prevlen S.empty == acc) | val update_multi_zero: a: alg -> Prims.unit -> acc: _ -> prevlen: nat
-> Lemma (update_multi_s a () acc prevlen S.empty == acc) | let update_multi_zero (a : alg) () acc (prevlen : nat) :
Lemma(update_multi_s a () acc prevlen S.empty == acc) = Spec.Hash.Lemmas.update_multi_zero a acc | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 98,
"end_line": 58,
"start_col": 0,
"start_line": 57
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg
inline_for_extraction noextract
let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0
inline_for_extraction noextract
let state_t (a : alg) = stateful_buffer (word a) (D.impl_state_len (|a, ()|)) (init_elem a) unit
inline_for_extraction noextract
let update_multi_s (a : alg) () acc (prevlen : nat) input =
Agile.(update_multi a acc () input) | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Hacl.Streaming.MD.alg ->
_: Prims.unit ->
acc: Spec.Hash.Definitions.words_state a ->
prevlen: Prims.nat
-> FStar.Pervasives.Lemma
(ensures Hacl.Streaming.MD.update_multi_s a () acc prevlen FStar.Seq.Base.empty == acc) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.MD.alg",
"Prims.unit",
"Spec.Hash.Definitions.words_state",
"Prims.nat",
"Spec.Hash.Lemmas.update_multi_zero",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Hacl.Streaming.MD.update_multi_s",
"FStar.Seq.Base.empty",
"Lib.IntTypes.uint8",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let update_multi_zero (a: alg) () acc (prevlen: nat)
: Lemma (update_multi_s a () acc prevlen S.empty == acc) =
| Spec.Hash.Lemmas.update_multi_zero a acc | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.ret_kind | val ret_kind
: parser_kind false WeakKindStrongPrefix | val ret_kind
: parser_kind false WeakKindStrongPrefix | let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 22,
"end_line": 53,
"start_col": 0,
"start_line": 51
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind false EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Combinators.parse_ret_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let ret_kind:parser_kind false WeakKindStrongPrefix =
| LPC.parse_ret_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.and_then_kind | val and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2 | val and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2 | let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2 | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 29,
"end_line": 61,
"start_col": 0,
"start_line": 58
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k1: EverParse3d.Kinds.parser_kind nz1 EverParse3d.Kinds.WeakKindStrongPrefix ->
k2: EverParse3d.Kinds.parser_kind nz2 wk2
-> EverParse3d.Kinds.parser_kind (nz1 || nz2) wk2 | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix",
"EverParse3d.Kinds.weak_kind",
"LowParse.Spec.Combinators.and_then_kind",
"Prims.op_BarBar"
] | [] | false | false | false | false | false | let and_then_kind
(#nz1: _)
(k1: parser_kind nz1 WeakKindStrongPrefix)
(#nz2 #wk2: _)
(k2: parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2 =
| LPC.and_then_kind k1 k2 | false |
Hacl.Streaming.MD.fst | Hacl.Streaming.MD.state_64 | val state_64 : Type0 | let state_64 = F.state_s hacl_sha2_512 () ((state_t SHA2_512).s ()) (G.erased unit) | {
"file_name": "code/streaming/Hacl.Streaming.MD.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 83,
"end_line": 197,
"start_col": 0,
"start_line": 197
} | module Hacl.Streaming.MD
open FStar.HyperStack.ST
/// This file is poorly named. It contains a generic type class instantiation
/// for the streaming functor for any algorithm that fits within the agile hash
/// infrastructure.
#set-options "--max_fuel 0 --max_ifuel 0 --z3rlimit 100"
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module F = Hacl.Streaming.Functor
module ST = FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
open Spec.Hash.Definitions
open Hacl.Streaming.Interface
open Hacl.Hash.Definitions
module D = Hacl.Hash.Definitions
module Agile = Spec.Agile.Hash
let _: squash (inversion hash_alg) = allow_inversion hash_alg
inline_for_extraction noextract
let alg = md_alg
inline_for_extraction noextract
let init_elem (a : alg) : word a =
match a with
| MD5 | SHA1 | SHA2_256 | SHA2_224 -> Lib.IntTypes.u32 0
| SHA2_384 | SHA2_512 -> Lib.IntTypes.u64 0
inline_for_extraction noextract
let state_t (a : alg) = stateful_buffer (word a) (D.impl_state_len (|a, ()|)) (init_elem a) unit
inline_for_extraction noextract
let update_multi_s (a : alg) () acc (prevlen : nat) input =
Agile.(update_multi a acc () input)
noextract
let update_multi_zero (a : alg) () acc (prevlen : nat) :
Lemma(update_multi_s a () acc prevlen S.empty == acc) = Spec.Hash.Lemmas.update_multi_zero a acc
#push-options "--ifuel 1"
// TODO: this is the third copy of this lemma!! why?!
noextract
let update_multi_associative (a : alg) () acc (prevlen1 prevlen2 : nat)
(input1 input2 : S.seq uint8) :
Lemma
(requires (
S.length input1 % U32.v (D.block_len a) = 0 /\
S.length input2 % U32.v (D.block_len a) = 0))
(ensures (
let input = S.append input1 input2 in
S.length input % U32.v (D.block_len a) = 0 /\
update_multi_s a () (update_multi_s a () acc prevlen1 input1) prevlen2 input2 ==
update_multi_s a () acc prevlen1 input)) =
Spec.Hash.Lemmas.update_multi_associative a acc input1 input2
#pop-options
inline_for_extraction noextract
let md_prevlen (a: alg) (len: D.(len: U64.t { U64.v len % U32.v (block_len a) = 0 })): D.prev_len_t a =
if a = SHA2_384 || a = SHA2_512 then FStar.Int.Cast.Full.uint64_to_uint128 len else len
/// This proof usually succeeds fast but we increase the rlimit for safety
#push-options "--z3rlimit 500 --ifuel 1"
inline_for_extraction noextract
let hacl_md (a:alg)// : block unit =
=
Block
Erased
(state_t a) (* state *)
(stateful_unused unit) (* key *)
unit
(fun () -> max_input_len64 a) (* max_input_len *)
(fun () () -> Spec.Hash.Definitions.hash_length a) (* output_len *)
(fun () -> Hacl.Hash.Definitions.block_len a) (* block_len *)
(fun () -> Hacl.Hash.Definitions.block_len a) (* blocks_state_len *)
(fun () -> 0ul) (* init_input_len *)
(fun () _k -> S.empty) (* init_input_s *)
(* init_s *)
(fun () _ -> Spec.Agile.Hash.init a)
(* update_multi_s *)
(fun () acc prevlen blocks -> update_multi_s a () acc prevlen blocks)
(* update_last_s *)
(fun () acc prevlen input -> Spec.Hash.Incremental.(update_last a acc prevlen input))
(* finish_s *)
(fun () _ acc () -> Spec.Agile.Hash.(finish a acc ()))
(* spec_s *)
(fun () _ s () -> Spec.Agile.Hash.(hash a s))
(* update_multi_zero *)
(fun i h prevlen -> update_multi_zero a i h prevlen)
(* update_multi_associative *)
(fun i acc prevlen1 prevlen2 input1 input2 -> update_multi_associative a i acc prevlen1 prevlen2 input1 input2)
(* spec_is_incremental *)
(fun _ key input () ->
let input1 = S.append S.empty input in
assert (S.equal input1 input);
Spec.Hash.Incremental.hash_is_hash_incremental' a input ())
(* index_of_state *)
(fun _ _ -> ())
(* init *)
(fun _ _ _ s ->
match a with
| MD5 -> Hacl.Hash.MD5.init s
| SHA1 -> Hacl.Hash.SHA1.init s
| SHA2_224 -> Hacl.Hash.SHA2.init_224 s
| SHA2_256 -> Hacl.Hash.SHA2.init_256 s
| SHA2_384 -> Hacl.Hash.SHA2.init_384 s
| SHA2_512 -> Hacl.Hash.SHA2.init_512 s
)
(* update_multi *)
(fun _ s prevlen blocks len ->
[@inline_let]
let update_multi : update_multi_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.update_multi
| SHA1 -> Hacl.Hash.SHA1.update_multi
| SHA2_224 -> Hacl.Hash.SHA2.update_multi_224
| SHA2_256 -> Hacl.Hash.SHA2.update_multi_256
| SHA2_384 -> Hacl.Hash.SHA2.update_multi_384
| SHA2_512 -> Hacl.Hash.SHA2.update_multi_512
in
update_multi s () blocks (len `U32.div` Hacl.Hash.Definitions.(block_len a)))
(* update_last *)
(fun _ s prevlen last last_len ->
[@inline_let]
let update_last : update_last_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.update_last
| SHA1 -> Hacl.Hash.SHA1.update_last
| SHA2_224 -> Hacl.Hash.SHA2.update_last_224
| SHA2_256 -> Hacl.Hash.SHA2.update_last_256
| SHA2_384 -> Hacl.Hash.SHA2.update_last_384
| SHA2_512 -> Hacl.Hash.SHA2.update_last_512
in
update_last s (md_prevlen a prevlen) last last_len)
(* finish *)
(fun _ _ s dst _ ->
[@inline_let]
let finish : finish_st (|a,()|) =
match a with
| MD5 -> Hacl.Hash.MD5.finish
| SHA1 -> Hacl.Hash.SHA1.finish
| SHA2_224 -> Hacl.Hash.SHA2.finish_224
| SHA2_256 -> Hacl.Hash.SHA2.finish_256
| SHA2_384 -> Hacl.Hash.SHA2.finish_384
| SHA2_512 -> Hacl.Hash.SHA2.finish_512
in
finish s dst)
#pop-options
// Putting some type abbreviations here, so that they appear in a separate file that can then be included by all streaming algorithms, rather than having e.g. SHA1 depend on e.g. MD5
// Could be anything that's 32-bit
inline_for_extraction noextract
let hacl_sha2_256 = hacl_md SHA2_256
let state_32 = F.state_s hacl_sha2_256 () ((state_t SHA2_256).s ()) (G.erased unit)
inline_for_extraction noextract
let hacl_sha2_512 = hacl_md SHA2_512 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Lemmas.fsti.checked",
"Spec.Hash.Incremental.fsti.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"Hacl.Streaming.Functor.fsti.checked",
"Hacl.Hash.SHA2.fsti.checked",
"Hacl.Hash.SHA1.fsti.checked",
"Hacl.Hash.MD5.fsti.checked",
"Hacl.Hash.Definitions.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Int.Cast.Full.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.MD.fst"
} | [
{
"abbrev": true,
"full_module": "Spec.Agile.Hash",
"short_module": "Agile"
},
{
"abbrev": true,
"full_module": "Hacl.Hash.Definitions",
"short_module": "D"
},
{
"abbrev": false,
"full_module": "Hacl.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "Hacl.Streaming.Functor",
"short_module": "F"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Hacl.Streaming.Functor.state_s",
"Prims.unit",
"Hacl.Streaming.MD.hacl_sha2_512",
"Hacl.Streaming.Interface.__proj__Stateful__item__s",
"Hacl.Streaming.MD.state_t",
"Spec.Hash.Definitions.SHA2_512",
"FStar.Ghost.erased"
] | [] | false | false | false | true | true | let state_64 =
| F.state_s hacl_sha2_512 () ((state_t SHA2_512).s ()) (G.erased unit) | false |
|
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.uint32 | val uint32 : Type0 | let uint32 = Lib.IntTypes.uint32 | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 32,
"end_line": 51,
"start_col": 0,
"start_line": 51
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.uint32"
] | [] | false | false | false | true | true | let uint32 =
| Lib.IntTypes.uint32 | false |
|
EverParse3d.Kinds.fst | EverParse3d.Kinds.glb | val glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2) | val glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2) | let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2 | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 18,
"end_line": 46,
"start_col": 0,
"start_line": 43
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | k1: EverParse3d.Kinds.parser_kind nz1 wk1 -> k2: EverParse3d.Kinds.parser_kind nz2 wk2
-> EverParse3d.Kinds.parser_kind (nz1 && nz2) (EverParse3d.Kinds.weak_kind_glb wk1 wk2) | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"EverParse3d.Kinds.weak_kind",
"EverParse3d.Kinds.parser_kind",
"LowParse.Spec.Base.glb",
"Prims.op_AmpAmp",
"EverParse3d.Kinds.weak_kind_glb"
] | [] | false | false | false | false | false | let glb
(#nz1: bool)
(#wk1: weak_kind)
(k1: parser_kind nz1 wk1)
(#nz2: bool)
(#wk2: weak_kind)
(k2: parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2) =
| LP.glb k1 k2 | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.uint8 | val uint8 : Type0 | let uint8 = Lib.IntTypes.uint8 | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 48,
"start_col": 0,
"start_line": 48
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"Lib.IntTypes.uint8"
] | [] | false | false | false | true | true | let uint8 =
| Lib.IntTypes.uint8 | false |
|
EverParse3d.Kinds.fst | EverParse3d.Kinds.impos_kind | val impos_kind
: parser_kind true WeakKindStrongPrefix | val impos_kind
: parser_kind true WeakKindStrongPrefix | let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail)) | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 62,
"end_line": 73,
"start_col": 0,
"start_line": 71
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Base.strong_parser_kind",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.parser_kind_metadata_some",
"LowParse.Spec.Base.ParserKindMetadataFail",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let impos_kind:parser_kind true WeakKindStrongPrefix =
| let open LPC in strong_parser_kind 1 1 (Some ParserKindMetadataFail) | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.bytes | val bytes : Type0 | let bytes = S.seq uint8 | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 54,
"start_col": 0,
"start_line": 54
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Seq.Base.seq",
"Hacl.Streaming.Spec.uint8"
] | [] | false | false | false | true | true | let bytes =
| S.seq uint8 | false |
|
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind_nlist | val kind_nlist
: parser_kind false WeakKindStrongPrefix | val kind_nlist
: parser_kind false WeakKindStrongPrefix | let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
} | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 5,
"end_line": 86,
"start_col": 0,
"start_line": 78
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind false EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Base.Mkparser_kind'",
"FStar.Pervasives.Native.None",
"Prims.nat",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.ParserStrong",
"LowParse.Spec.Base.parser_kind_metadata_some",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind_nlist:parser_kind false WeakKindStrongPrefix =
| let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
} | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind_all_bytes | val kind_all_bytes
: parser_kind false WeakKindConsumesAll | val kind_all_bytes
: parser_kind false WeakKindConsumesAll | let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 44,
"end_line": 90,
"start_col": 0,
"start_line": 88
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind false EverParse3d.Kinds.WeakKindConsumesAll | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Bytes.parse_all_bytes_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindConsumesAll"
] | [] | false | false | false | false | false | let kind_all_bytes:parser_kind false WeakKindConsumesAll =
| LowParse.Spec.Bytes.parse_all_bytes_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind____UINT16BE | val kind____UINT16BE
: parser_kind true WeakKindStrongPrefix | val kind____UINT16BE
: parser_kind true WeakKindStrongPrefix | let kind____UINT16BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u16_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 43,
"end_line": 126,
"start_col": 0,
"start_line": 124
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
}
let kind_all_zeros
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.List.parse_list_kind
inline_for_extraction noextract
let kind____UINT8
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u8_kind
inline_for_extraction noextract
let kind____UINT8BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u8_kind | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Int.parse_u16_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind____UINT16BE:parser_kind true WeakKindStrongPrefix =
| LowParse.Spec.BoundedInt.parse_u16_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.filter_kind | val filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk | val filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk | let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 27,
"end_line": 67,
"start_col": 0,
"start_line": 65
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | k: EverParse3d.Kinds.parser_kind nz wk -> EverParse3d.Kinds.parser_kind nz wk | Prims.Tot | [
"total"
] | [] | [
"Prims.bool",
"EverParse3d.Kinds.weak_kind",
"EverParse3d.Kinds.parser_kind",
"LowParse.Spec.Combinators.parse_filter_kind"
] | [] | false | false | false | false | false | let filter_kind (#nz #wk: _) (k: parser_kind nz wk) : parser_kind nz wk =
| LPC.parse_filter_kind k | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.parse_string_kind | val parse_string_kind
: parser_kind true WeakKindStrongPrefix | val parse_string_kind
: parser_kind true WeakKindStrongPrefix | let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
} | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 5,
"end_line": 107,
"start_col": 0,
"start_line": 100
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Base.Mkparser_kind'",
"FStar.Pervasives.Native.None",
"Prims.nat",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.ParserStrong",
"LowParse.Spec.Base.parser_kind_metadata_some",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let parse_string_kind:parser_kind true WeakKindStrongPrefix =
| {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None
} | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind_all_zeros | val kind_all_zeros
: parser_kind false WeakKindConsumesAll | val kind_all_zeros
: parser_kind false WeakKindConsumesAll | let kind_all_zeros
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.List.parse_list_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 38,
"end_line": 111,
"start_col": 0,
"start_line": 109
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind false EverParse3d.Kinds.WeakKindConsumesAll | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.List.parse_list_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindConsumesAll"
] | [] | false | false | false | false | false | let kind_all_zeros:parser_kind false WeakKindConsumesAll =
| LowParse.Spec.List.parse_list_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind____UINT32BE | val kind____UINT32BE
: parser_kind true WeakKindStrongPrefix | val kind____UINT32BE
: parser_kind true WeakKindStrongPrefix | let kind____UINT32BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u32_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 43,
"end_line": 131,
"start_col": 0,
"start_line": 129
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
}
let kind_all_zeros
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.List.parse_list_kind
inline_for_extraction noextract
let kind____UINT8
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u8_kind
inline_for_extraction noextract
let kind____UINT8BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u8_kind
inline_for_extraction noextract
let kind____UINT16BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u16_kind | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Int.parse_u32_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind____UINT32BE:parser_kind true WeakKindStrongPrefix =
| LowParse.Spec.BoundedInt.parse_u32_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind____UINT64BE | val kind____UINT64BE
: parser_kind true WeakKindStrongPrefix | val kind____UINT64BE
: parser_kind true WeakKindStrongPrefix | let kind____UINT64BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u64_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 36,
"end_line": 136,
"start_col": 0,
"start_line": 134
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
}
let kind_all_zeros
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.List.parse_list_kind
inline_for_extraction noextract
let kind____UINT8
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u8_kind
inline_for_extraction noextract
let kind____UINT8BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u8_kind
inline_for_extraction noextract
let kind____UINT16BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u16_kind
inline_for_extraction noextract
let kind____UINT32BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u32_kind | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Int.parse_u64_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind____UINT64BE:parser_kind true WeakKindStrongPrefix =
| LowParse.Spec.Int.parse_u64_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind____UINT8BE | val kind____UINT8BE
: parser_kind true WeakKindStrongPrefix | val kind____UINT8BE
: parser_kind true WeakKindStrongPrefix | let kind____UINT8BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u8_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 42,
"end_line": 121,
"start_col": 0,
"start_line": 119
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
}
let kind_all_zeros
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.List.parse_list_kind
inline_for_extraction noextract
let kind____UINT8
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u8_kind | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Int.parse_u8_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind____UINT8BE:parser_kind true WeakKindStrongPrefix =
| LowParse.Spec.BoundedInt.parse_u8_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind____UINT8 | val kind____UINT8
: parser_kind true WeakKindStrongPrefix | val kind____UINT8
: parser_kind true WeakKindStrongPrefix | let kind____UINT8
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u8_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 35,
"end_line": 116,
"start_col": 0,
"start_line": 114
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
}
let kind_all_zeros
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.List.parse_list_kind | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Int.parse_u8_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind____UINT8:parser_kind true WeakKindStrongPrefix =
| LowParse.Spec.Int.parse_u8_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind____UINT64 | val kind____UINT64
: parser_kind true WeakKindStrongPrefix | val kind____UINT64
: parser_kind true WeakKindStrongPrefix | let kind____UINT64
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u64_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 36,
"end_line": 151,
"start_col": 0,
"start_line": 149
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
}
let kind_all_zeros
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.List.parse_list_kind
inline_for_extraction noextract
let kind____UINT8
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u8_kind
inline_for_extraction noextract
let kind____UINT8BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u8_kind
inline_for_extraction noextract
let kind____UINT16BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u16_kind
inline_for_extraction noextract
let kind____UINT32BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u32_kind
inline_for_extraction noextract
let kind____UINT64BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u64_kind
inline_for_extraction noextract
let kind____UINT16
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u16_kind
inline_for_extraction noextract
let kind____UINT32
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u32_kind | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Int.parse_u64_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind____UINT64:parser_kind true WeakKindStrongPrefix =
| LowParse.Spec.Int.parse_u64_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind____UINT32 | val kind____UINT32
: parser_kind true WeakKindStrongPrefix | val kind____UINT32
: parser_kind true WeakKindStrongPrefix | let kind____UINT32
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u32_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 43,
"end_line": 146,
"start_col": 0,
"start_line": 144
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
}
let kind_all_zeros
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.List.parse_list_kind
inline_for_extraction noextract
let kind____UINT8
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u8_kind
inline_for_extraction noextract
let kind____UINT8BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u8_kind
inline_for_extraction noextract
let kind____UINT16BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u16_kind
inline_for_extraction noextract
let kind____UINT32BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u32_kind
inline_for_extraction noextract
let kind____UINT64BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u64_kind
inline_for_extraction noextract
let kind____UINT16
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u16_kind | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Int.parse_u32_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind____UINT32:parser_kind true WeakKindStrongPrefix =
| LowParse.Spec.BoundedInt.parse_u32_kind | false |
EverParse3d.Kinds.fst | EverParse3d.Kinds.kind____UINT16 | val kind____UINT16
: parser_kind true WeakKindStrongPrefix | val kind____UINT16
: parser_kind true WeakKindStrongPrefix | let kind____UINT16
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u16_kind | {
"file_name": "src/3d/prelude/EverParse3d.Kinds.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 43,
"end_line": 141,
"start_col": 0,
"start_line": 139
} | (*
Copyright 2019 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 EverParse3d.Kinds
module LP = LowParse.Spec.Base
module LPC = LowParse.Spec.Combinators
////////////////////////////////////////////////////////////////////////////////
// Parsers
////////////////////////////////////////////////////////////////////////////////
let parser_kind_prop
(nz: bool)
(wk: weak_kind)
(k: LP.parser_kind)
: Tot prop
= (nz ==> (k.LP.parser_kind_low > 0)) /\
begin match wk with
| WeakKindStrongPrefix -> k.LP.parser_kind_subkind == Some LP.ParserStrong
| WeakKindConsumesAll -> k.LP.parser_kind_subkind == Some LP.ParserConsumesAll
| _ -> True
end
inline_for_extraction
noextract
let parser_kind (nz:bool) (wk: weak_kind) =
k:LP.parser_kind { parser_kind_prop nz wk k }
inline_for_extraction
noextract
let glb (#nz1:bool) (#wk1: weak_kind) (k1:parser_kind nz1 wk1)
(#nz2:bool) (#wk2: weak_kind) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 && nz2) (weak_kind_glb wk1 wk2)
= LP.glb k1 k2
/// Parser: return
inline_for_extraction
noextract
let ret_kind
: parser_kind false WeakKindStrongPrefix
= LPC.parse_ret_kind
/// Parser: bind
inline_for_extraction
noextract
let and_then_kind (#nz1:_) (k1:parser_kind nz1 WeakKindStrongPrefix)
(#nz2:_) (#wk2: _) (k2:parser_kind nz2 wk2)
: parser_kind (nz1 || nz2) wk2
= LPC.and_then_kind k1 k2
inline_for_extraction
noextract
let filter_kind (#nz:_) (#wk: _) (k:parser_kind nz wk)
: parser_kind nz wk
= LPC.parse_filter_kind k
inline_for_extraction
noextract
let impos_kind
: parser_kind true WeakKindStrongPrefix
= LPC.(strong_parser_kind 1 1 (Some ParserKindMetadataFail))
/// Lists/arrays
inline_for_extraction
noextract
let kind_nlist
: parser_kind false WeakKindStrongPrefix
= let open LP in
{
parser_kind_low = 0;
parser_kind_high = None;
parser_kind_subkind = Some ParserStrong;
parser_kind_metadata = None
}
let kind_all_bytes
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.Bytes.parse_all_bytes_kind
let kind_t_at_most
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let kind_t_exact
: parser_kind false WeakKindStrongPrefix
= kind_nlist
let parse_string_kind
: parser_kind true WeakKindStrongPrefix
= {
LP.parser_kind_low = 1;
LP.parser_kind_high = None;
LP.parser_kind_subkind = Some LP.ParserStrong;
LP.parser_kind_metadata = None;
}
let kind_all_zeros
: parser_kind false WeakKindConsumesAll
= LowParse.Spec.List.parse_list_kind
inline_for_extraction noextract
let kind____UINT8
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u8_kind
inline_for_extraction noextract
let kind____UINT8BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u8_kind
inline_for_extraction noextract
let kind____UINT16BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u16_kind
inline_for_extraction noextract
let kind____UINT32BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.BoundedInt.parse_u32_kind
inline_for_extraction noextract
let kind____UINT64BE
: parser_kind true WeakKindStrongPrefix
= LowParse.Spec.Int.parse_u64_kind | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.List.fsti.checked",
"LowParse.Spec.Int.fsti.checked",
"LowParse.Spec.Combinators.fsti.checked",
"LowParse.Spec.Bytes.fst.checked",
"LowParse.Spec.BoundedInt.fsti.checked",
"LowParse.Spec.Base.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "EverParse3d.Kinds.fst"
} | [
{
"abbrev": true,
"full_module": "LowParse.Spec.Combinators",
"short_module": "LPC"
},
{
"abbrev": true,
"full_module": "LowParse.Spec.Base",
"short_module": "LP"
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "EverParse3d",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 2,
"max_fuel": 0,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [
"smt.qi.eager_threshold=10"
],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | EverParse3d.Kinds.parser_kind true EverParse3d.Kinds.WeakKindStrongPrefix | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Int.parse_u16_kind",
"EverParse3d.Kinds.parser_kind",
"EverParse3d.Kinds.WeakKindStrongPrefix"
] | [] | false | false | false | false | false | let kind____UINT16:parser_kind true WeakKindStrongPrefix =
| LowParse.Spec.BoundedInt.parse_u16_kind | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.mod_trans_lem | val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0)) | val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0)) | let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0) | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 19,
"end_line": 72,
"start_col": 0,
"start_line": 61
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Prims.nat -> b: Prims.pos -> c: Prims.pos
-> FStar.Pervasives.Lemma (requires a % b = 0 /\ b % c = 0) (ensures a % c = 0) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.nat",
"Prims.pos",
"Prims._assert",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Prims.unit",
"FStar.Math.Lemmas.cancel_mul_mod",
"FStar.Mul.op_Star",
"Prims.op_Division",
"FStar.Math.Lemmas.div_exact_r"
] | [] | true | false | true | false | false | let mod_trans_lem a b c =
| let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert (a = b * (a / b));
assert (b = c * (b / c));
assert (a = (c * (b / c)) * (a / (c * (b / c))));
assert (a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert (a % c = 0) | false |
Steel.ST.Effect.Ghost.fst | Steel.ST.Effect.Ghost.lift_ghost_atomic | val lift_ghost_atomic
(a:Type)
(opened:inames)
(#framed:eqtype_as_type bool)
(#[@@@ framing_implicit] pre:pre_t)
(#[@@@ framing_implicit] post:post_t a)
(#[@@@ framing_implicit] req:pure_pre)
(#[@@@ framing_implicit] ens:pure_post a)
(f:STAG.repr a framed opened Unobservable pre post req ens)
: STAG.repr a framed opened Unobservable pre post req ens | val lift_ghost_atomic
(a:Type)
(opened:inames)
(#framed:eqtype_as_type bool)
(#[@@@ framing_implicit] pre:pre_t)
(#[@@@ framing_implicit] post:post_t a)
(#[@@@ framing_implicit] req:pure_pre)
(#[@@@ framing_implicit] ens:pure_post a)
(f:STAG.repr a framed opened Unobservable pre post req ens)
: STAG.repr a framed opened Unobservable pre post req ens | let lift_ghost_atomic
(a:Type)
(opened:inames)
(#framed:eqtype_as_type bool)
(#[@@@ framing_implicit] pre:pre_t)
(#[@@@ framing_implicit] post:post_t a)
(#[@@@ framing_implicit] req:Type0)
(#[@@@ framing_implicit] ens:a -> Type0)
(f:STAG.repr a framed opened Unobservable pre post req ens)
: STAG.repr a framed opened Unobservable pre post req ens
= f | {
"file_name": "lib/steel/Steel.ST.Effect.Ghost.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 5,
"end_line": 38,
"start_col": 0,
"start_line": 28
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.ST.Effect.Ghost
friend Steel.ST.Effect.AtomicAndGhost
friend Steel.Effect.Atomic
open Steel.Memory
module T = FStar.Tactics
module SEA = Steel.Effect.Atomic
/// Any Steel ghost computation can always be lifted to an atomic computation if needed.
/// Note that because SteelGhost is marked as erasable, the F* typechecker will throw an error | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Effect.AtomicAndGhost.fst.checked",
"Steel.Memory.fsti.checked",
"Steel.Effect.Atomic.fst.checked",
"prims.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.NMSTTotal.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.Effect.Ghost.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.Effect.Atomic",
"short_module": "SEA"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.ST.Effect.Atomic",
"short_module": "STA"
},
{
"abbrev": true,
"full_module": "Steel.ST.Effect.AtomicAndGhost",
"short_module": "STAG"
},
{
"abbrev": false,
"full_module": "Steel.Effect.Common",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: Type ->
opened: Steel.Memory.inames ->
f:
Steel.ST.Effect.AtomicAndGhost.repr a
framed
opened
Steel.Effect.Common.Unobservable
pre
post
req
ens
-> Steel.ST.Effect.AtomicAndGhost.repr a
framed
opened
Steel.Effect.Common.Unobservable
pre
post
req
ens | Prims.Tot | [
"total"
] | [] | [
"Steel.Memory.inames",
"FStar.Pervasives.eqtype_as_type",
"Prims.bool",
"Steel.Effect.Common.pre_t",
"Steel.Effect.Common.post_t",
"Steel.ST.Effect.AtomicAndGhost.repr",
"Steel.Effect.Common.Unobservable"
] | [] | false | false | false | false | false | let lift_ghost_atomic
(a: Type)
(opened: inames)
(#framed: eqtype_as_type bool)
(#[@@@ framing_implicit]pre: pre_t)
(#[@@@ framing_implicit]post: post_t a)
(#[@@@ framing_implicit]req: Type0)
(#[@@@ framing_implicit]ens: (a -> Type0))
(f: STAG.repr a framed opened Unobservable pre post req ens)
: STAG.repr a framed opened Unobservable pre post req ens =
| f | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_init | val split_at_last_init (#index: _) (c: block index) (i: index) (b: bytes)
: Lemma
(requires
(let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures
(let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b)) | val split_at_last_init (#index: _) (c: block index) (i: index) (b: bytes)
: Lemma
(requires
(let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures
(let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b)) | let split_at_last_init #index (c: block index) (i: index) (b: bytes) : Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures (
let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b))
=
let l = U32.v (c.blocks_state_len i) in
FStar.Math.Lemmas.multiple_modulo_lemma 0 l;
split_at_last_spec c i b S.empty b | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 188,
"start_col": 0,
"start_line": 178
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest
#pop-options
/// This second lemma is the one we will use
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_spec #index (c: block index) (i: index)
(b blocks rest: bytes):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest)))
(ensures (
(blocks, rest) == split_at_last c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest
#pop-options
/// For the initialization of the streaming state. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Hacl.Streaming.Interface.block index -> i: index -> b: Hacl.Streaming.Spec.bytes
-> FStar.Pervasives.Lemma
(requires
(let l = FStar.UInt32.v (Block?.blocks_state_len c i) in
FStar.Seq.Base.length b <= l))
(ensures
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks rest = _ in
FStar.Seq.Base.equal blocks FStar.Seq.Base.empty /\ FStar.Seq.Base.equal rest b)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"Hacl.Streaming.Spec.split_at_last_spec",
"FStar.Seq.Base.empty",
"Hacl.Streaming.Spec.uint8",
"Prims.unit",
"FStar.Math.Lemmas.multiple_modulo_lemma",
"FStar.UInt.uint_t",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"FStar.Seq.Base.length",
"Prims.squash",
"Prims.l_and",
"FStar.Seq.Base.equal",
"FStar.Pervasives.Native.tuple2",
"Hacl.Streaming.Spec.split_at_last",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let split_at_last_init #index (c: block index) (i: index) (b: bytes)
: Lemma
(requires
(let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures
(let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b)) =
| let l = U32.v (c.blocks_state_len i) in
FStar.Math.Lemmas.multiple_modulo_lemma 0 l;
split_at_last_spec c i b S.empty b | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_num_blocks_spec | val split_at_last_num_blocks_spec (#index: _) (c: block index) (i: index) (b n rest: nat)
: Lemma
(requires
(let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) | val split_at_last_num_blocks_spec (#index: _) (c: block index) (i: index) (b n rest: nat)
: Lemma
(requires
(let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) | let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 154,
"start_col": 0,
"start_line": 146
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Hacl.Streaming.Interface.block index ->
i: index ->
b: Prims.nat ->
n: Prims.nat ->
rest: Prims.nat
-> FStar.Pervasives.Lemma
(requires
(let l = FStar.UInt32.v (Block?.blocks_state_len c i) in
rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest))
(ensures n = Hacl.Streaming.Spec.split_at_last_num_blocks c i b) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Prims.nat",
"Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec",
"FStar.UInt.uint_t",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.l_imp",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Addition",
"FStar.Mul.op_Star",
"Prims.squash",
"Hacl.Streaming.Spec.split_at_last_num_blocks",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let split_at_last_num_blocks_spec #index (c: block index) (i: index) (b: nat) (n: nat) (rest: nat)
: Lemma
(requires
(let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
| let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_spec | val split_at_last_spec (#index: _) (c: block index) (i: index) (b blocks rest: bytes)
: Lemma
(requires
(let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\ S.length rest <= l /\ (S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` (Seq.append blocks rest))))
(ensures ((blocks, rest) == split_at_last c i b)) | val split_at_last_spec (#index: _) (c: block index) (i: index) (b blocks rest: bytes)
: Lemma
(requires
(let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\ S.length rest <= l /\ (S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` (Seq.append blocks rest))))
(ensures ((blocks, rest) == split_at_last c i b)) | let split_at_last_spec #index (c: block index) (i: index)
(b blocks rest: bytes):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest)))
(ensures (
(blocks, rest) == split_at_last c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 64,
"end_line": 172,
"start_col": 0,
"start_line": 160
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest
#pop-options
/// This second lemma is the one we will use
#push-options "--z3cliopt smt.arith.nl=false" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Hacl.Streaming.Interface.block index ->
i: index ->
b: Hacl.Streaming.Spec.bytes ->
blocks: Hacl.Streaming.Spec.bytes ->
rest: Hacl.Streaming.Spec.bytes
-> FStar.Pervasives.Lemma
(requires
(let l = FStar.UInt32.v (Block?.blocks_state_len c i) in
FStar.Seq.Base.length blocks % l = 0 /\ FStar.Seq.Base.length rest <= l /\
(FStar.Seq.Base.length rest = 0 ==> FStar.Seq.Base.length b = 0) /\
FStar.Seq.Base.equal b (FStar.Seq.Base.append blocks rest)))
(ensures (blocks, rest) == Hacl.Streaming.Spec.split_at_last c i b) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec",
"FStar.UInt.uint_t",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"Prims.unit",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Hacl.Streaming.Spec.uint8",
"Prims.op_LessThanOrEqual",
"Prims.l_imp",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.append",
"Prims.squash",
"Prims.eq2",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"Hacl.Streaming.Spec.split_at_last",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let split_at_last_spec #index (c: block index) (i: index) (b: bytes) (blocks: bytes) (rest: bytes)
: Lemma
(requires
(let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\ S.length rest <= l /\ (S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` (Seq.append blocks rest))))
(ensures ((blocks, rest) == split_at_last c i b)) =
| let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_small_exact_empty_data | val split_at_last_small_exact_empty_data (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\ S.length d = 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | val split_at_last_small_exact_empty_data (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\ S.length d = 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | let split_at_last_small_exact_empty_data #index (c: block index) (i: index) (b: bytes)
(d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length d = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
assert(S.append rest d `S.equal` rest);
assert(S.append b d `S.equal` b) | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 260,
"start_col": 0,
"start_line": 245
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest
#pop-options
/// This second lemma is the one we will use
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_spec #index (c: block index) (i: index)
(b blocks rest: bytes):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest)))
(ensures (
(blocks, rest) == split_at_last c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest
#pop-options
/// For the initialization of the streaming state.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_init #index (c: block index) (i: index) (b: bytes) : Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures (
let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b))
=
let l = U32.v (c.blocks_state_len i) in
FStar.Math.Lemmas.multiple_modulo_lemma 0 l;
split_at_last_spec c i b S.empty b
#pop-options
/// "Small" case: not enough data to obtain strictly more than a complete block,
/// so it suffices to append the new input to the internal buffer. Note that we
/// don't process the resulting buffer because we have to make sure there is always
/// some data remaining in it (after the first call to update) so that [update_last]
/// is called on non-empty data at the very end.
///
/// There are many subcases that we prove in intermediate lemmas, until we can
/// get the final [split_at_last_small] theorem.
/// [b]: internal buffer
/// [d]: data to append
/// "Small" case: subcase 1: not enough data to obtain a complete block append the
/// new input to the internal buffer.
let split_at_last_small_strict #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
split_at_last_spec c i (S.append b d) blocks (S.append rest d)
/// "Small" case: subcase 2: exactly enough data to obtain a complete block, and the
/// internal buffer is empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact_empty_internal #index (c: block index) (i: index) (b: bytes) (d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
(* The proof is trivial because [b] is empty *)
assert(b `Seq.equal` Seq.empty);
assert(S.append b d `Seq.equal` d);
assert(S.append rest d `Seq.equal` d)
#pop-options
/// "Small" case 3: exactly enough data to obtain a complete block, and the data to
/// add is empty. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Hacl.Streaming.Interface.block index ->
i: index ->
b: Hacl.Streaming.Spec.bytes ->
d: Hacl.Streaming.Spec.bytes
-> FStar.Pervasives.Lemma
(requires
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ _ rest = _ in
FStar.Seq.Base.length rest + FStar.Seq.Base.length d =
FStar.UInt32.v (Block?.blocks_state_len c i) /\ FStar.Seq.Base.length d = 0)
<:
Type0))
(ensures
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks rest = _ in
let _ = Hacl.Streaming.Spec.split_at_last c i (FStar.Seq.Base.append b d) in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks' rest' = _ in
FStar.Seq.Base.equal blocks blocks' /\
FStar.Seq.Base.equal (FStar.Seq.Base.append rest d) rest')
<:
Type0)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"Prims._assert",
"FStar.Seq.Base.equal",
"Hacl.Streaming.Spec.uint8",
"FStar.Seq.Base.append",
"Prims.unit",
"FStar.Pervasives.Native.tuple2",
"Hacl.Streaming.Spec.split_at_last",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Addition",
"FStar.Seq.Base.length",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let split_at_last_small_exact_empty_data #index (c: block index) (i: index) (b: bytes) (d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\ S.length d = 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) =
| let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
assert ((S.append rest d) `S.equal` rest);
assert ((S.append b d) `S.equal` b) | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last | val split_at_last (#index: _) (c: block index) (i: index) (b: bytes)
: Pure (bytes & bytes)
(requires True)
(ensures
(fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\ (S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==> (S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==> (S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\ S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks)) | val split_at_last (#index: _) (c: block index) (i: index) (b: bytes)
: Pure (bytes & bytes)
(requires True)
(ensures
(fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\ (S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==> (S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==> (S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\ S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks)) | let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 135,
"start_col": 0,
"start_line": 108
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Hacl.Streaming.Interface.block index -> i: index -> b: Hacl.Streaming.Spec.bytes
-> Prims.Pure (Hacl.Streaming.Spec.bytes * Hacl.Streaming.Spec.bytes) | Prims.Pure | [] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"FStar.Seq.Base.seq",
"Lib.UpdateMulti.uint8",
"FStar.Pervasives.Native.Mktuple2",
"Prims.unit",
"Hacl.Streaming.Spec.mod_trans_lem",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__block_len",
"Prims.nat",
"FStar.Seq.Base.length",
"FStar.UInt.uint_t",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"FStar.Pervasives.Native.tuple2",
"Lib.UpdateMulti.split_at_last_lazy",
"Prims.l_True",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Hacl.Streaming.Spec.uint8",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Modulus",
"Prims.l_or",
"Prims.op_GreaterThanOrEqual",
"FStar.UInt.size",
"FStar.UInt32.n",
"Prims.l_iff",
"Prims.eq2",
"FStar.Mul.op_Star",
"Prims.op_Subtraction",
"Prims.op_Division",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"Prims.op_disEquality",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.append"
] | [] | false | false | false | false | false | let split_at_last #index (c: block index) (i: index) (b: bytes)
: Pure (bytes & bytes)
(requires True)
(ensures
(fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\ (S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==> (S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==> (S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\ S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks)) =
| let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
(let l = U32.v (c.blocks_state_len i) in
let blocks = S.length blocks in
mod_trans_lem blocks l (U32.v (c.block_len i)));
blocks, rest | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_small_exact_empty_internal | val split_at_last_small_exact_empty_internal (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\ S.length rest = 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | val split_at_last_small_exact_empty_internal (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\ S.length rest = 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | let split_at_last_small_exact_empty_internal #index (c: block index) (i: index) (b: bytes) (d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
(* The proof is trivial because [b] is empty *)
assert(b `Seq.equal` Seq.empty);
assert(S.append b d `Seq.equal` d);
assert(S.append rest d `Seq.equal` d) | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 39,
"end_line": 238,
"start_col": 0,
"start_line": 223
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest
#pop-options
/// This second lemma is the one we will use
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_spec #index (c: block index) (i: index)
(b blocks rest: bytes):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest)))
(ensures (
(blocks, rest) == split_at_last c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest
#pop-options
/// For the initialization of the streaming state.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_init #index (c: block index) (i: index) (b: bytes) : Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures (
let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b))
=
let l = U32.v (c.blocks_state_len i) in
FStar.Math.Lemmas.multiple_modulo_lemma 0 l;
split_at_last_spec c i b S.empty b
#pop-options
/// "Small" case: not enough data to obtain strictly more than a complete block,
/// so it suffices to append the new input to the internal buffer. Note that we
/// don't process the resulting buffer because we have to make sure there is always
/// some data remaining in it (after the first call to update) so that [update_last]
/// is called on non-empty data at the very end.
///
/// There are many subcases that we prove in intermediate lemmas, until we can
/// get the final [split_at_last_small] theorem.
/// [b]: internal buffer
/// [d]: data to append
/// "Small" case: subcase 1: not enough data to obtain a complete block append the
/// new input to the internal buffer.
let split_at_last_small_strict #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
split_at_last_spec c i (S.append b d) blocks (S.append rest d)
/// "Small" case: subcase 2: exactly enough data to obtain a complete block, and the
/// internal buffer is empty. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Hacl.Streaming.Interface.block index ->
i: index ->
b: Hacl.Streaming.Spec.bytes ->
d: Hacl.Streaming.Spec.bytes
-> FStar.Pervasives.Lemma
(requires
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ _ rest = _ in
FStar.Seq.Base.length rest + FStar.Seq.Base.length d =
FStar.UInt32.v (Block?.blocks_state_len c i) /\ FStar.Seq.Base.length rest = 0)
<:
Type0))
(ensures
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks rest = _ in
let _ = Hacl.Streaming.Spec.split_at_last c i (FStar.Seq.Base.append b d) in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks' rest' = _ in
FStar.Seq.Base.equal blocks blocks' /\
FStar.Seq.Base.equal (FStar.Seq.Base.append rest d) rest')
<:
Type0)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"Prims._assert",
"FStar.Seq.Base.equal",
"Hacl.Streaming.Spec.uint8",
"FStar.Seq.Base.append",
"Prims.unit",
"FStar.Seq.Base.empty",
"FStar.Pervasives.Native.tuple2",
"Hacl.Streaming.Spec.split_at_last",
"Prims.l_and",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.op_Addition",
"FStar.Seq.Base.length",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let split_at_last_small_exact_empty_internal
#index
(c: block index)
(i: index)
(b: bytes)
(d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\ S.length rest = 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) =
| let blocks, rest = split_at_last c i b in
assert (b `Seq.equal` Seq.empty);
assert ((S.append b d) `Seq.equal` d);
assert ((S.append rest d) `Seq.equal` d) | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_small_exact | val split_at_last_small_exact (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\ S.length rest > 0 /\
S.length d > 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | val split_at_last_small_exact (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\ S.length rest > 0 /\
S.length d > 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | let split_at_last_small_exact #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest > 0 /\ S.length d > 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
let n = S.length blocks / l in
assert(S.length blocks % l = 0); (* comes from the spec of [split_at_last] *)
assert(S.length (S.append rest d) = l);
assert((S.append b d) `Seq.equal` Seq.append blocks (Seq.append rest d));
split_at_last_spec c i (S.append b d) blocks (S.append rest d) | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 64,
"end_line": 285,
"start_col": 0,
"start_line": 267
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest
#pop-options
/// This second lemma is the one we will use
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_spec #index (c: block index) (i: index)
(b blocks rest: bytes):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest)))
(ensures (
(blocks, rest) == split_at_last c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest
#pop-options
/// For the initialization of the streaming state.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_init #index (c: block index) (i: index) (b: bytes) : Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures (
let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b))
=
let l = U32.v (c.blocks_state_len i) in
FStar.Math.Lemmas.multiple_modulo_lemma 0 l;
split_at_last_spec c i b S.empty b
#pop-options
/// "Small" case: not enough data to obtain strictly more than a complete block,
/// so it suffices to append the new input to the internal buffer. Note that we
/// don't process the resulting buffer because we have to make sure there is always
/// some data remaining in it (after the first call to update) so that [update_last]
/// is called on non-empty data at the very end.
///
/// There are many subcases that we prove in intermediate lemmas, until we can
/// get the final [split_at_last_small] theorem.
/// [b]: internal buffer
/// [d]: data to append
/// "Small" case: subcase 1: not enough data to obtain a complete block append the
/// new input to the internal buffer.
let split_at_last_small_strict #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
split_at_last_spec c i (S.append b d) blocks (S.append rest d)
/// "Small" case: subcase 2: exactly enough data to obtain a complete block, and the
/// internal buffer is empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact_empty_internal #index (c: block index) (i: index) (b: bytes) (d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
(* The proof is trivial because [b] is empty *)
assert(b `Seq.equal` Seq.empty);
assert(S.append b d `Seq.equal` d);
assert(S.append rest d `Seq.equal` d)
#pop-options
/// "Small" case 3: exactly enough data to obtain a complete block, and the data to
/// add is empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact_empty_data #index (c: block index) (i: index) (b: bytes)
(d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length d = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
assert(S.append rest d `S.equal` rest);
assert(S.append b d `S.equal` b)
#pop-options
/// "Small" case 4: exactly enough data to obtain a complete block, the internal
/// buffer is not empty and the data to add is not empty. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Hacl.Streaming.Interface.block index ->
i: index ->
b: Hacl.Streaming.Spec.bytes ->
d: Hacl.Streaming.Spec.bytes
-> FStar.Pervasives.Lemma
(requires
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ _ rest = _ in
FStar.Seq.Base.length rest + FStar.Seq.Base.length d =
FStar.UInt32.v (Block?.blocks_state_len c i) /\ FStar.Seq.Base.length rest > 0 /\
FStar.Seq.Base.length d > 0)
<:
Type0))
(ensures
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks rest = _ in
let _ = Hacl.Streaming.Spec.split_at_last c i (FStar.Seq.Base.append b d) in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks' rest' = _ in
FStar.Seq.Base.equal blocks blocks' /\
FStar.Seq.Base.equal (FStar.Seq.Base.append rest d) rest')
<:
Type0)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"Hacl.Streaming.Spec.split_at_last_spec",
"FStar.Seq.Base.append",
"Hacl.Streaming.Spec.uint8",
"Prims.unit",
"Prims._assert",
"FStar.Seq.Base.equal",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt32.n",
"Prims.op_GreaterThanOrEqual",
"FStar.Seq.Base.length",
"Prims.op_Modulus",
"Prims.op_Division",
"FStar.UInt.uint_t",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"FStar.Pervasives.Native.tuple2",
"Hacl.Streaming.Spec.split_at_last",
"Prims.l_and",
"Prims.op_Addition",
"Prims.op_GreaterThan",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let split_at_last_small_exact #index (c: block index) (i: index) (b: bytes) (d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\ S.length rest > 0 /\
S.length d > 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) =
| let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
let n = S.length blocks / l in
assert (S.length blocks % l = 0);
assert (S.length (S.append rest d) = l);
assert ((S.append b d) `Seq.equal` (Seq.append blocks (Seq.append rest d)));
split_at_last_spec c i (S.append b d) blocks (S.append rest d) | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_num_blocks | val split_at_last_num_blocks (#index: _) (c: block index) (i: index) (b: nat)
: Pure nat
(requires True)
(ensures
(fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\ (rest % l = b % l) /\ (rest = b % l \/ rest = l) /\ (rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\ ((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\ blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\ (blocks / l) * l = blocks)) | val split_at_last_num_blocks (#index: _) (c: block index) (i: index) (b: nat)
: Pure nat
(requires True)
(ensures
(fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\ (rest % l = b % l) /\ (rest = b % l \/ rest = l) /\ (rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\ ((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\ blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\ (blocks / l) * l = blocks)) | let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 103,
"start_col": 0,
"start_line": 77
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false" | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Hacl.Streaming.Interface.block index -> i: index -> b: Prims.nat -> Prims.Pure Prims.nat | Prims.Pure | [] | [] | [
"Hacl.Streaming.Interface.block",
"Prims.nat",
"Prims.unit",
"Hacl.Streaming.Spec.mod_trans_lem",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__block_len",
"FStar.Math.Lemmas.nat_times_nat_is_nat",
"Prims.int",
"FStar.Mul.op_Star",
"FStar.UInt.uint_t",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"FStar.Pervasives.Native.fst",
"Lib.UpdateMulti.split_at_last_lazy_nb_rem",
"Prims.l_True",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Equality",
"Prims.op_Modulus",
"Prims.l_or",
"Prims.l_iff",
"Prims.eq2",
"Prims.op_Subtraction",
"Prims.op_Division",
"Prims.op_GreaterThan",
"Prims.op_LessThan",
"Prims.op_disEquality"
] | [] | false | false | false | false | false | let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat)
: Pure nat
(requires True)
(ensures
(fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\ (rest % l = b % l) /\ (rest = b % l \/ rest = l) /\ (rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\ ((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\ blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\ (blocks / l) * l = blocks)) =
| let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
(let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
Math.Lemmas.nat_times_nat_is_nat n l;
mod_trans_lem blocks l (U32.v (c.block_len i)));
n | false |
FStar.Sealed.Inhabited.fst | FStar.Sealed.Inhabited.sealed_ | val sealed_ (#a: Type u#a) (witness: a) : Type u#0 | val sealed_ (#a: Type u#a) (witness: a) : Type u#0 | let sealed_ (#a:Type u#a)
(witness:a)
: Type u#0
= FStar.Sealed.sealed a | {
"file_name": "ulib/FStar.Sealed.Inhabited.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 25,
"end_line": 33,
"start_col": 0,
"start_line": 30
} | (*
Copyright 2023 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.
Authors: G. Martinez, N. Swamy
*)
module FStar.Sealed.Inhabited
(* This module provides an instance of FStar.Sealed.sealed
specialized for inhabited types.
The main type `sealed w` is the singleton type of a sealed values
that is provably equal to `seal w`.
This type `sealed_` is not intended for use by clients, it is exposed
only to enable writing an SMT pattern. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Sealed.Inhabited.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | witness: a -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Sealed.sealed"
] | [] | false | false | false | true | true | let sealed_ (#a: Type u#a) (witness: a) : Type u#0 =
| FStar.Sealed.sealed a | false |
FStar.Sealed.Inhabited.fst | FStar.Sealed.Inhabited.is_sealed | val is_sealed (#a: Type u#a) (#witness: a) (x: sealed_ witness) : prop | val is_sealed (#a: Type u#a) (#witness: a) (x: sealed_ witness) : prop | let is_sealed (#a:Type u#a)
(#witness:a)
(x:sealed_ witness)
: prop
= True | {
"file_name": "ulib/FStar.Sealed.Inhabited.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 8,
"end_line": 40,
"start_col": 0,
"start_line": 36
} | (*
Copyright 2023 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.
Authors: G. Martinez, N. Swamy
*)
module FStar.Sealed.Inhabited
(* This module provides an instance of FStar.Sealed.sealed
specialized for inhabited types.
The main type `sealed w` is the singleton type of a sealed values
that is provably equal to `seal w`.
This type `sealed_` is not intended for use by clients, it is exposed
only to enable writing an SMT pattern.
*)
let sealed_ (#a:Type u#a)
(witness:a)
: Type u#0
= FStar.Sealed.sealed a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Sealed.Inhabited.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: FStar.Sealed.Inhabited.sealed_ witness -> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"FStar.Sealed.Inhabited.sealed_",
"Prims.l_True",
"Prims.prop"
] | [] | false | false | false | false | true | let is_sealed (#a: Type u#a) (#witness: a) (x: sealed_ witness) : prop =
| True | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_small_strict | val split_at_last_small_strict (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | val split_at_last_small_strict (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | let split_at_last_small_strict #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
split_at_last_spec c i (S.append b d) blocks (S.append rest d) | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 64,
"end_line": 217,
"start_col": 0,
"start_line": 205
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest
#pop-options
/// This second lemma is the one we will use
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_spec #index (c: block index) (i: index)
(b blocks rest: bytes):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest)))
(ensures (
(blocks, rest) == split_at_last c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest
#pop-options
/// For the initialization of the streaming state.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_init #index (c: block index) (i: index) (b: bytes) : Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures (
let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b))
=
let l = U32.v (c.blocks_state_len i) in
FStar.Math.Lemmas.multiple_modulo_lemma 0 l;
split_at_last_spec c i b S.empty b
#pop-options
/// "Small" case: not enough data to obtain strictly more than a complete block,
/// so it suffices to append the new input to the internal buffer. Note that we
/// don't process the resulting buffer because we have to make sure there is always
/// some data remaining in it (after the first call to update) so that [update_last]
/// is called on non-empty data at the very end.
///
/// There are many subcases that we prove in intermediate lemmas, until we can
/// get the final [split_at_last_small] theorem.
/// [b]: internal buffer
/// [d]: data to append
/// "Small" case: subcase 1: not enough data to obtain a complete block append the
/// new input to the internal buffer. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Hacl.Streaming.Interface.block index ->
i: index ->
b: Hacl.Streaming.Spec.bytes ->
d: Hacl.Streaming.Spec.bytes
-> FStar.Pervasives.Lemma
(requires
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ _ rest = _ in
FStar.Seq.Base.length rest + FStar.Seq.Base.length d <
FStar.UInt32.v (Block?.blocks_state_len c i))
<:
Type0))
(ensures
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks rest = _ in
let _ = Hacl.Streaming.Spec.split_at_last c i (FStar.Seq.Base.append b d) in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks' rest' = _ in
FStar.Seq.Base.equal blocks blocks' /\
FStar.Seq.Base.equal (FStar.Seq.Base.append rest d) rest')
<:
Type0)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"Hacl.Streaming.Spec.split_at_last_spec",
"FStar.Seq.Base.append",
"Hacl.Streaming.Spec.uint8",
"FStar.UInt.uint_t",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"Prims.unit",
"FStar.Pervasives.Native.tuple2",
"Hacl.Streaming.Spec.split_at_last",
"Prims.b2t",
"Prims.op_LessThan",
"Prims.op_Addition",
"FStar.Seq.Base.length",
"Prims.squash",
"Prims.l_and",
"FStar.Seq.Base.equal",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let split_at_last_small_strict #index (c: block index) (i: index) (b: bytes) (d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) =
| let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
split_at_last_spec c i (S.append b d) blocks (S.append rest d) | false |
Steel.ST.Effect.Ghost.fst | Steel.ST.Effect.Ghost.admit_ | val admit_ (#a:Type)
(#opened:inames)
(#p:pre_t)
(#q:post_t a)
(_:unit)
: STGhostF a opened p q True (fun _ -> False) | val admit_ (#a:Type)
(#opened:inames)
(#p:pre_t)
(#q:post_t a)
(_:unit)
: STGhostF a opened p q True (fun _ -> False) | let admit_ _ = STGhostF?.reflect (fun _ -> NMSTTotal.nmst_tot_admit ()) | {
"file_name": "lib/steel/Steel.ST.Effect.Ghost.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 71,
"end_line": 72,
"start_col": 0,
"start_line": 72
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.ST.Effect.Ghost
friend Steel.ST.Effect.AtomicAndGhost
friend Steel.Effect.Atomic
open Steel.Memory
module T = FStar.Tactics
module SEA = Steel.Effect.Atomic
/// Any Steel ghost computation can always be lifted to an atomic computation if needed.
/// Note that because SteelGhost is marked as erasable, the F* typechecker will throw an error
/// if this lift is applied to a ghost computation with an informative return value
let lift_ghost_atomic
(a:Type)
(opened:inames)
(#framed:eqtype_as_type bool)
(#[@@@ framing_implicit] pre:pre_t)
(#[@@@ framing_implicit] post:post_t a)
(#[@@@ framing_implicit] req:Type0)
(#[@@@ framing_implicit] ens:a -> Type0)
(f:STAG.repr a framed opened Unobservable pre post req ens)
: STAG.repr a framed opened Unobservable pre post req ens
= f
let as_atomic_action_ghost (#a:Type u#a)
(#opened_invariants:inames)
(#fp:slprop)
(#fp': a -> slprop)
(f:action_except a opened_invariants fp fp')
: STGhostT a opened_invariants (to_vprop fp) (fun x -> to_vprop (fp' x))
= let ff = SEA.reify_steel_ghost_comp (fun _ -> SEA.as_atomic_action_ghost f) in
STGhostBase?.reflect ff
let extract_fact0 (#opened:inames)
(p:vprop)
(fact:prop)
(l:(m:mem) -> Lemma
(requires interp (hp_of p) m)
(ensures fact))
: STAG.repr unit false opened Unobservable p (fun _ -> p) True (fun _ -> fact)
= fun frame ->
let m0:full_mem = NMSTTotal.get () in
Classical.forall_intro_3 reveal_mk_rmem;
let h0 = mk_rmem p (core_mem m0) in
l (core_mem m0)
let extract_fact (#opened:inames)
(p:vprop)
(fact:prop)
(l:(m:mem) -> Lemma
(requires interp (hp_of p) m)
(ensures fact))
: STGhost unit opened p (fun _ -> p) True (fun _ -> fact)
= STGhostBase?.reflect (extract_fact0 p fact l) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Effect.AtomicAndGhost.fst.checked",
"Steel.Memory.fsti.checked",
"Steel.Effect.Atomic.fst.checked",
"prims.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.NMSTTotal.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.Effect.Ghost.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.Effect.Atomic",
"short_module": "SEA"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.ST.Effect.Atomic",
"short_module": "STA"
},
{
"abbrev": true,
"full_module": "Steel.ST.Effect.AtomicAndGhost",
"short_module": "STAG"
},
{
"abbrev": false,
"full_module": "Steel.Effect.Common",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> Steel.ST.Effect.Ghost.STGhostF a | Steel.ST.Effect.Ghost.STGhostF | [] | [] | [
"Steel.Memory.inames",
"Steel.Effect.Common.pre_t",
"Steel.Effect.Common.post_t",
"Prims.unit",
"Steel.Memory.slprop",
"FStar.NMSTTotal.nmst_tot_admit",
"Steel.Memory.full_mem",
"Steel.Memory.mem_evolves",
"Prims.l_True",
"Prims.l_False"
] | [] | false | true | false | false | false | let admit_ _ =
| STGhostF?.reflect (fun _ -> NMSTTotal.nmst_tot_admit ()) | false |
FStar.Sealed.Inhabited.fst | FStar.Sealed.Inhabited.sealed | val sealed (#a: Type u#a) (witness: a) : Type u#0 | val sealed (#a: Type u#a) (witness: a) : Type u#0 | let sealed (#a:Type u#a)
(witness:a)
: Type u#0
= s:sealed_ witness { is_sealed s } | {
"file_name": "ulib/FStar.Sealed.Inhabited.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 45,
"start_col": 0,
"start_line": 42
} | (*
Copyright 2023 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.
Authors: G. Martinez, N. Swamy
*)
module FStar.Sealed.Inhabited
(* This module provides an instance of FStar.Sealed.sealed
specialized for inhabited types.
The main type `sealed w` is the singleton type of a sealed values
that is provably equal to `seal w`.
This type `sealed_` is not intended for use by clients, it is exposed
only to enable writing an SMT pattern.
*)
let sealed_ (#a:Type u#a)
(witness:a)
: Type u#0
= FStar.Sealed.sealed a
(* A trivial predicate, just for writing an SMT pattern on sealed_singleton *)
let is_sealed (#a:Type u#a)
(#witness:a)
(x:sealed_ witness)
: prop
= True | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Sealed.Inhabited.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | witness: a -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Sealed.Inhabited.sealed_",
"FStar.Sealed.Inhabited.is_sealed"
] | [] | false | false | false | true | true | let sealed (#a: Type u#a) (witness: a) : Type u#0 =
| s: sealed_ witness {is_sealed s} | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_small | val split_at_last_small (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d <= U32.v (c.blocks_state_len i)))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | val split_at_last_small (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d <= U32.v (c.blocks_state_len i)))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) | let split_at_last_small #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d <= U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
if S.length rest + S.length d < l then
split_at_last_small_strict c i b d
else if S.length rest = 0 then
split_at_last_small_exact_empty_internal c i b d
else if S.length d = 0 then
split_at_last_small_exact_empty_data c i b d
else split_at_last_small_exact c i b d | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 40,
"end_line": 310,
"start_col": 0,
"start_line": 291
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest
#pop-options
/// This second lemma is the one we will use
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_spec #index (c: block index) (i: index)
(b blocks rest: bytes):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest)))
(ensures (
(blocks, rest) == split_at_last c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest
#pop-options
/// For the initialization of the streaming state.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_init #index (c: block index) (i: index) (b: bytes) : Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures (
let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b))
=
let l = U32.v (c.blocks_state_len i) in
FStar.Math.Lemmas.multiple_modulo_lemma 0 l;
split_at_last_spec c i b S.empty b
#pop-options
/// "Small" case: not enough data to obtain strictly more than a complete block,
/// so it suffices to append the new input to the internal buffer. Note that we
/// don't process the resulting buffer because we have to make sure there is always
/// some data remaining in it (after the first call to update) so that [update_last]
/// is called on non-empty data at the very end.
///
/// There are many subcases that we prove in intermediate lemmas, until we can
/// get the final [split_at_last_small] theorem.
/// [b]: internal buffer
/// [d]: data to append
/// "Small" case: subcase 1: not enough data to obtain a complete block append the
/// new input to the internal buffer.
let split_at_last_small_strict #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
split_at_last_spec c i (S.append b d) blocks (S.append rest d)
/// "Small" case: subcase 2: exactly enough data to obtain a complete block, and the
/// internal buffer is empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact_empty_internal #index (c: block index) (i: index) (b: bytes) (d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
(* The proof is trivial because [b] is empty *)
assert(b `Seq.equal` Seq.empty);
assert(S.append b d `Seq.equal` d);
assert(S.append rest d `Seq.equal` d)
#pop-options
/// "Small" case 3: exactly enough data to obtain a complete block, and the data to
/// add is empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact_empty_data #index (c: block index) (i: index) (b: bytes)
(d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length d = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
assert(S.append rest d `S.equal` rest);
assert(S.append b d `S.equal` b)
#pop-options
/// "Small" case 4: exactly enough data to obtain a complete block, the internal
/// buffer is not empty and the data to add is not empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest > 0 /\ S.length d > 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
let n = S.length blocks / l in
assert(S.length blocks % l = 0); (* comes from the spec of [split_at_last] *)
assert(S.length (S.append rest d) = l);
assert((S.append b d) `Seq.equal` Seq.append blocks (Seq.append rest d));
split_at_last_spec c i (S.append b d) blocks (S.append rest d)
#pop-options
/// "Small" case: final theorem: not enough data to obtain strictly more than a
/// complete block, so it suffices to append the new input to the internal buffer. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Hacl.Streaming.Interface.block index ->
i: index ->
b: Hacl.Streaming.Spec.bytes ->
d: Hacl.Streaming.Spec.bytes
-> FStar.Pervasives.Lemma
(requires
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ _ rest = _ in
FStar.Seq.Base.length rest + FStar.Seq.Base.length d <=
FStar.UInt32.v (Block?.blocks_state_len c i))
<:
Type0))
(ensures
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks rest = _ in
let _ = Hacl.Streaming.Spec.split_at_last c i (FStar.Seq.Base.append b d) in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks' rest' = _ in
FStar.Seq.Base.equal blocks blocks' /\
FStar.Seq.Base.equal (FStar.Seq.Base.append rest d) rest')
<:
Type0)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"Prims.op_LessThan",
"Prims.op_Addition",
"FStar.Seq.Base.length",
"Hacl.Streaming.Spec.uint8",
"Hacl.Streaming.Spec.split_at_last_small_strict",
"Prims.bool",
"Prims.op_Equality",
"Prims.int",
"Hacl.Streaming.Spec.split_at_last_small_exact_empty_internal",
"Hacl.Streaming.Spec.split_at_last_small_exact_empty_data",
"Hacl.Streaming.Spec.split_at_last_small_exact",
"Prims.unit",
"FStar.UInt.uint_t",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"FStar.Pervasives.Native.tuple2",
"Hacl.Streaming.Spec.split_at_last",
"FStar.Seq.Base.append",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.squash",
"Prims.l_and",
"FStar.Seq.Base.equal",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let split_at_last_small #index (c: block index) (i: index) (b: bytes) (d: bytes)
: Lemma
(requires
(let _, rest = split_at_last c i b in
S.length rest + S.length d <= U32.v (c.blocks_state_len i)))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest')) =
| let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
if S.length rest + S.length d < l
then split_at_last_small_strict c i b d
else
if S.length rest = 0
then split_at_last_small_exact_empty_internal c i b d
else
if S.length d = 0
then split_at_last_small_exact_empty_data c i b d
else split_at_last_small_exact c i b d | false |
FStar.Sealed.Inhabited.fst | FStar.Sealed.Inhabited.seal | val seal (#a: Type u#a) (#w x: a) : sealed w | val seal (#a: Type u#a) (#w x: a) : sealed w | let seal (#a:Type u#a) (#w:a) (x:a)
: sealed w
= FStar.Sealed.seal x | {
"file_name": "ulib/FStar.Sealed.Inhabited.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 23,
"end_line": 50,
"start_col": 0,
"start_line": 48
} | (*
Copyright 2023 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.
Authors: G. Martinez, N. Swamy
*)
module FStar.Sealed.Inhabited
(* This module provides an instance of FStar.Sealed.sealed
specialized for inhabited types.
The main type `sealed w` is the singleton type of a sealed values
that is provably equal to `seal w`.
This type `sealed_` is not intended for use by clients, it is exposed
only to enable writing an SMT pattern.
*)
let sealed_ (#a:Type u#a)
(witness:a)
: Type u#0
= FStar.Sealed.sealed a
(* A trivial predicate, just for writing an SMT pattern on sealed_singleton *)
let is_sealed (#a:Type u#a)
(#witness:a)
(x:sealed_ witness)
: prop
= True
let sealed (#a:Type u#a)
(witness:a)
: Type u#0
= s:sealed_ witness { is_sealed s } | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Sealed.Inhabited.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | x: a -> FStar.Sealed.Inhabited.sealed w | Prims.Tot | [
"total"
] | [] | [
"FStar.Sealed.seal",
"FStar.Sealed.Inhabited.sealed"
] | [] | false | false | false | false | false | let seal (#a: Type u#a) (#w x: a) : sealed w =
| FStar.Sealed.seal x | false |
FStar.Heap.fst | FStar.Heap.trivial_rel | val trivial_rel (a: Type0) : Preorder.relation a | val trivial_rel (a: Type0) : Preorder.relation a | let trivial_rel (a:Type0) :Preorder.relation a = fun x y -> True | {
"file_name": "ulib/FStar.Heap.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 64,
"end_line": 20,
"start_col": 0,
"start_line": 20
} | (*
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.Heap
include FStar.Monotonic.Heap | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Heap.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Heap.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type0 -> FStar.Preorder.relation a | Prims.Tot | [
"total"
] | [] | [
"Prims.l_True",
"FStar.Preorder.relation"
] | [] | false | false | false | true | false | let trivial_rel (a: Type0) : Preorder.relation a =
| fun x y -> True | false |
FStar.Sealed.Inhabited.fst | FStar.Sealed.Inhabited.sealed_singleton | val sealed_singleton (a: Type u#a) (w: a) (x: sealed w)
: Lemma (x == seal #a #w w) [SMTPat (is_sealed #a #w x)] | val sealed_singleton (a: Type u#a) (w: a) (x: sealed w)
: Lemma (x == seal #a #w w) [SMTPat (is_sealed #a #w x)] | let sealed_singleton (a:Type u#a) (w:a) (x:sealed w)
: Lemma (x == seal #a #w w)
[SMTPat (is_sealed #a #w x)]
= FStar.Sealed.sealed_singl x (seal #a #w w) | {
"file_name": "ulib/FStar.Sealed.Inhabited.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 46,
"end_line": 57,
"start_col": 0,
"start_line": 54
} | (*
Copyright 2023 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.
Authors: G. Martinez, N. Swamy
*)
module FStar.Sealed.Inhabited
(* This module provides an instance of FStar.Sealed.sealed
specialized for inhabited types.
The main type `sealed w` is the singleton type of a sealed values
that is provably equal to `seal w`.
This type `sealed_` is not intended for use by clients, it is exposed
only to enable writing an SMT pattern.
*)
let sealed_ (#a:Type u#a)
(witness:a)
: Type u#0
= FStar.Sealed.sealed a
(* A trivial predicate, just for writing an SMT pattern on sealed_singleton *)
let is_sealed (#a:Type u#a)
(#witness:a)
(x:sealed_ witness)
: prop
= True
let sealed (#a:Type u#a)
(witness:a)
: Type u#0
= s:sealed_ witness { is_sealed s }
(* Sealing a value `x:a` at the type `sealed w` *)
let seal (#a:Type u#a) (#w:a) (x:a)
: sealed w
= FStar.Sealed.seal x
(* A lemma with an SMT pattern for automatically proving that a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Sealed.fsti.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Sealed.Inhabited.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Sealed",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type -> w: a -> x: FStar.Sealed.Inhabited.sealed w
-> FStar.Pervasives.Lemma (ensures x == FStar.Sealed.Inhabited.seal w)
[SMTPat (FStar.Sealed.Inhabited.is_sealed x)] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Sealed.Inhabited.sealed",
"FStar.Sealed.sealed_singl",
"FStar.Sealed.Inhabited.seal",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.prop",
"FStar.Sealed.Inhabited.is_sealed",
"Prims.Nil"
] | [] | true | false | true | false | false | let sealed_singleton (a: Type u#a) (w: a) (x: sealed w)
: Lemma (x == seal #a #w w) [SMTPat (is_sealed #a #w x)] =
| FStar.Sealed.sealed_singl x (seal #a #w w) | false |
LowParse.Low.Option.fst | LowParse.Low.Option.validate_option | val validate_option (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p)
: Tot (validator (parse_option p)) | val validate_option (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p)
: Tot (validator (parse_option p)) | let validate_option (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p) : Tot (validator (parse_option p)) =
fun #rrel #rel input pos ->
let h = HST.get () in
[@inline_let] let _ = valid_facts (parse_option p) h input (uint64_to_uint32 pos) in
[@inline_let] let _ = valid_facts p h input (uint64_to_uint32 pos) in
let r = v input pos in
if is_error r
then pos
else r | {
"file_name": "src/lowparse/LowParse.Low.Option.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 8,
"end_line": 19,
"start_col": 0,
"start_line": 11
} | module LowParse.Low.Option
include LowParse.Spec.Option
include LowParse.Low.Base
module HST = FStar.HyperStack.ST
module U32 = FStar.UInt32
module U64 = FStar.UInt64
module Cast = FStar.Int.Cast | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Option.fst.checked",
"LowParse.Low.Base.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Int.Cast.fst.checked",
"FStar.HyperStack.ST.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Low.Option.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Int.Cast",
"short_module": "Cast"
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "HST"
},
{
"abbrev": false,
"full_module": "LowParse.Low.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Option",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Low",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Low",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | v: LowParse.Low.Base.validator p
-> LowParse.Low.Base.validator (LowParse.Spec.Option.parse_option p) | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Low.Base.validator",
"LowParse.Slice.srel",
"LowParse.Bytes.byte",
"LowParse.Slice.slice",
"FStar.UInt64.t",
"LowParse.Low.ErrorCode.is_error",
"Prims.bool",
"Prims.unit",
"LowParse.Low.Base.Spec.valid_facts",
"LowParse.Low.ErrorCode.uint64_to_uint32",
"LowParse.Spec.Option.parse_option_kind",
"FStar.Pervasives.Native.option",
"LowParse.Spec.Option.parse_option",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get"
] | [] | false | false | false | false | false | let validate_option (#k: parser_kind) (#t: Type) (#p: parser k t) (v: validator p)
: Tot (validator (parse_option p)) =
| fun #rrel #rel input pos ->
let h = HST.get () in
[@@ inline_let ]let _ = valid_facts (parse_option p) h input (uint64_to_uint32 pos) in
[@@ inline_let ]let _ = valid_facts p h input (uint64_to_uint32 pos) in
let r = v input pos in
if is_error r then pos else r | false |
FStar.Heap.fst | FStar.Heap.trivial_preorder | val trivial_preorder (a: Type0) : Preorder.preorder a | val trivial_preorder (a: Type0) : Preorder.preorder a | let trivial_preorder (a:Type0) :Preorder.preorder a = trivial_rel a | {
"file_name": "ulib/FStar.Heap.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 67,
"end_line": 22,
"start_col": 0,
"start_line": 22
} | (*
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.Heap
include FStar.Monotonic.Heap
let trivial_rel (a:Type0) :Preorder.relation a = fun x y -> True | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Preorder.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Monotonic.Heap.fsti.checked"
],
"interface_file": false,
"source_file": "FStar.Heap.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Monotonic.Heap",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type0 -> FStar.Preorder.preorder a | Prims.Tot | [
"total"
] | [] | [
"FStar.Heap.trivial_rel",
"FStar.Preorder.preorder"
] | [] | false | false | false | true | false | let trivial_preorder (a: Type0) : Preorder.preorder a =
| trivial_rel a | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_finish | val split_at_last_finish (#index: _) (c: block index) (i: index) (b: bytes)
: Lemma (requires (True))
(ensures
(let blocks, rest = split_at_last c i b in
let bl = U32.v (c.block_len i) in
let blocks', rest' = Lib.UpdateMulti.split_at_last_lazy bl rest in
let blocks'', rest'' = Lib.UpdateMulti.split_at_last_lazy bl b in
S.equal blocks'' (S.append blocks blocks') /\ S.equal rest' rest'')) | val split_at_last_finish (#index: _) (c: block index) (i: index) (b: bytes)
: Lemma (requires (True))
(ensures
(let blocks, rest = split_at_last c i b in
let bl = U32.v (c.block_len i) in
let blocks', rest' = Lib.UpdateMulti.split_at_last_lazy bl rest in
let blocks'', rest'' = Lib.UpdateMulti.split_at_last_lazy bl b in
S.equal blocks'' (S.append blocks blocks') /\ S.equal rest' rest'')) | let split_at_last_finish #index (c: block index) (i: index) (b: bytes) : Lemma
(requires (True))
(ensures (
let blocks, rest = split_at_last c i b in
// Pay attention here: we use c.block_len and not c.blocks_state_len
let bl = U32.v (c.block_len i) in
let blocks', rest' = Lib.UpdateMulti.split_at_last_lazy bl rest in
let blocks'', rest'' = Lib.UpdateMulti.split_at_last_lazy bl b in
S.equal blocks'' (S.append blocks blocks') /\
S.equal rest' rest''))
=
let blocks, rest = split_at_last c i b in
// Pay attention here: we use c.block_len and not c.blocks_state_len
let bl = U32.v (c.block_len i) in
let nbl = U32.v (c.blocks_state_len i) in
let blocks', rest' = Lib.UpdateMulti.split_at_last_lazy bl rest in
// let blocks'', rest'' = Lib.UpdateMulti.split_at_last_lazy bl b in
let processed' = S.append blocks blocks' in
// Condition 1: S.length processed' % bl = 0
mod_trans_lem (S.length blocks) nbl bl;
assert(S.length blocks % bl = 0);
assert(S.length blocks' % bl = 0);
Math.Lemmas.modulo_distributivity (S.length blocks) (S.length blocks') bl;
assert(S.length processed' = S.length blocks + S.length blocks');
Math.Lemmas.modulo_lemma 0 bl;
assert(0 % bl = 0);
assert(S.length processed' % bl = 0);
// Conditions 2 and 3
assert(S.length rest' <= bl);
assert(S.length rest' = 0 ==> S.length processed' = 0);
// Characterization lemma
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec bl b processed' rest' | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 70,
"end_line": 408,
"start_col": 0,
"start_line": 373
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest
#pop-options
/// This second lemma is the one we will use
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_spec #index (c: block index) (i: index)
(b blocks rest: bytes):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest)))
(ensures (
(blocks, rest) == split_at_last c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest
#pop-options
/// For the initialization of the streaming state.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_init #index (c: block index) (i: index) (b: bytes) : Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures (
let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b))
=
let l = U32.v (c.blocks_state_len i) in
FStar.Math.Lemmas.multiple_modulo_lemma 0 l;
split_at_last_spec c i b S.empty b
#pop-options
/// "Small" case: not enough data to obtain strictly more than a complete block,
/// so it suffices to append the new input to the internal buffer. Note that we
/// don't process the resulting buffer because we have to make sure there is always
/// some data remaining in it (after the first call to update) so that [update_last]
/// is called on non-empty data at the very end.
///
/// There are many subcases that we prove in intermediate lemmas, until we can
/// get the final [split_at_last_small] theorem.
/// [b]: internal buffer
/// [d]: data to append
/// "Small" case: subcase 1: not enough data to obtain a complete block append the
/// new input to the internal buffer.
let split_at_last_small_strict #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
split_at_last_spec c i (S.append b d) blocks (S.append rest d)
/// "Small" case: subcase 2: exactly enough data to obtain a complete block, and the
/// internal buffer is empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact_empty_internal #index (c: block index) (i: index) (b: bytes) (d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
(* The proof is trivial because [b] is empty *)
assert(b `Seq.equal` Seq.empty);
assert(S.append b d `Seq.equal` d);
assert(S.append rest d `Seq.equal` d)
#pop-options
/// "Small" case 3: exactly enough data to obtain a complete block, and the data to
/// add is empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact_empty_data #index (c: block index) (i: index) (b: bytes)
(d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length d = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
assert(S.append rest d `S.equal` rest);
assert(S.append b d `S.equal` b)
#pop-options
/// "Small" case 4: exactly enough data to obtain a complete block, the internal
/// buffer is not empty and the data to add is not empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest > 0 /\ S.length d > 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
let n = S.length blocks / l in
assert(S.length blocks % l = 0); (* comes from the spec of [split_at_last] *)
assert(S.length (S.append rest d) = l);
assert((S.append b d) `Seq.equal` Seq.append blocks (Seq.append rest d));
split_at_last_spec c i (S.append b d) blocks (S.append rest d)
#pop-options
/// "Small" case: final theorem: not enough data to obtain strictly more than a
/// complete block, so it suffices to append the new input to the internal buffer.
let split_at_last_small #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d <= U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
if S.length rest + S.length d < l then
split_at_last_small_strict c i b d
else if S.length rest = 0 then
split_at_last_small_exact_empty_internal c i b d
else if S.length d = 0 then
split_at_last_small_exact_empty_data c i b d
else split_at_last_small_exact c i b d
/// For the initialization of the streaming state.
/// Second case: the data seen so far is empty or a multiple of the block size
/// meaning that the internal buffer is either empty or full, and the data to
/// append is not empty. This is a fast path: we can process the internal
/// buffer if it is non-empty, then process blocks without touching at the buffer
/// and finally copy the remaining data to the buffer. Of course, there must be
/// data remaining in the buffer in the end, which is why the data to append
/// musn't be empty.
#push-options "--z3rlimit 100 --z3cliopt smt.arith.nl=false"
let split_at_last_blocks #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let blocks, rest = split_at_last c i b in
(S.length rest = 0 \/ S.length rest = U32.v (c.blocks_state_len i)) /\
S.length d > 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i d in
let blocks'', rest'' = split_at_last c i (S.append b d) in
S.equal blocks'' (S.append b blocks') /\
S.equal rest' rest''))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i d in
let blocks'', rest'' = split_at_last c i (S.append b d) in
let b' = S.append blocks rest in
let d' = S.append blocks' rest' in
let l = U32.v (c.blocks_state_len i) in
(* We prove the non-trivial requirements of [split_at_last_spec] *)
assert(S.length b % l = 0);
Math.Lemmas.modulo_distributivity (S.length b) (S.length blocks') l;
calc (==) {
S.length (S.append b blocks') % l;
(==) {}
(S.length b + S.length blocks') % l;
(==) { Math.Lemmas.modulo_distributivity (S.length b) (S.length blocks') l }
((S.length b % l) + (S.length blocks' % l)) % l;
(==) {}
0 % l;
(==) { Math.Lemmas.modulo_lemma 0 l }
0;
};
(* End of proof *)
split_at_last_spec c i (S.append b d) (S.append b blocks') rest'
#pop-options
/// Update last:
/// We need to pay attention to the fact that update_last may only be able to take
/// a block as input (and not more). This means that if the internal buffer is longer
/// than a block (because we use a vectorized implementation) we need to:
/// - process as many blocks as possible with update_multi
/// - call update_last on the remaining block
/// Also note that until now we used split_at_last to slice by using a length
/// equal to a multiple of blocks.
/// However, Hacl.Streaming.Interface.spec_is_incremental uses split_at_last
/// with a slice length of exactly one block. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | c: Hacl.Streaming.Interface.block index -> i: index -> b: Hacl.Streaming.Spec.bytes
-> FStar.Pervasives.Lemma
(ensures
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks rest = _ in
let bl = FStar.UInt32.v (Block?.block_len c i) in
let _ = Lib.UpdateMulti.split_at_last_lazy bl rest in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks' rest' = _ in
let _ = Lib.UpdateMulti.split_at_last_lazy bl b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks'' rest'' = _ in
FStar.Seq.Base.equal blocks'' (FStar.Seq.Base.append blocks blocks') /\
FStar.Seq.Base.equal rest' rest'')
<:
Type0)
<:
Type0)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"FStar.Seq.Base.seq",
"Lib.UpdateMulti.uint8",
"Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec",
"Prims.unit",
"Prims._assert",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Hacl.Streaming.Spec.uint8",
"Prims.op_LessThanOrEqual",
"Prims.op_Modulus",
"FStar.Math.Lemmas.modulo_lemma",
"Prims.op_Addition",
"FStar.Math.Lemmas.modulo_distributivity",
"Hacl.Streaming.Spec.mod_trans_lem",
"FStar.Seq.Base.append",
"FStar.Pervasives.Native.tuple2",
"Lib.UpdateMulti.split_at_last_lazy",
"FStar.UInt.uint_t",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"Hacl.Streaming.Interface.__proj__Block__item__block_len",
"Hacl.Streaming.Spec.split_at_last",
"Prims.l_True",
"Prims.squash",
"Prims.l_and",
"FStar.Seq.Base.equal",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let split_at_last_finish #index (c: block index) (i: index) (b: bytes)
: Lemma (requires (True))
(ensures
(let blocks, rest = split_at_last c i b in
let bl = U32.v (c.block_len i) in
let blocks', rest' = Lib.UpdateMulti.split_at_last_lazy bl rest in
let blocks'', rest'' = Lib.UpdateMulti.split_at_last_lazy bl b in
S.equal blocks'' (S.append blocks blocks') /\ S.equal rest' rest'')) =
| let blocks, rest = split_at_last c i b in
let bl = U32.v (c.block_len i) in
let nbl = U32.v (c.blocks_state_len i) in
let blocks', rest' = Lib.UpdateMulti.split_at_last_lazy bl rest in
let processed' = S.append blocks blocks' in
mod_trans_lem (S.length blocks) nbl bl;
assert (S.length blocks % bl = 0);
assert (S.length blocks' % bl = 0);
Math.Lemmas.modulo_distributivity (S.length blocks) (S.length blocks') bl;
assert (S.length processed' = S.length blocks + S.length blocks');
Math.Lemmas.modulo_lemma 0 bl;
assert (0 % bl = 0);
assert (S.length processed' % bl = 0);
assert (S.length rest' <= bl);
assert (S.length rest' = 0 ==> S.length processed' = 0);
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec bl b processed' rest' | false |
Hacl.Streaming.Spec.fst | Hacl.Streaming.Spec.split_at_last_blocks | val split_at_last_blocks (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let blocks, rest = split_at_last c i b in
(S.length rest = 0 \/ S.length rest = U32.v (c.blocks_state_len i)) /\ S.length d > 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i d in
let blocks'', rest'' = split_at_last c i (S.append b d) in
S.equal blocks'' (S.append b blocks') /\ S.equal rest' rest'')) | val split_at_last_blocks (#index: _) (c: block index) (i: index) (b d: bytes)
: Lemma
(requires
(let blocks, rest = split_at_last c i b in
(S.length rest = 0 \/ S.length rest = U32.v (c.blocks_state_len i)) /\ S.length d > 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i d in
let blocks'', rest'' = split_at_last c i (S.append b d) in
S.equal blocks'' (S.append b blocks') /\ S.equal rest' rest'')) | let split_at_last_blocks #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let blocks, rest = split_at_last c i b in
(S.length rest = 0 \/ S.length rest = U32.v (c.blocks_state_len i)) /\
S.length d > 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i d in
let blocks'', rest'' = split_at_last c i (S.append b d) in
S.equal blocks'' (S.append b blocks') /\
S.equal rest' rest''))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i d in
let blocks'', rest'' = split_at_last c i (S.append b d) in
let b' = S.append blocks rest in
let d' = S.append blocks' rest' in
let l = U32.v (c.blocks_state_len i) in
(* We prove the non-trivial requirements of [split_at_last_spec] *)
assert(S.length b % l = 0);
Math.Lemmas.modulo_distributivity (S.length b) (S.length blocks') l;
calc (==) {
S.length (S.append b blocks') % l;
(==) {}
(S.length b + S.length blocks') % l;
(==) { Math.Lemmas.modulo_distributivity (S.length b) (S.length blocks') l }
((S.length b % l) + (S.length blocks' % l)) % l;
(==) {}
0 % l;
(==) { Math.Lemmas.modulo_lemma 0 l }
0;
};
(* End of proof *)
split_at_last_spec c i (S.append b d) (S.append b blocks') rest' | {
"file_name": "code/streaming/Hacl.Streaming.Spec.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 358,
"start_col": 0,
"start_line": 323
} | module Hacl.Streaming.Spec
/// This module contains all of the logical reasoning, calc statement included,
/// for the streaming functor.
///
/// The functor uses a ghost variable (named ``seen``) to reason about the
/// **past**, i.e. whatever bytes have been fed into the streaming functor. In
/// other words, we capture the history of calls that have been performed on the
/// functor state, i.e. the sequence of bytes that have been accumulated via
/// previous calls to ``Functor.update``, into the ghost ``seen``
/// variable.
///
/// To make things useful, we need to relate the present to the past, i.e. we
/// need to relate the values of ``block_state`` and ``buf`` (in a given heap)
/// to the ghost value ``seen``.
///
/// The central invariant of the streaming functor is that, if you split
/// ``seen`` at the last block boundary, then:
///
/// - ``block_state`` contains the accumulated result of calling ``update`` on
/// all of the blocks, and
/// - ``buf`` contains the rest of ``seen`` that is smaller or equal to a complete
/// block and is processed lazily to make sure there is some data left when we
/// call ``last_update``
///
/// The function that performs this splitting is called ``split_at_last``, and
/// we need to prove various properties about it, since the streaming functor
/// distinguishes three sub-situations to make the proof tractable and we need
/// helper lemmas for all three situations.
#set-options "--max_fuel 0 --max_ifuel 0 \
--using_facts_from '*,-LowStar.Monotonic.Buffer.unused_in_not_unused_in_disjoint_2' --z3rlimit 50"
module ST = FStar.HyperStack.ST
module HS = FStar.HyperStack
module B = LowStar.Buffer
module G = FStar.Ghost
module S = FStar.Seq
module U32 = FStar.UInt32
module U64 = FStar.UInt64
open Hacl.Streaming.Interface
open FStar.HyperStack.ST
open LowStar.BufferOps
open FStar.Mul
inline_for_extraction noextract
let uint8 = Lib.IntTypes.uint8
inline_for_extraction noextract
let uint32 = Lib.IntTypes.uint32
noextract
let bytes = S.seq uint8
// TODO: move to F*
val mod_trans_lem (a : nat) (b c : pos) :
Lemma (requires (a % b = 0 /\ b % c = 0))
(ensures (a % c = 0))
let mod_trans_lem a b c =
let open FStar.Math.Lemmas in
div_exact_r a b;
div_exact_r b c;
assert(a = b * (a / b));
assert(b = c * (b / c));
assert(a = (c * (b / c)) * (a / (c * (b / c))));
assert(a = c * (((b / c)) * (a / (c * (b / c)))));
cancel_mul_mod (((b / c)) * (a / (c * (b / c)))) c;
assert(a % c = 0)
/// Returns the number of blocks to process
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks #index (c: block index) (i: index) (b: nat):
Pure nat
(requires True)
(ensures (fun n ->
let l = U32.v (c.blocks_state_len i) in
let blocks = n * l in
let rest = b - blocks in
rest <= l /\
(rest % l = b % l) /\
(rest = b % l \/ rest = l) /\
(rest = 0 <==> b == 0) /\
(rest = l <==> (blocks = (b / l - 1) * l)) /\
((rest > 0 /\ rest < l) <==> b % l <> 0) /\
(rest = (b % l) <==> (blocks = (b / l) * l)) /\
blocks % l = 0 /\
blocks % U32.v (c.block_len i) = 0 /\
(blocks / l) * l = blocks))
=
let n = fst (Lib.UpdateMulti.split_at_last_lazy_nb_rem (U32.v (c.blocks_state_len i)) b) in
// Proving that: blocks % U32.v (c.block_len i) = 0
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = n * l in
(**) Math.Lemmas.nat_times_nat_is_nat n l;
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
n
#pop-options
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last #index (c: block index) (i: index) (b: bytes):
Pure (bytes & bytes)
(requires True)
(ensures (fun (blocks, rest) ->
let l = U32.v (c.blocks_state_len i) in
S.length rest <= l /\
(S.length rest % l = S.length b % l) /\
(S.length rest = S.length b % l \/ S.length rest = l) /\
(S.length rest = 0 <==> S.length b == 0) /\
(S.length rest = l <==>
(S.length blocks = (S.length b / l - 1) * l)) /\
((S.length rest > 0 /\ S.length rest < l) <==> S.length b % l <> 0) /\
(S.length rest = (S.length b % l) <==>
(S.length blocks = (S.length b / l) * l)) /\
S.equal (S.append blocks rest) b /\
S.length blocks % l = 0 /\
S.length blocks % U32.v (c.block_len i) = 0 /\
(S.length blocks / l) * l = S.length blocks
))
=
let l = U32.v (c.blocks_state_len i) in
let blocks, rest = Lib.UpdateMulti.split_at_last_lazy l b in
begin
(**) let l = U32.v (c.blocks_state_len i) in
(**) let blocks = S.length blocks in
(**) mod_trans_lem blocks l (U32.v (c.block_len i))
end;
blocks, rest
#pop-options
/// The following lemmas characterize [split_at_last] with conditions which are easy to
/// reason about, and is very useful for the various lemmas in this file which
/// prove properties about how to update the internal buffer so that its content
/// is actually the correct remainder of the data seen so far.
/// This first auxiliary lemma only manipulates the lengths of the sequences.
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_num_blocks_spec #index (c: block index) (i: index)
(b n rest: nat):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(rest <= l /\ (rest = 0 ==> b = 0) /\ b = n * l + rest)))
(ensures (n = split_at_last_num_blocks c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_nb_rem_spec l b n rest
#pop-options
/// This second lemma is the one we will use
#push-options "--z3cliopt smt.arith.nl=false"
noextract
let split_at_last_spec #index (c: block index) (i: index)
(b blocks rest: bytes):
Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
(S.length blocks % l = 0 /\
S.length rest <= l /\
(S.length rest = 0 ==> S.length b = 0) /\
b `Seq.equal` Seq.append blocks rest)))
(ensures (
(blocks, rest) == split_at_last c i b)) =
let l = U32.v (c.blocks_state_len i) in
Lib.UpdateMulti.Lemmas.split_at_last_lazy_spec l b blocks rest
#pop-options
/// For the initialization of the streaming state.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_init #index (c: block index) (i: index) (b: bytes) : Lemma
(requires (
let l = U32.v (c.blocks_state_len i) in
S.length b <= l))
(ensures (
let blocks, rest = split_at_last c i b in
S.equal blocks S.empty /\ S.equal rest b))
=
let l = U32.v (c.blocks_state_len i) in
FStar.Math.Lemmas.multiple_modulo_lemma 0 l;
split_at_last_spec c i b S.empty b
#pop-options
/// "Small" case: not enough data to obtain strictly more than a complete block,
/// so it suffices to append the new input to the internal buffer. Note that we
/// don't process the resulting buffer because we have to make sure there is always
/// some data remaining in it (after the first call to update) so that [update_last]
/// is called on non-empty data at the very end.
///
/// There are many subcases that we prove in intermediate lemmas, until we can
/// get the final [split_at_last_small] theorem.
/// [b]: internal buffer
/// [d]: data to append
/// "Small" case: subcase 1: not enough data to obtain a complete block append the
/// new input to the internal buffer.
let split_at_last_small_strict #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d < U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
split_at_last_spec c i (S.append b d) blocks (S.append rest d)
/// "Small" case: subcase 2: exactly enough data to obtain a complete block, and the
/// internal buffer is empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact_empty_internal #index (c: block index) (i: index) (b: bytes) (d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
(* The proof is trivial because [b] is empty *)
assert(b `Seq.equal` Seq.empty);
assert(S.append b d `Seq.equal` d);
assert(S.append rest d `Seq.equal` d)
#pop-options
/// "Small" case 3: exactly enough data to obtain a complete block, and the data to
/// add is empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact_empty_data #index (c: block index) (i: index) (b: bytes)
(d: bytes):
Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length d = 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
assert(S.append rest d `S.equal` rest);
assert(S.append b d `S.equal` b)
#pop-options
/// "Small" case 4: exactly enough data to obtain a complete block, the internal
/// buffer is not empty and the data to add is not empty.
#push-options "--z3cliopt smt.arith.nl=false"
let split_at_last_small_exact #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d = U32.v (c.blocks_state_len i) /\
S.length rest > 0 /\ S.length d > 0))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
let n = S.length blocks / l in
assert(S.length blocks % l = 0); (* comes from the spec of [split_at_last] *)
assert(S.length (S.append rest d) = l);
assert((S.append b d) `Seq.equal` Seq.append blocks (Seq.append rest d));
split_at_last_spec c i (S.append b d) blocks (S.append rest d)
#pop-options
/// "Small" case: final theorem: not enough data to obtain strictly more than a
/// complete block, so it suffices to append the new input to the internal buffer.
let split_at_last_small #index (c: block index) (i: index) (b: bytes) (d: bytes): Lemma
(requires (
let _, rest = split_at_last c i b in
S.length rest + S.length d <= U32.v (c.blocks_state_len i)))
(ensures (
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
S.equal blocks blocks' /\ S.equal (S.append rest d) rest'))
=
let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i (S.append b d) in
let l = U32.v (c.blocks_state_len i) in
if S.length rest + S.length d < l then
split_at_last_small_strict c i b d
else if S.length rest = 0 then
split_at_last_small_exact_empty_internal c i b d
else if S.length d = 0 then
split_at_last_small_exact_empty_data c i b d
else split_at_last_small_exact c i b d
/// For the initialization of the streaming state.
/// Second case: the data seen so far is empty or a multiple of the block size
/// meaning that the internal buffer is either empty or full, and the data to
/// append is not empty. This is a fast path: we can process the internal
/// buffer if it is non-empty, then process blocks without touching at the buffer
/// and finally copy the remaining data to the buffer. Of course, there must be
/// data remaining in the buffer in the end, which is why the data to append
/// musn't be empty. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.UpdateMulti.Lemmas.fsti.checked",
"Lib.UpdateMulti.fst.checked",
"Lib.IntTypes.fsti.checked",
"Hacl.Streaming.Interface.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.Math.Lemmas.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Calc.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Streaming.Spec.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming.Interface",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "S"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Streaming",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false"
],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
c: Hacl.Streaming.Interface.block index ->
i: index ->
b: Hacl.Streaming.Spec.bytes ->
d: Hacl.Streaming.Spec.bytes
-> FStar.Pervasives.Lemma
(requires
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ _ rest = _ in
(FStar.Seq.Base.length rest = 0 \/
FStar.Seq.Base.length rest = FStar.UInt32.v (Block?.blocks_state_len c i)) /\
FStar.Seq.Base.length d > 0)
<:
Type0))
(ensures
(let _ = Hacl.Streaming.Spec.split_at_last c i b in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ _ _ = _ in
let _ = Hacl.Streaming.Spec.split_at_last c i d in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks' rest' = _ in
let _ = Hacl.Streaming.Spec.split_at_last c i (FStar.Seq.Base.append b d) in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ blocks'' rest'' = _ in
FStar.Seq.Base.equal blocks'' (FStar.Seq.Base.append b blocks') /\
FStar.Seq.Base.equal rest' rest'')
<:
Type0)
<:
Type0)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Hacl.Streaming.Interface.block",
"Hacl.Streaming.Spec.bytes",
"Hacl.Streaming.Spec.split_at_last_spec",
"FStar.Seq.Base.append",
"Hacl.Streaming.Spec.uint8",
"Prims.unit",
"FStar.Calc.calc_finish",
"Prims.int",
"Prims.eq2",
"Prims.op_Modulus",
"FStar.Seq.Base.length",
"Prims.Cons",
"FStar.Preorder.relation",
"Prims.Nil",
"FStar.Calc.calc_step",
"Prims.op_Addition",
"FStar.Calc.calc_init",
"FStar.Calc.calc_pack",
"Prims.squash",
"FStar.Math.Lemmas.modulo_distributivity",
"FStar.Math.Lemmas.modulo_lemma",
"Prims._assert",
"Prims.b2t",
"Prims.op_Equality",
"FStar.UInt.uint_t",
"FStar.UInt32.v",
"Hacl.Streaming.Interface.__proj__Block__item__blocks_state_len",
"FStar.Seq.Base.seq",
"FStar.Pervasives.Native.tuple2",
"Hacl.Streaming.Spec.split_at_last",
"Prims.l_and",
"Prims.l_or",
"FStar.UInt.size",
"FStar.UInt32.n",
"Prims.op_GreaterThanOrEqual",
"Prims.op_GreaterThan",
"FStar.Seq.Base.equal",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let split_at_last_blocks #index (c: block index) (i: index) (b: bytes) (d: bytes)
: Lemma
(requires
(let blocks, rest = split_at_last c i b in
(S.length rest = 0 \/ S.length rest = U32.v (c.blocks_state_len i)) /\ S.length d > 0))
(ensures
(let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i d in
let blocks'', rest'' = split_at_last c i (S.append b d) in
S.equal blocks'' (S.append b blocks') /\ S.equal rest' rest'')) =
| let blocks, rest = split_at_last c i b in
let blocks', rest' = split_at_last c i d in
let blocks'', rest'' = split_at_last c i (S.append b d) in
let b' = S.append blocks rest in
let d' = S.append blocks' rest' in
let l = U32.v (c.blocks_state_len i) in
assert (S.length b % l = 0);
Math.Lemmas.modulo_distributivity (S.length b) (S.length blocks') l;
calc ( == ) {
S.length (S.append b blocks') % l;
( == ) { () }
(S.length b + S.length blocks') % l;
( == ) { Math.Lemmas.modulo_distributivity (S.length b) (S.length blocks') l }
((S.length b % l) + (S.length blocks' % l)) % l;
( == ) { () }
0 % l;
( == ) { Math.Lemmas.modulo_lemma 0 l }
0;
};
split_at_last_spec c i (S.append b d) (S.append b blocks') rest' | false |
Steel.ST.Effect.Ghost.fst | Steel.ST.Effect.Ghost.extract_fact0 | val extract_fact0
(#opened: inames)
(p: vprop)
(fact: prop)
(l: (m: mem -> Lemma (requires interp (hp_of p) m) (ensures fact)))
: STAG.repr unit false opened Unobservable p (fun _ -> p) True (fun _ -> fact) | val extract_fact0
(#opened: inames)
(p: vprop)
(fact: prop)
(l: (m: mem -> Lemma (requires interp (hp_of p) m) (ensures fact)))
: STAG.repr unit false opened Unobservable p (fun _ -> p) True (fun _ -> fact) | let extract_fact0 (#opened:inames)
(p:vprop)
(fact:prop)
(l:(m:mem) -> Lemma
(requires interp (hp_of p) m)
(ensures fact))
: STAG.repr unit false opened Unobservable p (fun _ -> p) True (fun _ -> fact)
= fun frame ->
let m0:full_mem = NMSTTotal.get () in
Classical.forall_intro_3 reveal_mk_rmem;
let h0 = mk_rmem p (core_mem m0) in
l (core_mem m0) | {
"file_name": "lib/steel/Steel.ST.Effect.Ghost.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 21,
"end_line": 61,
"start_col": 0,
"start_line": 50
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.ST.Effect.Ghost
friend Steel.ST.Effect.AtomicAndGhost
friend Steel.Effect.Atomic
open Steel.Memory
module T = FStar.Tactics
module SEA = Steel.Effect.Atomic
/// Any Steel ghost computation can always be lifted to an atomic computation if needed.
/// Note that because SteelGhost is marked as erasable, the F* typechecker will throw an error
/// if this lift is applied to a ghost computation with an informative return value
let lift_ghost_atomic
(a:Type)
(opened:inames)
(#framed:eqtype_as_type bool)
(#[@@@ framing_implicit] pre:pre_t)
(#[@@@ framing_implicit] post:post_t a)
(#[@@@ framing_implicit] req:Type0)
(#[@@@ framing_implicit] ens:a -> Type0)
(f:STAG.repr a framed opened Unobservable pre post req ens)
: STAG.repr a framed opened Unobservable pre post req ens
= f
let as_atomic_action_ghost (#a:Type u#a)
(#opened_invariants:inames)
(#fp:slprop)
(#fp': a -> slprop)
(f:action_except a opened_invariants fp fp')
: STGhostT a opened_invariants (to_vprop fp) (fun x -> to_vprop (fp' x))
= let ff = SEA.reify_steel_ghost_comp (fun _ -> SEA.as_atomic_action_ghost f) in
STGhostBase?.reflect ff | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Effect.AtomicAndGhost.fst.checked",
"Steel.Memory.fsti.checked",
"Steel.Effect.Atomic.fst.checked",
"prims.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.NMSTTotal.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.Effect.Ghost.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.Effect.Atomic",
"short_module": "SEA"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.ST.Effect.Atomic",
"short_module": "STA"
},
{
"abbrev": true,
"full_module": "Steel.ST.Effect.AtomicAndGhost",
"short_module": "STAG"
},
{
"abbrev": false,
"full_module": "Steel.Effect.Common",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: Steel.Effect.Common.vprop ->
fact: Prims.prop ->
l:
(m: Steel.Memory.mem
-> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Effect.Common.hp_of p) m)
(ensures fact))
-> Steel.ST.Effect.AtomicAndGhost.repr Prims.unit
false
opened
Steel.Effect.Common.Unobservable
p
(fun _ -> p)
Prims.l_True
(fun _ -> fact) | Prims.Tot | [
"total"
] | [] | [
"Steel.Memory.inames",
"Steel.Effect.Common.vprop",
"Prims.prop",
"Steel.Memory.mem",
"Prims.unit",
"Steel.Memory.interp",
"Steel.Effect.Common.hp_of",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Steel.Memory.slprop",
"Steel.Memory.core_mem",
"Steel.Effect.Common.rmem'",
"Steel.Effect.Common.valid_rmem",
"Steel.Effect.Common.mk_rmem",
"FStar.Classical.forall_intro_3",
"Steel.Effect.Common.hmem",
"Steel.Effect.Common.can_be_split",
"Prims.eq2",
"Steel.Effect.Common.normal",
"Steel.Effect.Common.t_of",
"Steel.Effect.Common.sel_of",
"Steel.Effect.Common.reveal_mk_rmem",
"Steel.Memory.full_mem",
"FStar.NMSTTotal.get",
"Steel.Memory.mem_evolves",
"Steel.ST.Effect.AtomicAndGhost.repr",
"Steel.Effect.Common.Unobservable",
"Prims.l_True"
] | [] | false | false | false | false | false | let extract_fact0
(#opened: inames)
(p: vprop)
(fact: prop)
(l: (m: mem -> Lemma (requires interp (hp_of p) m) (ensures fact)))
: STAG.repr unit false opened Unobservable p (fun _ -> p) True (fun _ -> fact) =
| fun frame ->
let m0:full_mem = NMSTTotal.get () in
Classical.forall_intro_3 reveal_mk_rmem;
let h0 = mk_rmem p (core_mem m0) in
l (core_mem m0) | false |
Steel.ST.Effect.Ghost.fst | Steel.ST.Effect.Ghost.extract_fact | val extract_fact (#opened:inames)
(p:vprop)
(fact:prop)
(l:(m:mem) -> Lemma
(requires interp (hp_of p) m)
(ensures fact))
: STGhost unit opened p (fun _ -> p) True (fun _ -> fact) | val extract_fact (#opened:inames)
(p:vprop)
(fact:prop)
(l:(m:mem) -> Lemma
(requires interp (hp_of p) m)
(ensures fact))
: STGhost unit opened p (fun _ -> p) True (fun _ -> fact) | let extract_fact (#opened:inames)
(p:vprop)
(fact:prop)
(l:(m:mem) -> Lemma
(requires interp (hp_of p) m)
(ensures fact))
: STGhost unit opened p (fun _ -> p) True (fun _ -> fact)
= STGhostBase?.reflect (extract_fact0 p fact l) | {
"file_name": "lib/steel/Steel.ST.Effect.Ghost.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 49,
"end_line": 70,
"start_col": 0,
"start_line": 63
} | (*
Copyright 2020 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*)
module Steel.ST.Effect.Ghost
friend Steel.ST.Effect.AtomicAndGhost
friend Steel.Effect.Atomic
open Steel.Memory
module T = FStar.Tactics
module SEA = Steel.Effect.Atomic
/// Any Steel ghost computation can always be lifted to an atomic computation if needed.
/// Note that because SteelGhost is marked as erasable, the F* typechecker will throw an error
/// if this lift is applied to a ghost computation with an informative return value
let lift_ghost_atomic
(a:Type)
(opened:inames)
(#framed:eqtype_as_type bool)
(#[@@@ framing_implicit] pre:pre_t)
(#[@@@ framing_implicit] post:post_t a)
(#[@@@ framing_implicit] req:Type0)
(#[@@@ framing_implicit] ens:a -> Type0)
(f:STAG.repr a framed opened Unobservable pre post req ens)
: STAG.repr a framed opened Unobservable pre post req ens
= f
let as_atomic_action_ghost (#a:Type u#a)
(#opened_invariants:inames)
(#fp:slprop)
(#fp': a -> slprop)
(f:action_except a opened_invariants fp fp')
: STGhostT a opened_invariants (to_vprop fp) (fun x -> to_vprop (fp' x))
= let ff = SEA.reify_steel_ghost_comp (fun _ -> SEA.as_atomic_action_ghost f) in
STGhostBase?.reflect ff
let extract_fact0 (#opened:inames)
(p:vprop)
(fact:prop)
(l:(m:mem) -> Lemma
(requires interp (hp_of p) m)
(ensures fact))
: STAG.repr unit false opened Unobservable p (fun _ -> p) True (fun _ -> fact)
= fun frame ->
let m0:full_mem = NMSTTotal.get () in
Classical.forall_intro_3 reveal_mk_rmem;
let h0 = mk_rmem p (core_mem m0) in
l (core_mem m0) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Effect.AtomicAndGhost.fst.checked",
"Steel.Memory.fsti.checked",
"Steel.Effect.Atomic.fst.checked",
"prims.fst.checked",
"FStar.Tactics.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.NMSTTotal.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.Effect.Ghost.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.Effect.Atomic",
"short_module": "SEA"
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": true,
"full_module": "Steel.ST.Effect.Atomic",
"short_module": "STA"
},
{
"abbrev": true,
"full_module": "Steel.ST.Effect.AtomicAndGhost",
"short_module": "STAG"
},
{
"abbrev": false,
"full_module": "Steel.Effect.Common",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Tactics",
"short_module": "T"
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
p: Steel.Effect.Common.vprop ->
fact: Prims.prop ->
l:
(m: Steel.Memory.mem
-> FStar.Pervasives.Lemma (requires Steel.Memory.interp (Steel.Effect.Common.hp_of p) m)
(ensures fact))
-> Steel.ST.Effect.Ghost.STGhost Prims.unit | Steel.ST.Effect.Ghost.STGhost | [] | [] | [
"Steel.Memory.inames",
"Steel.Effect.Common.vprop",
"Prims.prop",
"Steel.Memory.mem",
"Prims.unit",
"Steel.Memory.interp",
"Steel.Effect.Common.hp_of",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"Steel.ST.Effect.Ghost.extract_fact0",
"Prims.l_True"
] | [] | false | true | false | false | false | let extract_fact
(#opened: inames)
(p: vprop)
(fact: prop)
(l: (m: mem -> Lemma (requires interp (hp_of p) m) (ensures fact)))
: STGhost unit opened p (fun _ -> p) True (fun _ -> fact) =
| STGhostBase?.reflect (extract_fact0 p fact l) | false |
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.v | val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a) | val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a) | let v #_ h ll =
B.deref h ll.v | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 16,
"end_line": 86,
"start_col": 0,
"start_line": 85
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients. | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: FStar.Monotonic.HyperStack.mem -> ll: LowStar.Lib.LinkedList2.t a -> Prims.GTot (Prims.list a) | Prims.GTot | [
"sometrivial"
] | [] | [
"FStar.Monotonic.HyperStack.mem",
"LowStar.Lib.LinkedList2.t",
"FStar.Ghost.reveal",
"Prims.list",
"LowStar.Monotonic.Buffer.deref",
"FStar.Ghost.erased",
"LowStar.Buffer.trivial_preorder",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__v"
] | [] | false | false | false | false | false | let v #_ h ll =
| B.deref h ll.v | false |
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.region_of | val region_of : ll: LowStar.Lib.LinkedList2.t _ -> Prims.GTot LowStar.Monotonic.Buffer.loc | let region_of ll = B.loc_all_regions_from false ll.r | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 52,
"end_line": 100,
"start_col": 0,
"start_line": 100
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients.
val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)
let v #_ h ll =
B.deref h ll.v
/// Normally clients want to reason via the footprint. However, in some case
/// (e.g. taking pointers directly to list cells), it's helpful to have a more
/// precise way to reason about the footprint. This is done via the cells, a
/// list of pointers to the individual cells, which characterizes fully the
/// footprint and the v function. See LL1.
val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True)
let cells #a h ll =
LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ll: LowStar.Lib.LinkedList2.t _ -> Prims.GTot LowStar.Monotonic.Buffer.loc | Prims.GTot | [
"sometrivial"
] | [] | [
"LowStar.Lib.LinkedList2.t",
"LowStar.Monotonic.Buffer.loc_all_regions_from",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__r",
"LowStar.Monotonic.Buffer.loc"
] | [] | false | false | false | false | false | let region_of ll =
| B.loc_all_regions_from false ll.r | false |
|
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.cells | val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True) | val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True) | let cells #a h ll =
LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v) | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 49,
"end_line": 97,
"start_col": 0,
"start_line": 96
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients.
val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)
let v #_ h ll =
B.deref h ll.v
/// Normally clients want to reason via the footprint. However, in some case
/// (e.g. taking pointers directly to list cells), it's helpful to have a more
/// precise way to reason about the footprint. This is done via the cells, a
/// list of pointers to the individual cells, which characterizes fully the
/// footprint and the v function. See LL1.
val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: FStar.Monotonic.HyperStack.mem -> ll: LowStar.Lib.LinkedList2.t a
-> Prims.Ghost (Prims.list (LowStar.Buffer.pointer (LowStar.Lib.LinkedList.cell a))) | Prims.Ghost | [] | [] | [
"FStar.Monotonic.HyperStack.mem",
"LowStar.Lib.LinkedList2.t",
"LowStar.Lib.LinkedList.cells",
"LowStar.Monotonic.Buffer.deref",
"LowStar.Lib.LinkedList.t",
"LowStar.Buffer.trivial_preorder",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__ptr",
"FStar.Ghost.reveal",
"Prims.list",
"FStar.Ghost.erased",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__v",
"LowStar.Buffer.pointer",
"LowStar.Lib.LinkedList.cell"
] | [] | false | false | false | false | false | let cells #a h ll =
| LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v) | false |
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.invariant | val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0 | val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0 | let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 32,
"end_line": 73,
"start_col": 0,
"start_line": 41
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: FStar.Monotonic.HyperStack.mem -> ll: LowStar.Lib.LinkedList2.t a -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Monotonic.HyperStack.mem",
"LowStar.Lib.LinkedList2.t",
"Prims.l_and",
"LowStar.Monotonic.Buffer.live",
"LowStar.Lib.LinkedList.t",
"LowStar.Buffer.trivial_preorder",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__ptr",
"LowStar.Monotonic.Buffer.freeable",
"FStar.Ghost.erased",
"Prims.list",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__v",
"LowStar.Lib.LinkedList.well_formed",
"FStar.Ghost.reveal",
"LowStar.Lib.LinkedList.invariant",
"FStar.HyperStack.ST.is_eternal_region",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__r",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__spine_rid",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__ptr_v_rid",
"LowStar.Monotonic.Buffer.loc_includes",
"LowStar.Monotonic.Buffer.loc_region_only",
"LowStar.Monotonic.Buffer.loc_union",
"LowStar.Monotonic.Buffer.loc_addr_of_buffer",
"LowStar.Lib.LinkedList.footprint",
"LowStar.Monotonic.Buffer.loc_disjoint",
"Prims.b2t",
"FStar.Monotonic.HyperHeap.extends",
"Prims.eq2",
"FStar.Monotonic.HyperHeap.rid",
"FStar.Monotonic.HyperHeap.parent",
"LowStar.Monotonic.Buffer.deref"
] | [] | false | false | false | true | true | let invariant #a h ll =
| let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.live h ll.ptr /\ B.freeable ll.ptr /\ B.live h ll.v /\ B.freeable ll.v /\ LL1.well_formed h head v /\
LL1.invariant h head v /\ ST.is_eternal_region ll.r /\ ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid)
((loc_addr_of_buffer ll.ptr) `loc_union` (loc_addr_of_buffer ll.v))) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
HS.extends ll.ptr_v_rid ll.r /\ HS.extends ll.spine_rid ll.r /\ HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r | false |
Spec.Hash.Test.fst | Spec.Hash.Test.test1_plaintext | val test1_plaintext : Prims.list FStar.UInt8.t | let test1_plaintext = [0x61uy; 0x62uy; 0x63uy] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 11,
"start_col": 0,
"start_line": 11
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test1_plaintext =
| [0x61uy; 0x62uy; 0x63uy] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test1_expected256 | val test1_expected256 : Prims.list FStar.UInt8.t | let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 23,
"start_col": 0,
"start_line": 19
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test1_expected256 =
| [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy; 0x41uy; 0x41uy; 0x40uy; 0xdeuy;
0x5duy; 0xaeuy; 0x22uy; 0x23uy; 0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test1_expected224 | val test1_expected224 : Prims.list FStar.UInt8.t | let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 17,
"start_col": 0,
"start_line": 13
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test1_expected224 =
| [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy; 0x86uy; 0x42uy; 0xa4uy; 0x77uy;
0xbduy; 0xa2uy; 0x55uy; 0xb3uy; 0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test2_expected256 | val test2_expected256 : Prims.list FStar.UInt8.t | let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 59,
"start_col": 0,
"start_line": 55
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test2_expected256 =
| [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy; 0x9auy; 0xfbuy; 0xf4uy; 0xc8uy;
0x99uy; 0x6fuy; 0xb9uy; 0x24uy; 0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy
] | false |
|
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.footprint | val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True) | val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True) | let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v) | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 102,
"end_line": 81,
"start_col": 0,
"start_line": 78
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: FStar.Monotonic.HyperStack.mem -> ll: LowStar.Lib.LinkedList2.t a
-> Prims.Ghost LowStar.Monotonic.Buffer.loc | Prims.Ghost | [] | [] | [
"FStar.Monotonic.HyperStack.mem",
"LowStar.Lib.LinkedList2.t",
"LowStar.Monotonic.Buffer.loc_union",
"LowStar.Monotonic.Buffer.loc_addr_of_buffer",
"LowStar.Lib.LinkedList.t",
"LowStar.Buffer.trivial_preorder",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__ptr",
"FStar.Ghost.erased",
"Prims.list",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__v",
"LowStar.Lib.LinkedList.footprint",
"FStar.Ghost.reveal",
"LowStar.Monotonic.Buffer.deref",
"LowStar.Monotonic.Buffer.loc"
] | [] | false | false | false | false | false | let footprint #a h ll =
| let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
let open B in
((loc_addr_of_buffer ll.ptr) `loc_union` (loc_addr_of_buffer ll.v))
`loc_union`
(LL1.footprint h head v) | false |
Spec.Hash.Test.fst | Spec.Hash.Test.test1_expected512 | val test1_expected512 : Prims.list FStar.UInt8.t | let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 41,
"start_col": 0,
"start_line": 33
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test1_expected512 =
| [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy; 0xccuy; 0x41uy; 0x73uy; 0x49uy;
0xaeuy; 0x20uy; 0x41uy; 0x31uy; 0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy; 0x21uy; 0x92uy; 0x99uy; 0x2auy;
0x27uy; 0x4fuy; 0xc1uy; 0xa8uy; 0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy; 0x2auy; 0x9auy; 0xc9uy; 0x4fuy;
0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test2_expected384 | val test2_expected384 : Prims.list FStar.UInt8.t | let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 67,
"start_col": 0,
"start_line": 61
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test2_expected384 =
| [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy; 0x4cuy; 0xd9uy; 0x32uy; 0x7euy;
0xb1uy; 0xb1uy; 0xe3uy; 0x6auy; 0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy; 0x27uy; 0x4euy; 0xdeuy; 0xbfuy;
0xe7uy; 0x6fuy; 0x65uy; 0xfbuy; 0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test2_plaintext | val test2_plaintext:list UInt8.t | val test2_plaintext:list UInt8.t | let test2_plaintext: list UInt8.t = [] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 38,
"end_line": 47,
"start_col": 0,
"start_line": 47
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Nil",
"FStar.UInt8.t"
] | [] | false | false | false | true | false | let test2_plaintext:list UInt8.t =
| [] | false |
Spec.Hash.Test.fst | Spec.Hash.Test.test2_expected224 | val test2_expected224 : Prims.list FStar.UInt8.t | let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 53,
"start_col": 0,
"start_line": 49
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = [] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test2_expected224 =
| [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy; 0x47uy; 0x61uy; 0x02uy; 0xbbuy;
0x28uy; 0x82uy; 0x34uy; 0xc4uy; 0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test3_expected256 | val test3_expected256 : Prims.list FStar.UInt8.t | let test3_expected256 = [
0x24uy; 0x8duy; 0x6auy; 0x61uy; 0xd2uy; 0x06uy; 0x38uy; 0xb8uy;
0xe5uy; 0xc0uy; 0x26uy; 0x93uy; 0x0cuy; 0x3euy; 0x60uy; 0x39uy;
0xa3uy; 0x3cuy; 0xe4uy; 0x59uy; 0x64uy; 0xffuy; 0x21uy; 0x67uy;
0xf6uy; 0xecuy; 0xeduy; 0xd4uy; 0x19uy; 0xdbuy; 0x06uy; 0xc1uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 101,
"start_col": 0,
"start_line": 97
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3
let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ]
let test3_expected224 = [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy;
0x5duy; 0xbauy; 0x5duy; 0xa1uy; 0xfduy; 0x89uy; 0x01uy; 0x50uy;
0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test3_expected256 =
| [
0x24uy; 0x8duy; 0x6auy; 0x61uy; 0xd2uy; 0x06uy; 0x38uy; 0xb8uy; 0xe5uy; 0xc0uy; 0x26uy; 0x93uy;
0x0cuy; 0x3euy; 0x60uy; 0x39uy; 0xa3uy; 0x3cuy; 0xe4uy; 0x59uy; 0x64uy; 0xffuy; 0x21uy; 0x67uy;
0xf6uy; 0xecuy; 0xeduy; 0xd4uy; 0x19uy; 0xdbuy; 0x06uy; 0xc1uy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test2_expected512 | val test2_expected512 : Prims.list FStar.UInt8.t | let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 77,
"start_col": 0,
"start_line": 69
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test2_expected512 =
| [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy; 0xf1uy; 0x54uy; 0x28uy; 0x50uy;
0xd6uy; 0x6duy; 0x80uy; 0x07uy; 0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy; 0x47uy; 0xd0uy; 0xd1uy; 0x3cuy;
0x5duy; 0x85uy; 0xf2uy; 0xb0uy; 0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy; 0xa5uy; 0x38uy; 0x32uy; 0x7auy;
0xf9uy; 0x27uy; 0xdauy; 0x3euy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test1_expected384 | val test1_expected384 : Prims.list FStar.UInt8.t | let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 31,
"start_col": 0,
"start_line": 25
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test1_expected384 =
| [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy; 0xb5uy; 0xa0uy; 0x3duy; 0x69uy;
0x9auy; 0xc6uy; 0x50uy; 0x07uy; 0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy; 0x80uy; 0x86uy; 0x07uy; 0x2buy;
0xa1uy; 0xe7uy; 0xccuy; 0x23uy; 0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test4_expected224 | val test4_expected224 : Prims.list FStar.UInt8.t | let test4_expected224 = [
0xc9uy; 0x7cuy; 0xa9uy; 0xa5uy; 0x59uy; 0x85uy; 0x0cuy; 0xe9uy;
0x7auy; 0x04uy; 0xa9uy; 0x6duy; 0xefuy; 0x6duy; 0x99uy; 0xa9uy;
0xe0uy; 0xe0uy; 0xe2uy; 0xabuy; 0x14uy; 0xe6uy; 0xb8uy; 0xdfuy;
0x26uy; 0x5fuy; 0xc0uy; 0xb3uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 144,
"start_col": 0,
"start_line": 140
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3
let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ]
let test3_expected224 = [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy;
0x5duy; 0xbauy; 0x5duy; 0xa1uy; 0xfduy; 0x89uy; 0x01uy; 0x50uy;
0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy ]
let test3_expected256 = [
0x24uy; 0x8duy; 0x6auy; 0x61uy; 0xd2uy; 0x06uy; 0x38uy; 0xb8uy;
0xe5uy; 0xc0uy; 0x26uy; 0x93uy; 0x0cuy; 0x3euy; 0x60uy; 0x39uy;
0xa3uy; 0x3cuy; 0xe4uy; 0x59uy; 0x64uy; 0xffuy; 0x21uy; 0x67uy;
0xf6uy; 0xecuy; 0xeduy; 0xd4uy; 0x19uy; 0xdbuy; 0x06uy; 0xc1uy ]
let test3_expected384 = [
0x33uy; 0x91uy; 0xfduy; 0xdduy; 0xfcuy; 0x8duy; 0xc7uy; 0x39uy;
0x37uy; 0x07uy; 0xa6uy; 0x5buy; 0x1buy; 0x47uy; 0x09uy; 0x39uy;
0x7cuy; 0xf8uy; 0xb1uy; 0xd1uy; 0x62uy; 0xafuy; 0x05uy; 0xabuy;
0xfeuy; 0x8fuy; 0x45uy; 0x0duy; 0xe5uy; 0xf3uy; 0x6buy; 0xc6uy;
0xb0uy; 0x45uy; 0x5auy; 0x85uy; 0x20uy; 0xbcuy; 0x4euy; 0x6fuy;
0x5fuy; 0xe9uy; 0x5buy; 0x1fuy; 0xe3uy; 0xc8uy; 0x45uy; 0x2buy ]
let test3_expected512 = [
0x20uy; 0x4auy; 0x8fuy; 0xc6uy; 0xdduy; 0xa8uy; 0x2fuy; 0x0auy;
0x0cuy; 0xeduy; 0x7buy; 0xebuy; 0x8euy; 0x08uy; 0xa4uy; 0x16uy;
0x57uy; 0xc1uy; 0x6euy; 0xf4uy; 0x68uy; 0xb2uy; 0x28uy; 0xa8uy;
0x27uy; 0x9buy; 0xe3uy; 0x31uy; 0xa7uy; 0x03uy; 0xc3uy; 0x35uy;
0x96uy; 0xfduy; 0x15uy; 0xc1uy; 0x3buy; 0x1buy; 0x07uy; 0xf9uy;
0xaauy; 0x1duy; 0x3buy; 0xeauy; 0x57uy; 0x78uy; 0x9cuy; 0xa0uy;
0x31uy; 0xaduy; 0x85uy; 0xc7uy; 0xa7uy; 0x1duy; 0xd7uy; 0x03uy;
0x54uy; 0xecuy; 0x63uy; 0x12uy; 0x38uy; 0xcauy; 0x34uy; 0x45uy ]
/// Test 4
let test4_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy;
0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy;
0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy;
0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy;
0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy;
0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy;
0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test4_expected224 =
| [
0xc9uy; 0x7cuy; 0xa9uy; 0xa5uy; 0x59uy; 0x85uy; 0x0cuy; 0xe9uy; 0x7auy; 0x04uy; 0xa9uy; 0x6duy;
0xefuy; 0x6duy; 0x99uy; 0xa9uy; 0xe0uy; 0xe0uy; 0xe2uy; 0xabuy; 0x14uy; 0xe6uy; 0xb8uy; 0xdfuy;
0x26uy; 0x5fuy; 0xc0uy; 0xb3uy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test3_plaintext | val test3_plaintext : Prims.list FStar.UInt8.t | let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 89,
"start_col": 0,
"start_line": 82
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test3_plaintext =
| [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy;
0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy;
0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test3_expected384 | val test3_expected384 : Prims.list FStar.UInt8.t | let test3_expected384 = [
0x33uy; 0x91uy; 0xfduy; 0xdduy; 0xfcuy; 0x8duy; 0xc7uy; 0x39uy;
0x37uy; 0x07uy; 0xa6uy; 0x5buy; 0x1buy; 0x47uy; 0x09uy; 0x39uy;
0x7cuy; 0xf8uy; 0xb1uy; 0xd1uy; 0x62uy; 0xafuy; 0x05uy; 0xabuy;
0xfeuy; 0x8fuy; 0x45uy; 0x0duy; 0xe5uy; 0xf3uy; 0x6buy; 0xc6uy;
0xb0uy; 0x45uy; 0x5auy; 0x85uy; 0x20uy; 0xbcuy; 0x4euy; 0x6fuy;
0x5fuy; 0xe9uy; 0x5buy; 0x1fuy; 0xe3uy; 0xc8uy; 0x45uy; 0x2buy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 109,
"start_col": 0,
"start_line": 103
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3
let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ]
let test3_expected224 = [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy;
0x5duy; 0xbauy; 0x5duy; 0xa1uy; 0xfduy; 0x89uy; 0x01uy; 0x50uy;
0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy ]
let test3_expected256 = [
0x24uy; 0x8duy; 0x6auy; 0x61uy; 0xd2uy; 0x06uy; 0x38uy; 0xb8uy;
0xe5uy; 0xc0uy; 0x26uy; 0x93uy; 0x0cuy; 0x3euy; 0x60uy; 0x39uy;
0xa3uy; 0x3cuy; 0xe4uy; 0x59uy; 0x64uy; 0xffuy; 0x21uy; 0x67uy;
0xf6uy; 0xecuy; 0xeduy; 0xd4uy; 0x19uy; 0xdbuy; 0x06uy; 0xc1uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test3_expected384 =
| [
0x33uy; 0x91uy; 0xfduy; 0xdduy; 0xfcuy; 0x8duy; 0xc7uy; 0x39uy; 0x37uy; 0x07uy; 0xa6uy; 0x5buy;
0x1buy; 0x47uy; 0x09uy; 0x39uy; 0x7cuy; 0xf8uy; 0xb1uy; 0xd1uy; 0x62uy; 0xafuy; 0x05uy; 0xabuy;
0xfeuy; 0x8fuy; 0x45uy; 0x0duy; 0xe5uy; 0xf3uy; 0x6buy; 0xc6uy; 0xb0uy; 0x45uy; 0x5auy; 0x85uy;
0x20uy; 0xbcuy; 0x4euy; 0x6fuy; 0x5fuy; 0xe9uy; 0x5buy; 0x1fuy; 0xe3uy; 0xc8uy; 0x45uy; 0x2buy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test3_expected224 | val test3_expected224 : Prims.list FStar.UInt8.t | let test3_expected224 = [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy;
0x5duy; 0xbauy; 0x5duy; 0xa1uy; 0xfduy; 0x89uy; 0x01uy; 0x50uy;
0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 34,
"end_line": 95,
"start_col": 0,
"start_line": 91
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3
let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test3_expected224 =
| [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy; 0x5duy; 0xbauy; 0x5duy; 0xa1uy;
0xfduy; 0x89uy; 0x01uy; 0x50uy; 0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy
] | false |
|
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.frame_region | val frame_region (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.(loc_disjoint l (region_of ll)) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll) | val frame_region (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.(loc_disjoint l (region_of ll)) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll) | let frame_region #_ ll _ h0 h1 =
footprint_in_r h0 ll;
() | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 4,
"end_line": 149,
"start_col": 0,
"start_line": 147
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients.
val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)
let v #_ h ll =
B.deref h ll.v
/// Normally clients want to reason via the footprint. However, in some case
/// (e.g. taking pointers directly to list cells), it's helpful to have a more
/// precise way to reason about the footprint. This is done via the cells, a
/// list of pointers to the individual cells, which characterizes fully the
/// footprint and the v function. See LL1.
val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True)
let cells #a h ll =
LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v)
// A workaround to avoid putting loc_all_regions_from true in patterns.
let region_of ll = B.loc_all_regions_from false ll.r
/// This is a most useful lemma for clients: all the bookkeeping of this linked
/// list, including spine, is subsumed in region r, at any time.
///
/// This allows clients to allocate a new region for ``r``, maintain the
/// invariant that ``r`` is disjoint from their own data structures, and get
/// easy separation and framing for their own data this way.
///
/// Note that we don't generally have to state such lemmas, since in many cases,
/// footprints are static and do not grow dynamically.
///
/// Unfortunately, this lemma requires stating some intermediary asserts for
/// some triggers to fire, and I could not find a good SMTPat for it, so clients
/// have to call it manually. See test/Wireguard.fst.
let footprint_in_r #a (h: HS.mem) (ll: t a): Lemma
(requires invariant h ll)
(ensures B.(loc_includes (region_of ll) (footprint h ll)))
//[ SMTPat (footprint h ll) ]
=
assert B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h (B.deref h ll.ptr) (v h ll)));
assert B.(loc_includes (loc_all_regions_from true ll.r) (loc_region_only true ll.spine_rid))
/// I'm stating this one for completeness, but clients are able to derive this
/// lemma automatically because the representation is transparent.
val frame_footprint (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.loc_disjoint l (footprint h0 ll) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_footprint #_ _ _ _ _ =
()
/// This one is the framing lemma clients want to use if they adopt region-based
/// reasoning for their LL2 instance. Owing to the lack of pattern on footprint_in_r,
/// clients also have to call this one manually, sadly.
val frame_region (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.(loc_disjoint l (region_of ll)) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\ | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
ll: LowStar.Lib.LinkedList2.t a ->
l: LowStar.Monotonic.Buffer.loc ->
h0: FStar.Monotonic.HyperStack.mem ->
h1: FStar.Monotonic.HyperStack.mem
-> FStar.Pervasives.Lemma
(requires
LowStar.Lib.LinkedList2.invariant h0 ll /\
LowStar.Monotonic.Buffer.loc_disjoint l (LowStar.Lib.LinkedList2.region_of ll) /\
LowStar.Monotonic.Buffer.modifies l h0 h1)
(ensures
LowStar.Lib.LinkedList2.invariant h1 ll /\
LowStar.Lib.LinkedList2.footprint h1 ll == LowStar.Lib.LinkedList2.footprint h0 ll) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowStar.Lib.LinkedList2.t",
"LowStar.Monotonic.Buffer.loc",
"FStar.Monotonic.HyperStack.mem",
"Prims.unit",
"LowStar.Lib.LinkedList2.footprint_in_r"
] | [] | true | false | true | false | false | let frame_region #_ ll _ h0 h1 =
| footprint_in_r h0 ll;
() | false |
Spec.Hash.Test.fst | Spec.Hash.Test.test3_expected512 | val test3_expected512 : Prims.list FStar.UInt8.t | let test3_expected512 = [
0x20uy; 0x4auy; 0x8fuy; 0xc6uy; 0xdduy; 0xa8uy; 0x2fuy; 0x0auy;
0x0cuy; 0xeduy; 0x7buy; 0xebuy; 0x8euy; 0x08uy; 0xa4uy; 0x16uy;
0x57uy; 0xc1uy; 0x6euy; 0xf4uy; 0x68uy; 0xb2uy; 0x28uy; 0xa8uy;
0x27uy; 0x9buy; 0xe3uy; 0x31uy; 0xa7uy; 0x03uy; 0xc3uy; 0x35uy;
0x96uy; 0xfduy; 0x15uy; 0xc1uy; 0x3buy; 0x1buy; 0x07uy; 0xf9uy;
0xaauy; 0x1duy; 0x3buy; 0xeauy; 0x57uy; 0x78uy; 0x9cuy; 0xa0uy;
0x31uy; 0xaduy; 0x85uy; 0xc7uy; 0xa7uy; 0x1duy; 0xd7uy; 0x03uy;
0x54uy; 0xecuy; 0x63uy; 0x12uy; 0x38uy; 0xcauy; 0x34uy; 0x45uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 119,
"start_col": 0,
"start_line": 111
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3
let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ]
let test3_expected224 = [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy;
0x5duy; 0xbauy; 0x5duy; 0xa1uy; 0xfduy; 0x89uy; 0x01uy; 0x50uy;
0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy ]
let test3_expected256 = [
0x24uy; 0x8duy; 0x6auy; 0x61uy; 0xd2uy; 0x06uy; 0x38uy; 0xb8uy;
0xe5uy; 0xc0uy; 0x26uy; 0x93uy; 0x0cuy; 0x3euy; 0x60uy; 0x39uy;
0xa3uy; 0x3cuy; 0xe4uy; 0x59uy; 0x64uy; 0xffuy; 0x21uy; 0x67uy;
0xf6uy; 0xecuy; 0xeduy; 0xd4uy; 0x19uy; 0xdbuy; 0x06uy; 0xc1uy ]
let test3_expected384 = [
0x33uy; 0x91uy; 0xfduy; 0xdduy; 0xfcuy; 0x8duy; 0xc7uy; 0x39uy;
0x37uy; 0x07uy; 0xa6uy; 0x5buy; 0x1buy; 0x47uy; 0x09uy; 0x39uy;
0x7cuy; 0xf8uy; 0xb1uy; 0xd1uy; 0x62uy; 0xafuy; 0x05uy; 0xabuy;
0xfeuy; 0x8fuy; 0x45uy; 0x0duy; 0xe5uy; 0xf3uy; 0x6buy; 0xc6uy;
0xb0uy; 0x45uy; 0x5auy; 0x85uy; 0x20uy; 0xbcuy; 0x4euy; 0x6fuy;
0x5fuy; 0xe9uy; 0x5buy; 0x1fuy; 0xe3uy; 0xc8uy; 0x45uy; 0x2buy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test3_expected512 =
| [
0x20uy; 0x4auy; 0x8fuy; 0xc6uy; 0xdduy; 0xa8uy; 0x2fuy; 0x0auy; 0x0cuy; 0xeduy; 0x7buy; 0xebuy;
0x8euy; 0x08uy; 0xa4uy; 0x16uy; 0x57uy; 0xc1uy; 0x6euy; 0xf4uy; 0x68uy; 0xb2uy; 0x28uy; 0xa8uy;
0x27uy; 0x9buy; 0xe3uy; 0x31uy; 0xa7uy; 0x03uy; 0xc3uy; 0x35uy; 0x96uy; 0xfduy; 0x15uy; 0xc1uy;
0x3buy; 0x1buy; 0x07uy; 0xf9uy; 0xaauy; 0x1duy; 0x3buy; 0xeauy; 0x57uy; 0x78uy; 0x9cuy; 0xa0uy;
0x31uy; 0xaduy; 0x85uy; 0xc7uy; 0xa7uy; 0x1duy; 0xd7uy; 0x03uy; 0x54uy; 0xecuy; 0x63uy; 0x12uy;
0x38uy; 0xcauy; 0x34uy; 0x45uy
] | false |
|
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.create_in | val create_in: #a:Type -> r:HS.rid -> ST (t a)
(requires fun h0 ->
ST.is_eternal_region r)
(ensures fun h0 ll h1 ->
invariant h1 ll /\
B.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint h1 ll) h0 h1 /\
v h1 ll == [] /\
cells h1 ll == [] /\
ll.r == r) | val create_in: #a:Type -> r:HS.rid -> ST (t a)
(requires fun h0 ->
ST.is_eternal_region r)
(ensures fun h0 ll h1 ->
invariant h1 ll /\
B.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint h1 ll) h0 h1 /\
v h1 ll == [] /\
cells h1 ll == [] /\
ll.r == r) | let create_in #a r =
let ptr_v_rid = ST.new_region r in
let spine_rid = ST.new_region r in
let ptr = B.malloc ptr_v_rid (B.null <: LL1.t a) 1ul in
let v = B.malloc ptr_v_rid (G.hide ([] <: list a)) 1ul in
{ ptr; v; r; ptr_v_rid; spine_rid } | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 37,
"end_line": 182,
"start_col": 0,
"start_line": 177
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients.
val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)
let v #_ h ll =
B.deref h ll.v
/// Normally clients want to reason via the footprint. However, in some case
/// (e.g. taking pointers directly to list cells), it's helpful to have a more
/// precise way to reason about the footprint. This is done via the cells, a
/// list of pointers to the individual cells, which characterizes fully the
/// footprint and the v function. See LL1.
val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True)
let cells #a h ll =
LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v)
// A workaround to avoid putting loc_all_regions_from true in patterns.
let region_of ll = B.loc_all_regions_from false ll.r
/// This is a most useful lemma for clients: all the bookkeeping of this linked
/// list, including spine, is subsumed in region r, at any time.
///
/// This allows clients to allocate a new region for ``r``, maintain the
/// invariant that ``r`` is disjoint from their own data structures, and get
/// easy separation and framing for their own data this way.
///
/// Note that we don't generally have to state such lemmas, since in many cases,
/// footprints are static and do not grow dynamically.
///
/// Unfortunately, this lemma requires stating some intermediary asserts for
/// some triggers to fire, and I could not find a good SMTPat for it, so clients
/// have to call it manually. See test/Wireguard.fst.
let footprint_in_r #a (h: HS.mem) (ll: t a): Lemma
(requires invariant h ll)
(ensures B.(loc_includes (region_of ll) (footprint h ll)))
//[ SMTPat (footprint h ll) ]
=
assert B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h (B.deref h ll.ptr) (v h ll)));
assert B.(loc_includes (loc_all_regions_from true ll.r) (loc_region_only true ll.spine_rid))
/// I'm stating this one for completeness, but clients are able to derive this
/// lemma automatically because the representation is transparent.
val frame_footprint (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.loc_disjoint l (footprint h0 ll) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_footprint #_ _ _ _ _ =
()
/// This one is the framing lemma clients want to use if they adopt region-based
/// reasoning for their LL2 instance. Owing to the lack of pattern on footprint_in_r,
/// clients also have to call this one manually, sadly.
val frame_region (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.(loc_disjoint l (region_of ll)) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_region #_ ll _ h0 h1 =
footprint_in_r h0 ll;
()
/// Stateful operations
/// -------------------
///
/// These are high-level and use the ``v`` function. I expect clients to drop
/// into the LL1 representation only when they need to iterate, e.g. to find a
/// list element, or to remove a list element.
///
/// Note that these functions have a "dual" specification, both in terms of the
/// ``footprint`` predicate (coarse) and in terms of the ``cells`` predicate
/// (precise). Most clients will be content with the former and region-based
/// reasoning, but advanced clients that e.g. take pointers directly to list
/// cells will most likely need to use the latter.
/// Heap allocation of a fresh linked list.
val create_in: #a:Type -> r:HS.rid -> ST (t a)
(requires fun h0 ->
ST.is_eternal_region r)
(ensures fun h0 ll h1 ->
invariant h1 ll /\
B.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint h1 ll) h0 h1 /\
v h1 ll == [] /\
cells h1 ll == [] /\
ll.r == r) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | r: FStar.Monotonic.HyperHeap.rid -> FStar.HyperStack.ST.ST (LowStar.Lib.LinkedList2.t a) | FStar.HyperStack.ST.ST | [] | [] | [
"FStar.Monotonic.HyperHeap.rid",
"LowStar.Lib.LinkedList2.Mkt",
"LowStar.Lib.LinkedList2.t",
"LowStar.Monotonic.Buffer.mbuffer",
"FStar.Ghost.erased",
"Prims.list",
"LowStar.Buffer.trivial_preorder",
"Prims.l_and",
"Prims.eq2",
"Prims.nat",
"LowStar.Monotonic.Buffer.length",
"FStar.UInt32.v",
"FStar.UInt32.uint_to_t",
"FStar.UInt32.t",
"Prims.b2t",
"Prims.op_Negation",
"LowStar.Monotonic.Buffer.g_is_null",
"LowStar.Monotonic.Buffer.frameOf",
"LowStar.Monotonic.Buffer.freeable",
"LowStar.Buffer.malloc",
"FStar.Ghost.hide",
"Prims.Nil",
"FStar.UInt32.__uint_to_t",
"LowStar.Lib.LinkedList.t",
"LowStar.Buffer.null",
"LowStar.Lib.LinkedList.cell",
"FStar.HyperStack.ST.new_region"
] | [] | false | true | false | false | false | let create_in #a r =
| let ptr_v_rid = ST.new_region r in
let spine_rid = ST.new_region r in
let ptr = B.malloc ptr_v_rid (B.null <: LL1.t a) 1ul in
let v = B.malloc ptr_v_rid (G.hide ([] <: list a)) 1ul in
{ ptr = ptr; v = v; r = r; ptr_v_rid = ptr_v_rid; spine_rid = spine_rid } | false |
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.footprint_in_r | val footprint_in_r (#a: _) (h: HS.mem) (ll: t a)
: Lemma (requires invariant h ll) (ensures B.(loc_includes (region_of ll) (footprint h ll))) | val footprint_in_r (#a: _) (h: HS.mem) (ll: t a)
: Lemma (requires invariant h ll) (ensures B.(loc_includes (region_of ll) (footprint h ll))) | let footprint_in_r #a (h: HS.mem) (ll: t a): Lemma
(requires invariant h ll)
(ensures B.(loc_includes (region_of ll) (footprint h ll)))
//[ SMTPat (footprint h ll) ]
=
assert B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h (B.deref h ll.ptr) (v h ll)));
assert B.(loc_includes (loc_all_regions_from true ll.r) (loc_region_only true ll.spine_rid)) | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 94,
"end_line": 121,
"start_col": 0,
"start_line": 115
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients.
val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)
let v #_ h ll =
B.deref h ll.v
/// Normally clients want to reason via the footprint. However, in some case
/// (e.g. taking pointers directly to list cells), it's helpful to have a more
/// precise way to reason about the footprint. This is done via the cells, a
/// list of pointers to the individual cells, which characterizes fully the
/// footprint and the v function. See LL1.
val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True)
let cells #a h ll =
LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v)
// A workaround to avoid putting loc_all_regions_from true in patterns.
let region_of ll = B.loc_all_regions_from false ll.r
/// This is a most useful lemma for clients: all the bookkeeping of this linked
/// list, including spine, is subsumed in region r, at any time.
///
/// This allows clients to allocate a new region for ``r``, maintain the
/// invariant that ``r`` is disjoint from their own data structures, and get
/// easy separation and framing for their own data this way.
///
/// Note that we don't generally have to state such lemmas, since in many cases,
/// footprints are static and do not grow dynamically.
///
/// Unfortunately, this lemma requires stating some intermediary asserts for
/// some triggers to fire, and I could not find a good SMTPat for it, so clients | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: FStar.Monotonic.HyperStack.mem -> ll: LowStar.Lib.LinkedList2.t a
-> FStar.Pervasives.Lemma (requires LowStar.Lib.LinkedList2.invariant h ll)
(ensures
LowStar.Monotonic.Buffer.loc_includes (LowStar.Lib.LinkedList2.region_of ll)
(LowStar.Lib.LinkedList2.footprint h ll)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"FStar.Monotonic.HyperStack.mem",
"LowStar.Lib.LinkedList2.t",
"Prims._assert",
"LowStar.Monotonic.Buffer.loc_includes",
"LowStar.Monotonic.Buffer.loc_all_regions_from",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__r",
"LowStar.Monotonic.Buffer.loc_region_only",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__spine_rid",
"Prims.unit",
"LowStar.Lib.LinkedList.footprint",
"LowStar.Monotonic.Buffer.deref",
"LowStar.Lib.LinkedList.t",
"LowStar.Buffer.trivial_preorder",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__ptr",
"LowStar.Lib.LinkedList2.v",
"LowStar.Lib.LinkedList2.invariant",
"Prims.squash",
"LowStar.Lib.LinkedList2.region_of",
"LowStar.Lib.LinkedList2.footprint",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let footprint_in_r #a (h: HS.mem) (ll: t a)
: Lemma (requires invariant h ll) (ensures B.(loc_includes (region_of ll) (footprint h ll))) =
| assert B.(loc_includes (loc_region_only true ll.spine_rid)
(LL1.footprint h (B.deref h ll.ptr) (v h ll)));
assert B.(loc_includes (loc_all_regions_from true ll.r) (loc_region_only true ll.spine_rid)) | false |
Spec.Hash.Test.fst | Spec.Hash.Test.test4_expected256 | val test4_expected256 : Prims.list FStar.UInt8.t | let test4_expected256 = [
0xcfuy; 0x5buy; 0x16uy; 0xa7uy; 0x78uy; 0xafuy; 0x83uy; 0x80uy;
0x03uy; 0x6cuy; 0xe5uy; 0x9euy; 0x7buy; 0x04uy; 0x92uy; 0x37uy;
0x0buy; 0x24uy; 0x9buy; 0x11uy; 0xe8uy; 0xf0uy; 0x7auy; 0x51uy;
0xafuy; 0xacuy; 0x45uy; 0x03uy; 0x7auy; 0xfeuy; 0xe9uy; 0xd1uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 150,
"start_col": 0,
"start_line": 146
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3
let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ]
let test3_expected224 = [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy;
0x5duy; 0xbauy; 0x5duy; 0xa1uy; 0xfduy; 0x89uy; 0x01uy; 0x50uy;
0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy ]
let test3_expected256 = [
0x24uy; 0x8duy; 0x6auy; 0x61uy; 0xd2uy; 0x06uy; 0x38uy; 0xb8uy;
0xe5uy; 0xc0uy; 0x26uy; 0x93uy; 0x0cuy; 0x3euy; 0x60uy; 0x39uy;
0xa3uy; 0x3cuy; 0xe4uy; 0x59uy; 0x64uy; 0xffuy; 0x21uy; 0x67uy;
0xf6uy; 0xecuy; 0xeduy; 0xd4uy; 0x19uy; 0xdbuy; 0x06uy; 0xc1uy ]
let test3_expected384 = [
0x33uy; 0x91uy; 0xfduy; 0xdduy; 0xfcuy; 0x8duy; 0xc7uy; 0x39uy;
0x37uy; 0x07uy; 0xa6uy; 0x5buy; 0x1buy; 0x47uy; 0x09uy; 0x39uy;
0x7cuy; 0xf8uy; 0xb1uy; 0xd1uy; 0x62uy; 0xafuy; 0x05uy; 0xabuy;
0xfeuy; 0x8fuy; 0x45uy; 0x0duy; 0xe5uy; 0xf3uy; 0x6buy; 0xc6uy;
0xb0uy; 0x45uy; 0x5auy; 0x85uy; 0x20uy; 0xbcuy; 0x4euy; 0x6fuy;
0x5fuy; 0xe9uy; 0x5buy; 0x1fuy; 0xe3uy; 0xc8uy; 0x45uy; 0x2buy ]
let test3_expected512 = [
0x20uy; 0x4auy; 0x8fuy; 0xc6uy; 0xdduy; 0xa8uy; 0x2fuy; 0x0auy;
0x0cuy; 0xeduy; 0x7buy; 0xebuy; 0x8euy; 0x08uy; 0xa4uy; 0x16uy;
0x57uy; 0xc1uy; 0x6euy; 0xf4uy; 0x68uy; 0xb2uy; 0x28uy; 0xa8uy;
0x27uy; 0x9buy; 0xe3uy; 0x31uy; 0xa7uy; 0x03uy; 0xc3uy; 0x35uy;
0x96uy; 0xfduy; 0x15uy; 0xc1uy; 0x3buy; 0x1buy; 0x07uy; 0xf9uy;
0xaauy; 0x1duy; 0x3buy; 0xeauy; 0x57uy; 0x78uy; 0x9cuy; 0xa0uy;
0x31uy; 0xaduy; 0x85uy; 0xc7uy; 0xa7uy; 0x1duy; 0xd7uy; 0x03uy;
0x54uy; 0xecuy; 0x63uy; 0x12uy; 0x38uy; 0xcauy; 0x34uy; 0x45uy ]
/// Test 4
let test4_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy;
0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy;
0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy;
0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy;
0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy;
0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy;
0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy ]
let test4_expected224 = [
0xc9uy; 0x7cuy; 0xa9uy; 0xa5uy; 0x59uy; 0x85uy; 0x0cuy; 0xe9uy;
0x7auy; 0x04uy; 0xa9uy; 0x6duy; 0xefuy; 0x6duy; 0x99uy; 0xa9uy;
0xe0uy; 0xe0uy; 0xe2uy; 0xabuy; 0x14uy; 0xe6uy; 0xb8uy; 0xdfuy;
0x26uy; 0x5fuy; 0xc0uy; 0xb3uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test4_expected256 =
| [
0xcfuy; 0x5buy; 0x16uy; 0xa7uy; 0x78uy; 0xafuy; 0x83uy; 0x80uy; 0x03uy; 0x6cuy; 0xe5uy; 0x9euy;
0x7buy; 0x04uy; 0x92uy; 0x37uy; 0x0buy; 0x24uy; 0x9buy; 0x11uy; 0xe8uy; 0xf0uy; 0x7auy; 0x51uy;
0xafuy; 0xacuy; 0x45uy; 0x03uy; 0x7auy; 0xfeuy; 0xe9uy; 0xd1uy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test4_expected512 | val test4_expected512 : Prims.list FStar.UInt8.t | let test4_expected512 = [
0x8euy; 0x95uy; 0x9buy; 0x75uy; 0xdauy; 0xe3uy; 0x13uy; 0xdauy;
0x8cuy; 0xf4uy; 0xf7uy; 0x28uy; 0x14uy; 0xfcuy; 0x14uy; 0x3fuy;
0x8fuy; 0x77uy; 0x79uy; 0xc6uy; 0xebuy; 0x9fuy; 0x7fuy; 0xa1uy;
0x72uy; 0x99uy; 0xaeuy; 0xaduy; 0xb6uy; 0x88uy; 0x90uy; 0x18uy;
0x50uy; 0x1duy; 0x28uy; 0x9euy; 0x49uy; 0x00uy; 0xf7uy; 0xe4uy;
0x33uy; 0x1buy; 0x99uy; 0xdeuy; 0xc4uy; 0xb5uy; 0x43uy; 0x3auy;
0xc7uy; 0xd3uy; 0x29uy; 0xeeuy; 0xb6uy; 0xdduy; 0x26uy; 0x54uy;
0x5euy; 0x96uy; 0xe5uy; 0x5buy; 0x87uy; 0x4buy; 0xe9uy; 0x09uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 168,
"start_col": 0,
"start_line": 160
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3
let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ]
let test3_expected224 = [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy;
0x5duy; 0xbauy; 0x5duy; 0xa1uy; 0xfduy; 0x89uy; 0x01uy; 0x50uy;
0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy ]
let test3_expected256 = [
0x24uy; 0x8duy; 0x6auy; 0x61uy; 0xd2uy; 0x06uy; 0x38uy; 0xb8uy;
0xe5uy; 0xc0uy; 0x26uy; 0x93uy; 0x0cuy; 0x3euy; 0x60uy; 0x39uy;
0xa3uy; 0x3cuy; 0xe4uy; 0x59uy; 0x64uy; 0xffuy; 0x21uy; 0x67uy;
0xf6uy; 0xecuy; 0xeduy; 0xd4uy; 0x19uy; 0xdbuy; 0x06uy; 0xc1uy ]
let test3_expected384 = [
0x33uy; 0x91uy; 0xfduy; 0xdduy; 0xfcuy; 0x8duy; 0xc7uy; 0x39uy;
0x37uy; 0x07uy; 0xa6uy; 0x5buy; 0x1buy; 0x47uy; 0x09uy; 0x39uy;
0x7cuy; 0xf8uy; 0xb1uy; 0xd1uy; 0x62uy; 0xafuy; 0x05uy; 0xabuy;
0xfeuy; 0x8fuy; 0x45uy; 0x0duy; 0xe5uy; 0xf3uy; 0x6buy; 0xc6uy;
0xb0uy; 0x45uy; 0x5auy; 0x85uy; 0x20uy; 0xbcuy; 0x4euy; 0x6fuy;
0x5fuy; 0xe9uy; 0x5buy; 0x1fuy; 0xe3uy; 0xc8uy; 0x45uy; 0x2buy ]
let test3_expected512 = [
0x20uy; 0x4auy; 0x8fuy; 0xc6uy; 0xdduy; 0xa8uy; 0x2fuy; 0x0auy;
0x0cuy; 0xeduy; 0x7buy; 0xebuy; 0x8euy; 0x08uy; 0xa4uy; 0x16uy;
0x57uy; 0xc1uy; 0x6euy; 0xf4uy; 0x68uy; 0xb2uy; 0x28uy; 0xa8uy;
0x27uy; 0x9buy; 0xe3uy; 0x31uy; 0xa7uy; 0x03uy; 0xc3uy; 0x35uy;
0x96uy; 0xfduy; 0x15uy; 0xc1uy; 0x3buy; 0x1buy; 0x07uy; 0xf9uy;
0xaauy; 0x1duy; 0x3buy; 0xeauy; 0x57uy; 0x78uy; 0x9cuy; 0xa0uy;
0x31uy; 0xaduy; 0x85uy; 0xc7uy; 0xa7uy; 0x1duy; 0xd7uy; 0x03uy;
0x54uy; 0xecuy; 0x63uy; 0x12uy; 0x38uy; 0xcauy; 0x34uy; 0x45uy ]
/// Test 4
let test4_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy;
0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy;
0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy;
0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy;
0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy;
0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy;
0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy ]
let test4_expected224 = [
0xc9uy; 0x7cuy; 0xa9uy; 0xa5uy; 0x59uy; 0x85uy; 0x0cuy; 0xe9uy;
0x7auy; 0x04uy; 0xa9uy; 0x6duy; 0xefuy; 0x6duy; 0x99uy; 0xa9uy;
0xe0uy; 0xe0uy; 0xe2uy; 0xabuy; 0x14uy; 0xe6uy; 0xb8uy; 0xdfuy;
0x26uy; 0x5fuy; 0xc0uy; 0xb3uy ]
let test4_expected256 = [
0xcfuy; 0x5buy; 0x16uy; 0xa7uy; 0x78uy; 0xafuy; 0x83uy; 0x80uy;
0x03uy; 0x6cuy; 0xe5uy; 0x9euy; 0x7buy; 0x04uy; 0x92uy; 0x37uy;
0x0buy; 0x24uy; 0x9buy; 0x11uy; 0xe8uy; 0xf0uy; 0x7auy; 0x51uy;
0xafuy; 0xacuy; 0x45uy; 0x03uy; 0x7auy; 0xfeuy; 0xe9uy; 0xd1uy ]
let test4_expected384 = [
0x09uy; 0x33uy; 0x0cuy; 0x33uy; 0xf7uy; 0x11uy; 0x47uy; 0xe8uy;
0x3duy; 0x19uy; 0x2fuy; 0xc7uy; 0x82uy; 0xcduy; 0x1buy; 0x47uy;
0x53uy; 0x11uy; 0x1buy; 0x17uy; 0x3buy; 0x3buy; 0x05uy; 0xd2uy;
0x2fuy; 0xa0uy; 0x80uy; 0x86uy; 0xe3uy; 0xb0uy; 0xf7uy; 0x12uy;
0xfcuy; 0xc7uy; 0xc7uy; 0x1auy; 0x55uy; 0x7euy; 0x2duy; 0xb9uy;
0x66uy; 0xc3uy; 0xe9uy; 0xfauy; 0x91uy; 0x74uy; 0x60uy; 0x39uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test4_expected512 =
| [
0x8euy; 0x95uy; 0x9buy; 0x75uy; 0xdauy; 0xe3uy; 0x13uy; 0xdauy; 0x8cuy; 0xf4uy; 0xf7uy; 0x28uy;
0x14uy; 0xfcuy; 0x14uy; 0x3fuy; 0x8fuy; 0x77uy; 0x79uy; 0xc6uy; 0xebuy; 0x9fuy; 0x7fuy; 0xa1uy;
0x72uy; 0x99uy; 0xaeuy; 0xaduy; 0xb6uy; 0x88uy; 0x90uy; 0x18uy; 0x50uy; 0x1duy; 0x28uy; 0x9euy;
0x49uy; 0x00uy; 0xf7uy; 0xe4uy; 0x33uy; 0x1buy; 0x99uy; 0xdeuy; 0xc4uy; 0xb5uy; 0x43uy; 0x3auy;
0xc7uy; 0xd3uy; 0x29uy; 0xeeuy; 0xb6uy; 0xdduy; 0x26uy; 0x54uy; 0x5euy; 0x96uy; 0xe5uy; 0x5buy;
0x87uy; 0x4buy; 0xe9uy; 0x09uy
] | false |
|
Spec.Hash.Test.fst | Spec.Hash.Test.test4_expected384 | val test4_expected384 : Prims.list FStar.UInt8.t | let test4_expected384 = [
0x09uy; 0x33uy; 0x0cuy; 0x33uy; 0xf7uy; 0x11uy; 0x47uy; 0xe8uy;
0x3duy; 0x19uy; 0x2fuy; 0xc7uy; 0x82uy; 0xcduy; 0x1buy; 0x47uy;
0x53uy; 0x11uy; 0x1buy; 0x17uy; 0x3buy; 0x3buy; 0x05uy; 0xd2uy;
0x2fuy; 0xa0uy; 0x80uy; 0x86uy; 0xe3uy; 0xb0uy; 0xf7uy; 0x12uy;
0xfcuy; 0xc7uy; 0xc7uy; 0x1auy; 0x55uy; 0x7euy; 0x2duy; 0xb9uy;
0x66uy; 0xc3uy; 0xe9uy; 0xfauy; 0x91uy; 0x74uy; 0x60uy; 0x39uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 158,
"start_col": 0,
"start_line": 152
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3
let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ]
let test3_expected224 = [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy;
0x5duy; 0xbauy; 0x5duy; 0xa1uy; 0xfduy; 0x89uy; 0x01uy; 0x50uy;
0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy ]
let test3_expected256 = [
0x24uy; 0x8duy; 0x6auy; 0x61uy; 0xd2uy; 0x06uy; 0x38uy; 0xb8uy;
0xe5uy; 0xc0uy; 0x26uy; 0x93uy; 0x0cuy; 0x3euy; 0x60uy; 0x39uy;
0xa3uy; 0x3cuy; 0xe4uy; 0x59uy; 0x64uy; 0xffuy; 0x21uy; 0x67uy;
0xf6uy; 0xecuy; 0xeduy; 0xd4uy; 0x19uy; 0xdbuy; 0x06uy; 0xc1uy ]
let test3_expected384 = [
0x33uy; 0x91uy; 0xfduy; 0xdduy; 0xfcuy; 0x8duy; 0xc7uy; 0x39uy;
0x37uy; 0x07uy; 0xa6uy; 0x5buy; 0x1buy; 0x47uy; 0x09uy; 0x39uy;
0x7cuy; 0xf8uy; 0xb1uy; 0xd1uy; 0x62uy; 0xafuy; 0x05uy; 0xabuy;
0xfeuy; 0x8fuy; 0x45uy; 0x0duy; 0xe5uy; 0xf3uy; 0x6buy; 0xc6uy;
0xb0uy; 0x45uy; 0x5auy; 0x85uy; 0x20uy; 0xbcuy; 0x4euy; 0x6fuy;
0x5fuy; 0xe9uy; 0x5buy; 0x1fuy; 0xe3uy; 0xc8uy; 0x45uy; 0x2buy ]
let test3_expected512 = [
0x20uy; 0x4auy; 0x8fuy; 0xc6uy; 0xdduy; 0xa8uy; 0x2fuy; 0x0auy;
0x0cuy; 0xeduy; 0x7buy; 0xebuy; 0x8euy; 0x08uy; 0xa4uy; 0x16uy;
0x57uy; 0xc1uy; 0x6euy; 0xf4uy; 0x68uy; 0xb2uy; 0x28uy; 0xa8uy;
0x27uy; 0x9buy; 0xe3uy; 0x31uy; 0xa7uy; 0x03uy; 0xc3uy; 0x35uy;
0x96uy; 0xfduy; 0x15uy; 0xc1uy; 0x3buy; 0x1buy; 0x07uy; 0xf9uy;
0xaauy; 0x1duy; 0x3buy; 0xeauy; 0x57uy; 0x78uy; 0x9cuy; 0xa0uy;
0x31uy; 0xaduy; 0x85uy; 0xc7uy; 0xa7uy; 0x1duy; 0xd7uy; 0x03uy;
0x54uy; 0xecuy; 0x63uy; 0x12uy; 0x38uy; 0xcauy; 0x34uy; 0x45uy ]
/// Test 4
let test4_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy;
0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy;
0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy;
0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy;
0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy;
0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy;
0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy ]
let test4_expected224 = [
0xc9uy; 0x7cuy; 0xa9uy; 0xa5uy; 0x59uy; 0x85uy; 0x0cuy; 0xe9uy;
0x7auy; 0x04uy; 0xa9uy; 0x6duy; 0xefuy; 0x6duy; 0x99uy; 0xa9uy;
0xe0uy; 0xe0uy; 0xe2uy; 0xabuy; 0x14uy; 0xe6uy; 0xb8uy; 0xdfuy;
0x26uy; 0x5fuy; 0xc0uy; 0xb3uy ]
let test4_expected256 = [
0xcfuy; 0x5buy; 0x16uy; 0xa7uy; 0x78uy; 0xafuy; 0x83uy; 0x80uy;
0x03uy; 0x6cuy; 0xe5uy; 0x9euy; 0x7buy; 0x04uy; 0x92uy; 0x37uy;
0x0buy; 0x24uy; 0x9buy; 0x11uy; 0xe8uy; 0xf0uy; 0x7auy; 0x51uy;
0xafuy; 0xacuy; 0x45uy; 0x03uy; 0x7auy; 0xfeuy; 0xe9uy; 0xd1uy ] | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test4_expected384 =
| [
0x09uy; 0x33uy; 0x0cuy; 0x33uy; 0xf7uy; 0x11uy; 0x47uy; 0xe8uy; 0x3duy; 0x19uy; 0x2fuy; 0xc7uy;
0x82uy; 0xcduy; 0x1buy; 0x47uy; 0x53uy; 0x11uy; 0x1buy; 0x17uy; 0x3buy; 0x3buy; 0x05uy; 0xd2uy;
0x2fuy; 0xa0uy; 0x80uy; 0x86uy; 0xe3uy; 0xb0uy; 0xf7uy; 0x12uy; 0xfcuy; 0xc7uy; 0xc7uy; 0x1auy;
0x55uy; 0x7euy; 0x2duy; 0xb9uy; 0x66uy; 0xc3uy; 0xe9uy; 0xfauy; 0x91uy; 0x74uy; 0x60uy; 0x39uy
] | false |
|
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.clear | val clear: #a:Type -> ll: t a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v `loc_union` loc_region_only true ll.spine_rid) h0 h1) /\
v h1 ll == [] /\
cells h1 ll == []) | val clear: #a:Type -> ll: t a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v `loc_union` loc_region_only true ll.spine_rid) h0 h1) /\
v h1 ll == [] /\
cells h1 ll == []) | let clear #a ll =
let v = !* ll.v in
LL1.free #_ #v ll.ptr;
ll.v *= G.hide [] | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 19,
"end_line": 269,
"start_col": 0,
"start_line": 266
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients.
val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)
let v #_ h ll =
B.deref h ll.v
/// Normally clients want to reason via the footprint. However, in some case
/// (e.g. taking pointers directly to list cells), it's helpful to have a more
/// precise way to reason about the footprint. This is done via the cells, a
/// list of pointers to the individual cells, which characterizes fully the
/// footprint and the v function. See LL1.
val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True)
let cells #a h ll =
LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v)
// A workaround to avoid putting loc_all_regions_from true in patterns.
let region_of ll = B.loc_all_regions_from false ll.r
/// This is a most useful lemma for clients: all the bookkeeping of this linked
/// list, including spine, is subsumed in region r, at any time.
///
/// This allows clients to allocate a new region for ``r``, maintain the
/// invariant that ``r`` is disjoint from their own data structures, and get
/// easy separation and framing for their own data this way.
///
/// Note that we don't generally have to state such lemmas, since in many cases,
/// footprints are static and do not grow dynamically.
///
/// Unfortunately, this lemma requires stating some intermediary asserts for
/// some triggers to fire, and I could not find a good SMTPat for it, so clients
/// have to call it manually. See test/Wireguard.fst.
let footprint_in_r #a (h: HS.mem) (ll: t a): Lemma
(requires invariant h ll)
(ensures B.(loc_includes (region_of ll) (footprint h ll)))
//[ SMTPat (footprint h ll) ]
=
assert B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h (B.deref h ll.ptr) (v h ll)));
assert B.(loc_includes (loc_all_regions_from true ll.r) (loc_region_only true ll.spine_rid))
/// I'm stating this one for completeness, but clients are able to derive this
/// lemma automatically because the representation is transparent.
val frame_footprint (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.loc_disjoint l (footprint h0 ll) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_footprint #_ _ _ _ _ =
()
/// This one is the framing lemma clients want to use if they adopt region-based
/// reasoning for their LL2 instance. Owing to the lack of pattern on footprint_in_r,
/// clients also have to call this one manually, sadly.
val frame_region (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.(loc_disjoint l (region_of ll)) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_region #_ ll _ h0 h1 =
footprint_in_r h0 ll;
()
/// Stateful operations
/// -------------------
///
/// These are high-level and use the ``v`` function. I expect clients to drop
/// into the LL1 representation only when they need to iterate, e.g. to find a
/// list element, or to remove a list element.
///
/// Note that these functions have a "dual" specification, both in terms of the
/// ``footprint`` predicate (coarse) and in terms of the ``cells`` predicate
/// (precise). Most clients will be content with the former and region-based
/// reasoning, but advanced clients that e.g. take pointers directly to list
/// cells will most likely need to use the latter.
/// Heap allocation of a fresh linked list.
val create_in: #a:Type -> r:HS.rid -> ST (t a)
(requires fun h0 ->
ST.is_eternal_region r)
(ensures fun h0 ll h1 ->
invariant h1 ll /\
B.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint h1 ll) h0 h1 /\
v h1 ll == [] /\
cells h1 ll == [] /\
ll.r == r)
#push-options "--fuel 1"
let create_in #a r =
let ptr_v_rid = ST.new_region r in
let spine_rid = ST.new_region r in
let ptr = B.malloc ptr_v_rid (B.null <: LL1.t a) 1ul in
let v = B.malloc ptr_v_rid (G.hide ([] <: list a)) 1ul in
{ ptr; v; r; ptr_v_rid; spine_rid }
#pop-options
val push: #a:Type -> ll: t a -> x: a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
// Coarse modifies clause
B.(modifies (footprint h0 ll) h0 h1) /\
// Functional spec
v h1 ll == x :: v h0 ll /\
// Precise effect on memory, ignore if you're content with reasoning via the
// footprint (which is known to be always included in the region).
Cons? (cells h1 ll) /\ List.Tot.tl (cells h1 ll) == cells h0 ll /\
B.fresh_loc (B.loc_addr_of_buffer (List.Tot.hd (cells h1 ll))) h0 h1)
#push-options "--fuel 1 --ifuel 1"
let push #a ll x =
LL1.push ll.spine_rid (!* ll.v) ll.ptr x;
let v = !* ll.v in
ll.v *= G.hide (x :: v)
#pop-options
#push-options "--fuel 1"
val pop: #a:Type -> ll: t a -> ST a
(requires fun h0 ->
invariant h0 ll /\
Cons? (v h0 ll))
(ensures fun h0 x h1 ->
let hd :: tl = v h0 ll in
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v) h0 h1) /\
v h1 ll == tl /\
cells h1 ll == List.Tot.tl (cells h0 ll) /\
x == hd)
let pop #a ll =
let r = LL1.pop ll.spine_rid (!* ll.v) ll.ptr in
let v = !* ll.v in
ll.v *= G.hide (List.Tot.tl v);
r
val maybe_pop: #a:Type -> ll: t a -> ST (option a)
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 x h1 ->
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\ (
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v) h0 h1) /\
match x with
| Some x ->
Cons? (v h0 ll) /\ (
let hd :: tl = v h0 ll in
v h1 ll == tl /\
cells h1 ll == List.Tot.tl (cells h0 ll) /\
x == hd)
| None ->
Nil? (v h0 ll)))
#pop-options
#push-options "--fuel 1 --ifuel 1 --z3rlimit 50"
let maybe_pop #a ll =
if not (B.is_null (!* ll.ptr)) then
let v = !* ll.v in
let r = LL1.pop ll.spine_rid (!* ll.v) ll.ptr in
ll.v *= G.hide (List.Tot.tl v);
Some r
else
None
#pop-options
val clear: #a:Type -> ll: t a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v `loc_union` loc_region_only true ll.spine_rid) h0 h1) /\
v h1 ll == [] /\
cells h1 ll == []) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ll: LowStar.Lib.LinkedList2.t a -> FStar.HyperStack.ST.ST Prims.unit | FStar.HyperStack.ST.ST | [] | [] | [
"LowStar.Lib.LinkedList2.t",
"LowStar.BufferOps.op_Star_Equals",
"FStar.Ghost.erased",
"Prims.list",
"LowStar.Buffer.trivial_preorder",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__v",
"FStar.Ghost.hide",
"Prims.Nil",
"Prims.unit",
"LowStar.Lib.LinkedList.free",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__ptr",
"LowStar.BufferOps.op_Bang_Star"
] | [] | false | true | false | false | false | let clear #a ll =
| let v = !*ll.v in
LL1.free #_ #v ll.ptr;
ll.v *= G.hide [] | false |
Spec.Hash.Test.fst | Spec.Hash.Test.test4_plaintext | val test4_plaintext : Prims.list FStar.UInt8.t | let test4_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy;
0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy;
0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy;
0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy;
0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy;
0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy;
0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy;
0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy ] | {
"file_name": "specs/tests/Spec.Hash.Test.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 66,
"end_line": 138,
"start_col": 0,
"start_line": 124
} | module Spec.Hash.Test
open FStar.Seq
module PS = Lib.PrintSequence
#set-options "--z3rlimit 50 --fuel 0 --ifuel 0"
/// Test 1
let test1_plaintext = [0x61uy; 0x62uy; 0x63uy]
let test1_expected224 = [
0x23uy; 0x09uy; 0x7duy; 0x22uy; 0x34uy; 0x05uy; 0xd8uy; 0x22uy;
0x86uy; 0x42uy; 0xa4uy; 0x77uy; 0xbduy; 0xa2uy; 0x55uy; 0xb3uy;
0x2auy; 0xaduy; 0xbcuy; 0xe4uy; 0xbduy; 0xa0uy; 0xb3uy; 0xf7uy;
0xe3uy; 0x6cuy; 0x9duy; 0xa7uy ]
let test1_expected256 = [
0xbauy; 0x78uy; 0x16uy; 0xbfuy; 0x8fuy; 0x01uy; 0xcfuy; 0xeauy;
0x41uy; 0x41uy; 0x40uy; 0xdeuy; 0x5duy; 0xaeuy; 0x22uy; 0x23uy;
0xb0uy; 0x03uy; 0x61uy; 0xa3uy; 0x96uy; 0x17uy; 0x7auy; 0x9cuy;
0xb4uy; 0x10uy; 0xffuy; 0x61uy; 0xf2uy; 0x00uy; 0x15uy; 0xaduy ]
let test1_expected384 = [
0xcbuy; 0x00uy; 0x75uy; 0x3fuy; 0x45uy; 0xa3uy; 0x5euy; 0x8buy;
0xb5uy; 0xa0uy; 0x3duy; 0x69uy; 0x9auy; 0xc6uy; 0x50uy; 0x07uy;
0x27uy; 0x2cuy; 0x32uy; 0xabuy; 0x0euy; 0xdeuy; 0xd1uy; 0x63uy;
0x1auy; 0x8buy; 0x60uy; 0x5auy; 0x43uy; 0xffuy; 0x5buy; 0xeduy;
0x80uy; 0x86uy; 0x07uy; 0x2buy; 0xa1uy; 0xe7uy; 0xccuy; 0x23uy;
0x58uy; 0xbauy; 0xecuy; 0xa1uy; 0x34uy; 0xc8uy; 0x25uy; 0xa7uy ]
let test1_expected512 = [
0xdduy; 0xafuy; 0x35uy; 0xa1uy; 0x93uy; 0x61uy; 0x7auy; 0xbauy;
0xccuy; 0x41uy; 0x73uy; 0x49uy; 0xaeuy; 0x20uy; 0x41uy; 0x31uy;
0x12uy; 0xe6uy; 0xfauy; 0x4euy; 0x89uy; 0xa9uy; 0x7euy; 0xa2uy;
0x0auy; 0x9euy; 0xeeuy; 0xe6uy; 0x4buy; 0x55uy; 0xd3uy; 0x9auy;
0x21uy; 0x92uy; 0x99uy; 0x2auy; 0x27uy; 0x4fuy; 0xc1uy; 0xa8uy;
0x36uy; 0xbauy; 0x3cuy; 0x23uy; 0xa3uy; 0xfeuy; 0xebuy; 0xbduy;
0x45uy; 0x4duy; 0x44uy; 0x23uy; 0x64uy; 0x3cuy; 0xe8uy; 0x0euy;
0x2auy; 0x9auy; 0xc9uy; 0x4fuy; 0xa5uy; 0x4cuy; 0xa4uy; 0x9fuy ]
/// Test 2
// This empty list must have its type annotated, otherwise
// length preconditions on test vectors cannot be normalized
let test2_plaintext: list UInt8.t = []
let test2_expected224 = [
0xd1uy; 0x4auy; 0x02uy; 0x8cuy; 0x2auy; 0x3auy; 0x2buy; 0xc9uy;
0x47uy; 0x61uy; 0x02uy; 0xbbuy; 0x28uy; 0x82uy; 0x34uy; 0xc4uy;
0x15uy; 0xa2uy; 0xb0uy; 0x1fuy; 0x82uy; 0x8euy; 0xa6uy; 0x2auy;
0xc5uy; 0xb3uy; 0xe4uy; 0x2fuy ]
let test2_expected256 = [
0xe3uy; 0xb0uy; 0xc4uy; 0x42uy; 0x98uy; 0xfcuy; 0x1cuy; 0x14uy;
0x9auy; 0xfbuy; 0xf4uy; 0xc8uy; 0x99uy; 0x6fuy; 0xb9uy; 0x24uy;
0x27uy; 0xaeuy; 0x41uy; 0xe4uy; 0x64uy; 0x9buy; 0x93uy; 0x4cuy;
0xa4uy; 0x95uy; 0x99uy; 0x1buy; 0x78uy; 0x52uy; 0xb8uy; 0x55uy ]
let test2_expected384 = [
0x38uy; 0xb0uy; 0x60uy; 0xa7uy; 0x51uy; 0xacuy; 0x96uy; 0x38uy;
0x4cuy; 0xd9uy; 0x32uy; 0x7euy; 0xb1uy; 0xb1uy; 0xe3uy; 0x6auy;
0x21uy; 0xfduy; 0xb7uy; 0x11uy; 0x14uy; 0xbeuy; 0x07uy; 0x43uy;
0x4cuy; 0x0cuy; 0xc7uy; 0xbfuy; 0x63uy; 0xf6uy; 0xe1uy; 0xdauy;
0x27uy; 0x4euy; 0xdeuy; 0xbfuy; 0xe7uy; 0x6fuy; 0x65uy; 0xfbuy;
0xd5uy; 0x1auy; 0xd2uy; 0xf1uy; 0x48uy; 0x98uy; 0xb9uy; 0x5buy ]
let test2_expected512 = [
0xcfuy; 0x83uy; 0xe1uy; 0x35uy; 0x7euy; 0xefuy; 0xb8uy; 0xbduy;
0xf1uy; 0x54uy; 0x28uy; 0x50uy; 0xd6uy; 0x6duy; 0x80uy; 0x07uy;
0xd6uy; 0x20uy; 0xe4uy; 0x05uy; 0x0buy; 0x57uy; 0x15uy; 0xdcuy;
0x83uy; 0xf4uy; 0xa9uy; 0x21uy; 0xd3uy; 0x6cuy; 0xe9uy; 0xceuy;
0x47uy; 0xd0uy; 0xd1uy; 0x3cuy; 0x5duy; 0x85uy; 0xf2uy; 0xb0uy;
0xffuy; 0x83uy; 0x18uy; 0xd2uy; 0x87uy; 0x7euy; 0xecuy; 0x2fuy;
0x63uy; 0xb9uy; 0x31uy; 0xbduy; 0x47uy; 0x41uy; 0x7auy; 0x81uy;
0xa5uy; 0x38uy; 0x32uy; 0x7auy; 0xf9uy; 0x27uy; 0xdauy; 0x3euy ]
/// Test 3
let test3_plaintext = [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy;
0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy ]
let test3_expected224 = [
0x75uy; 0x38uy; 0x8buy; 0x16uy; 0x51uy; 0x27uy; 0x76uy; 0xccuy;
0x5duy; 0xbauy; 0x5duy; 0xa1uy; 0xfduy; 0x89uy; 0x01uy; 0x50uy;
0xb0uy; 0xc6uy; 0x45uy; 0x5cuy; 0xb4uy; 0xf5uy; 0x8buy; 0x19uy;
0x52uy; 0x52uy; 0x25uy; 0x25uy ]
let test3_expected256 = [
0x24uy; 0x8duy; 0x6auy; 0x61uy; 0xd2uy; 0x06uy; 0x38uy; 0xb8uy;
0xe5uy; 0xc0uy; 0x26uy; 0x93uy; 0x0cuy; 0x3euy; 0x60uy; 0x39uy;
0xa3uy; 0x3cuy; 0xe4uy; 0x59uy; 0x64uy; 0xffuy; 0x21uy; 0x67uy;
0xf6uy; 0xecuy; 0xeduy; 0xd4uy; 0x19uy; 0xdbuy; 0x06uy; 0xc1uy ]
let test3_expected384 = [
0x33uy; 0x91uy; 0xfduy; 0xdduy; 0xfcuy; 0x8duy; 0xc7uy; 0x39uy;
0x37uy; 0x07uy; 0xa6uy; 0x5buy; 0x1buy; 0x47uy; 0x09uy; 0x39uy;
0x7cuy; 0xf8uy; 0xb1uy; 0xd1uy; 0x62uy; 0xafuy; 0x05uy; 0xabuy;
0xfeuy; 0x8fuy; 0x45uy; 0x0duy; 0xe5uy; 0xf3uy; 0x6buy; 0xc6uy;
0xb0uy; 0x45uy; 0x5auy; 0x85uy; 0x20uy; 0xbcuy; 0x4euy; 0x6fuy;
0x5fuy; 0xe9uy; 0x5buy; 0x1fuy; 0xe3uy; 0xc8uy; 0x45uy; 0x2buy ]
let test3_expected512 = [
0x20uy; 0x4auy; 0x8fuy; 0xc6uy; 0xdduy; 0xa8uy; 0x2fuy; 0x0auy;
0x0cuy; 0xeduy; 0x7buy; 0xebuy; 0x8euy; 0x08uy; 0xa4uy; 0x16uy;
0x57uy; 0xc1uy; 0x6euy; 0xf4uy; 0x68uy; 0xb2uy; 0x28uy; 0xa8uy;
0x27uy; 0x9buy; 0xe3uy; 0x31uy; 0xa7uy; 0x03uy; 0xc3uy; 0x35uy;
0x96uy; 0xfduy; 0x15uy; 0xc1uy; 0x3buy; 0x1buy; 0x07uy; 0xf9uy;
0xaauy; 0x1duy; 0x3buy; 0xeauy; 0x57uy; 0x78uy; 0x9cuy; 0xa0uy;
0x31uy; 0xaduy; 0x85uy; 0xc7uy; 0xa7uy; 0x1duy; 0xd7uy; 0x03uy;
0x54uy; 0xecuy; 0x63uy; 0x12uy; 0x38uy; 0xcauy; 0x34uy; 0x45uy ]
/// Test 4 | {
"checked_file": "/",
"dependencies": [
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"Lib.RawIntTypes.fsti.checked",
"Lib.PrintSequence.fsti.checked",
"FStar.UInt8.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.List.fst.checked",
"FStar.IO.fst.checked"
],
"interface_file": false,
"source_file": "Spec.Hash.Test.fst"
} | [
{
"abbrev": true,
"full_module": "Lib.PrintSequence",
"short_module": "PS"
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 50,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.list FStar.UInt8.t | Prims.Tot | [
"total"
] | [] | [
"Prims.Cons",
"FStar.UInt8.t",
"FStar.UInt8.__uint_to_t",
"Prims.Nil"
] | [] | false | false | false | true | false | let test4_plaintext =
| [
0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy;
0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy;
0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x65uy; 0x66uy; 0x67uy; 0x68uy;
0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy;
0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x68uy; 0x69uy; 0x6auy; 0x6buy;
0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy;
0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy;
0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy;
0x6duy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x6euy; 0x6fuy; 0x70uy; 0x71uy;
0x72uy; 0x73uy; 0x74uy; 0x75uy
] | false |
|
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.free | val free: #a:Type -> ll: t a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
B.(modifies (footprint h0 ll) h0 h1)) | val free: #a:Type -> ll: t a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
B.(modifies (footprint h0 ll) h0 h1)) | let free #_ ll =
let v = !* ll.v in
LL1.free #_ #v ll.ptr;
B.free ll.ptr;
B.free ll.v | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 13,
"end_line": 282,
"start_col": 0,
"start_line": 278
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients.
val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)
let v #_ h ll =
B.deref h ll.v
/// Normally clients want to reason via the footprint. However, in some case
/// (e.g. taking pointers directly to list cells), it's helpful to have a more
/// precise way to reason about the footprint. This is done via the cells, a
/// list of pointers to the individual cells, which characterizes fully the
/// footprint and the v function. See LL1.
val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True)
let cells #a h ll =
LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v)
// A workaround to avoid putting loc_all_regions_from true in patterns.
let region_of ll = B.loc_all_regions_from false ll.r
/// This is a most useful lemma for clients: all the bookkeeping of this linked
/// list, including spine, is subsumed in region r, at any time.
///
/// This allows clients to allocate a new region for ``r``, maintain the
/// invariant that ``r`` is disjoint from their own data structures, and get
/// easy separation and framing for their own data this way.
///
/// Note that we don't generally have to state such lemmas, since in many cases,
/// footprints are static and do not grow dynamically.
///
/// Unfortunately, this lemma requires stating some intermediary asserts for
/// some triggers to fire, and I could not find a good SMTPat for it, so clients
/// have to call it manually. See test/Wireguard.fst.
let footprint_in_r #a (h: HS.mem) (ll: t a): Lemma
(requires invariant h ll)
(ensures B.(loc_includes (region_of ll) (footprint h ll)))
//[ SMTPat (footprint h ll) ]
=
assert B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h (B.deref h ll.ptr) (v h ll)));
assert B.(loc_includes (loc_all_regions_from true ll.r) (loc_region_only true ll.spine_rid))
/// I'm stating this one for completeness, but clients are able to derive this
/// lemma automatically because the representation is transparent.
val frame_footprint (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.loc_disjoint l (footprint h0 ll) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_footprint #_ _ _ _ _ =
()
/// This one is the framing lemma clients want to use if they adopt region-based
/// reasoning for their LL2 instance. Owing to the lack of pattern on footprint_in_r,
/// clients also have to call this one manually, sadly.
val frame_region (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.(loc_disjoint l (region_of ll)) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_region #_ ll _ h0 h1 =
footprint_in_r h0 ll;
()
/// Stateful operations
/// -------------------
///
/// These are high-level and use the ``v`` function. I expect clients to drop
/// into the LL1 representation only when they need to iterate, e.g. to find a
/// list element, or to remove a list element.
///
/// Note that these functions have a "dual" specification, both in terms of the
/// ``footprint`` predicate (coarse) and in terms of the ``cells`` predicate
/// (precise). Most clients will be content with the former and region-based
/// reasoning, but advanced clients that e.g. take pointers directly to list
/// cells will most likely need to use the latter.
/// Heap allocation of a fresh linked list.
val create_in: #a:Type -> r:HS.rid -> ST (t a)
(requires fun h0 ->
ST.is_eternal_region r)
(ensures fun h0 ll h1 ->
invariant h1 ll /\
B.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint h1 ll) h0 h1 /\
v h1 ll == [] /\
cells h1 ll == [] /\
ll.r == r)
#push-options "--fuel 1"
let create_in #a r =
let ptr_v_rid = ST.new_region r in
let spine_rid = ST.new_region r in
let ptr = B.malloc ptr_v_rid (B.null <: LL1.t a) 1ul in
let v = B.malloc ptr_v_rid (G.hide ([] <: list a)) 1ul in
{ ptr; v; r; ptr_v_rid; spine_rid }
#pop-options
val push: #a:Type -> ll: t a -> x: a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
// Coarse modifies clause
B.(modifies (footprint h0 ll) h0 h1) /\
// Functional spec
v h1 ll == x :: v h0 ll /\
// Precise effect on memory, ignore if you're content with reasoning via the
// footprint (which is known to be always included in the region).
Cons? (cells h1 ll) /\ List.Tot.tl (cells h1 ll) == cells h0 ll /\
B.fresh_loc (B.loc_addr_of_buffer (List.Tot.hd (cells h1 ll))) h0 h1)
#push-options "--fuel 1 --ifuel 1"
let push #a ll x =
LL1.push ll.spine_rid (!* ll.v) ll.ptr x;
let v = !* ll.v in
ll.v *= G.hide (x :: v)
#pop-options
#push-options "--fuel 1"
val pop: #a:Type -> ll: t a -> ST a
(requires fun h0 ->
invariant h0 ll /\
Cons? (v h0 ll))
(ensures fun h0 x h1 ->
let hd :: tl = v h0 ll in
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v) h0 h1) /\
v h1 ll == tl /\
cells h1 ll == List.Tot.tl (cells h0 ll) /\
x == hd)
let pop #a ll =
let r = LL1.pop ll.spine_rid (!* ll.v) ll.ptr in
let v = !* ll.v in
ll.v *= G.hide (List.Tot.tl v);
r
val maybe_pop: #a:Type -> ll: t a -> ST (option a)
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 x h1 ->
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\ (
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v) h0 h1) /\
match x with
| Some x ->
Cons? (v h0 ll) /\ (
let hd :: tl = v h0 ll in
v h1 ll == tl /\
cells h1 ll == List.Tot.tl (cells h0 ll) /\
x == hd)
| None ->
Nil? (v h0 ll)))
#pop-options
#push-options "--fuel 1 --ifuel 1 --z3rlimit 50"
let maybe_pop #a ll =
if not (B.is_null (!* ll.ptr)) then
let v = !* ll.v in
let r = LL1.pop ll.spine_rid (!* ll.v) ll.ptr in
ll.v *= G.hide (List.Tot.tl v);
Some r
else
None
#pop-options
val clear: #a:Type -> ll: t a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v `loc_union` loc_region_only true ll.spine_rid) h0 h1) /\
v h1 ll == [] /\
cells h1 ll == [])
#push-options "--fuel 1"
let clear #a ll =
let v = !* ll.v in
LL1.free #_ #v ll.ptr;
ll.v *= G.hide []
#pop-options
val free: #a:Type -> ll: t a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
B.(modifies (footprint h0 ll) h0 h1)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 0,
"initial_ifuel": 0,
"max_fuel": 0,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ll: LowStar.Lib.LinkedList2.t a -> FStar.HyperStack.ST.ST Prims.unit | FStar.HyperStack.ST.ST | [] | [] | [
"LowStar.Lib.LinkedList2.t",
"LowStar.Monotonic.Buffer.free",
"FStar.Ghost.erased",
"Prims.list",
"LowStar.Buffer.trivial_preorder",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__v",
"Prims.unit",
"LowStar.Lib.LinkedList.t",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__ptr",
"LowStar.Lib.LinkedList.free",
"LowStar.BufferOps.op_Bang_Star"
] | [] | false | true | false | false | false | let free #_ ll =
| let v = !*ll.v in
LL1.free #_ #v ll.ptr;
B.free ll.ptr;
B.free ll.v | false |
OPLSS2021.MemCpy.Deps.fst | OPLSS2021.MemCpy.Deps.buffer | val buffer : a: Type0 -> Type0 | let buffer = B.buffer | {
"file_name": "examples/oplss2021/OPLSS2021.MemCpy.Deps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 21,
"end_line": 26,
"start_col": 0,
"start_line": 26
} | (*
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 OPLSS2021.MemCpy.Deps
open LowStar.Buffer
open FStar.UInt32
module B = LowStar.Buffer
module U32 = FStar.UInt32
module U8 = FStar.UInt8
module HS = FStar.HyperStack
open FStar.HyperStack.ST
effect St (a:Type) = FStar.HyperStack.ST.St a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "OPLSS2021.MemCpy.Deps.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.UInt32",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | a: Type0 -> Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.buffer"
] | [] | false | false | false | true | true | let buffer =
| B.buffer | false |
|
OPLSS2021.MemCpy.Deps.fst | OPLSS2021.MemCpy.Deps.uint32 | val uint32 : Prims.eqtype | let uint32 = U32.t | {
"file_name": "examples/oplss2021/OPLSS2021.MemCpy.Deps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 18,
"end_line": 28,
"start_col": 0,
"start_line": 28
} | (*
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 OPLSS2021.MemCpy.Deps
open LowStar.Buffer
open FStar.UInt32
module B = LowStar.Buffer
module U32 = FStar.UInt32
module U8 = FStar.UInt8
module HS = FStar.HyperStack
open FStar.HyperStack.ST
effect St (a:Type) = FStar.HyperStack.ST.St a
let buffer = B.buffer | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "OPLSS2021.MemCpy.Deps.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.UInt32",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.eqtype | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.t"
] | [] | false | false | false | true | false | let uint32 =
| U32.t | false |
|
OPLSS2021.MemCpy.Deps.fst | OPLSS2021.MemCpy.Deps.uint8 | val uint8 : Prims.eqtype | let uint8 = U8.t | {
"file_name": "examples/oplss2021/OPLSS2021.MemCpy.Deps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 16,
"end_line": 29,
"start_col": 0,
"start_line": 29
} | (*
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 OPLSS2021.MemCpy.Deps
open LowStar.Buffer
open FStar.UInt32
module B = LowStar.Buffer
module U32 = FStar.UInt32
module U8 = FStar.UInt8
module HS = FStar.HyperStack
open FStar.HyperStack.ST
effect St (a:Type) = FStar.HyperStack.ST.St a
let buffer = B.buffer | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "OPLSS2021.MemCpy.Deps.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.UInt32",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | Prims.eqtype | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt8.t"
] | [] | false | false | false | true | false | let uint8 =
| U8.t | false |
|
OPLSS2021.MemCpy.Deps.fst | OPLSS2021.MemCpy.Deps.modifies | val modifies : b: LowStar.Buffer.buffer 'a ->
h0: FStar.Monotonic.HyperStack.mem ->
h1: FStar.Monotonic.HyperStack.mem
-> Type0 | let modifies (b:B.buffer 'a) h0 h1 = modifies (loc_buffer b) h0 h1 | {
"file_name": "examples/oplss2021/OPLSS2021.MemCpy.Deps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 66,
"end_line": 36,
"start_col": 0,
"start_line": 36
} | (*
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 OPLSS2021.MemCpy.Deps
open LowStar.Buffer
open FStar.UInt32
module B = LowStar.Buffer
module U32 = FStar.UInt32
module U8 = FStar.UInt8
module HS = FStar.HyperStack
open FStar.HyperStack.ST
effect St (a:Type) = FStar.HyperStack.ST.St a
let buffer = B.buffer
let uint32 = U32.t
let uint8 = U8.t
unfold
let length (#a:Type) (b:buffer a) : GTot U32.t =
U32.uint_to_t (B.length b) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "OPLSS2021.MemCpy.Deps.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.UInt32",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
b: LowStar.Buffer.buffer 'a ->
h0: FStar.Monotonic.HyperStack.mem ->
h1: FStar.Monotonic.HyperStack.mem
-> Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.buffer",
"FStar.Monotonic.HyperStack.mem",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_buffer",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let modifies (b: B.buffer 'a) h0 h1 =
| modifies (loc_buffer b) h0 h1 | false |
|
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.pop | val pop: #a:Type -> ll: t a -> ST a
(requires fun h0 ->
invariant h0 ll /\
Cons? (v h0 ll))
(ensures fun h0 x h1 ->
let hd :: tl = v h0 ll in
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v) h0 h1) /\
v h1 ll == tl /\
cells h1 ll == List.Tot.tl (cells h0 ll) /\
x == hd) | val pop: #a:Type -> ll: t a -> ST a
(requires fun h0 ->
invariant h0 ll /\
Cons? (v h0 ll))
(ensures fun h0 x h1 ->
let hd :: tl = v h0 ll in
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v) h0 h1) /\
v h1 ll == tl /\
cells h1 ll == List.Tot.tl (cells h0 ll) /\
x == hd) | let pop #a ll =
let r = LL1.pop ll.spine_rid (!* ll.v) ll.ptr in
let v = !* ll.v in
ll.v *= G.hide (List.Tot.tl v);
r | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 3,
"end_line": 224,
"start_col": 0,
"start_line": 220
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients.
val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)
let v #_ h ll =
B.deref h ll.v
/// Normally clients want to reason via the footprint. However, in some case
/// (e.g. taking pointers directly to list cells), it's helpful to have a more
/// precise way to reason about the footprint. This is done via the cells, a
/// list of pointers to the individual cells, which characterizes fully the
/// footprint and the v function. See LL1.
val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True)
let cells #a h ll =
LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v)
// A workaround to avoid putting loc_all_regions_from true in patterns.
let region_of ll = B.loc_all_regions_from false ll.r
/// This is a most useful lemma for clients: all the bookkeeping of this linked
/// list, including spine, is subsumed in region r, at any time.
///
/// This allows clients to allocate a new region for ``r``, maintain the
/// invariant that ``r`` is disjoint from their own data structures, and get
/// easy separation and framing for their own data this way.
///
/// Note that we don't generally have to state such lemmas, since in many cases,
/// footprints are static and do not grow dynamically.
///
/// Unfortunately, this lemma requires stating some intermediary asserts for
/// some triggers to fire, and I could not find a good SMTPat for it, so clients
/// have to call it manually. See test/Wireguard.fst.
let footprint_in_r #a (h: HS.mem) (ll: t a): Lemma
(requires invariant h ll)
(ensures B.(loc_includes (region_of ll) (footprint h ll)))
//[ SMTPat (footprint h ll) ]
=
assert B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h (B.deref h ll.ptr) (v h ll)));
assert B.(loc_includes (loc_all_regions_from true ll.r) (loc_region_only true ll.spine_rid))
/// I'm stating this one for completeness, but clients are able to derive this
/// lemma automatically because the representation is transparent.
val frame_footprint (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.loc_disjoint l (footprint h0 ll) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_footprint #_ _ _ _ _ =
()
/// This one is the framing lemma clients want to use if they adopt region-based
/// reasoning for their LL2 instance. Owing to the lack of pattern on footprint_in_r,
/// clients also have to call this one manually, sadly.
val frame_region (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.(loc_disjoint l (region_of ll)) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_region #_ ll _ h0 h1 =
footprint_in_r h0 ll;
()
/// Stateful operations
/// -------------------
///
/// These are high-level and use the ``v`` function. I expect clients to drop
/// into the LL1 representation only when they need to iterate, e.g. to find a
/// list element, or to remove a list element.
///
/// Note that these functions have a "dual" specification, both in terms of the
/// ``footprint`` predicate (coarse) and in terms of the ``cells`` predicate
/// (precise). Most clients will be content with the former and region-based
/// reasoning, but advanced clients that e.g. take pointers directly to list
/// cells will most likely need to use the latter.
/// Heap allocation of a fresh linked list.
val create_in: #a:Type -> r:HS.rid -> ST (t a)
(requires fun h0 ->
ST.is_eternal_region r)
(ensures fun h0 ll h1 ->
invariant h1 ll /\
B.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint h1 ll) h0 h1 /\
v h1 ll == [] /\
cells h1 ll == [] /\
ll.r == r)
#push-options "--fuel 1"
let create_in #a r =
let ptr_v_rid = ST.new_region r in
let spine_rid = ST.new_region r in
let ptr = B.malloc ptr_v_rid (B.null <: LL1.t a) 1ul in
let v = B.malloc ptr_v_rid (G.hide ([] <: list a)) 1ul in
{ ptr; v; r; ptr_v_rid; spine_rid }
#pop-options
val push: #a:Type -> ll: t a -> x: a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
// Coarse modifies clause
B.(modifies (footprint h0 ll) h0 h1) /\
// Functional spec
v h1 ll == x :: v h0 ll /\
// Precise effect on memory, ignore if you're content with reasoning via the
// footprint (which is known to be always included in the region).
Cons? (cells h1 ll) /\ List.Tot.tl (cells h1 ll) == cells h0 ll /\
B.fresh_loc (B.loc_addr_of_buffer (List.Tot.hd (cells h1 ll))) h0 h1)
#push-options "--fuel 1 --ifuel 1"
let push #a ll x =
LL1.push ll.spine_rid (!* ll.v) ll.ptr x;
let v = !* ll.v in
ll.v *= G.hide (x :: v)
#pop-options
#push-options "--fuel 1"
val pop: #a:Type -> ll: t a -> ST a
(requires fun h0 ->
invariant h0 ll /\
Cons? (v h0 ll))
(ensures fun h0 x h1 ->
let hd :: tl = v h0 ll in
invariant h1 ll /\
B.(modifies (footprint h0 ll) h0 h1) /\
// B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v) h0 h1) /\
v h1 ll == tl /\
cells h1 ll == List.Tot.tl (cells h0 ll) /\
x == hd) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 0,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ll: LowStar.Lib.LinkedList2.t a -> FStar.HyperStack.ST.ST a | FStar.HyperStack.ST.ST | [] | [] | [
"LowStar.Lib.LinkedList2.t",
"Prims.unit",
"LowStar.BufferOps.op_Star_Equals",
"FStar.Ghost.erased",
"Prims.list",
"LowStar.Buffer.trivial_preorder",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__v",
"FStar.Ghost.hide",
"FStar.List.Tot.Base.tl",
"FStar.Ghost.reveal",
"LowStar.BufferOps.op_Bang_Star",
"LowStar.Lib.LinkedList.pop",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__spine_rid",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__ptr"
] | [] | false | true | false | false | false | let pop #a ll =
| let r = LL1.pop ll.spine_rid (!*ll.v) ll.ptr in
let v = !*ll.v in
ll.v *= G.hide (List.Tot.tl v);
r | false |
LowStar.Lib.LinkedList2.fst | LowStar.Lib.LinkedList2.push | val push: #a:Type -> ll: t a -> x: a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
// Coarse modifies clause
B.(modifies (footprint h0 ll) h0 h1) /\
// Functional spec
v h1 ll == x :: v h0 ll /\
// Precise effect on memory, ignore if you're content with reasoning via the
// footprint (which is known to be always included in the region).
Cons? (cells h1 ll) /\ List.Tot.tl (cells h1 ll) == cells h0 ll /\
B.fresh_loc (B.loc_addr_of_buffer (List.Tot.hd (cells h1 ll))) h0 h1) | val push: #a:Type -> ll: t a -> x: a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
// Coarse modifies clause
B.(modifies (footprint h0 ll) h0 h1) /\
// Functional spec
v h1 ll == x :: v h0 ll /\
// Precise effect on memory, ignore if you're content with reasoning via the
// footprint (which is known to be always included in the region).
Cons? (cells h1 ll) /\ List.Tot.tl (cells h1 ll) == cells h0 ll /\
B.fresh_loc (B.loc_addr_of_buffer (List.Tot.hd (cells h1 ll))) h0 h1) | let push #a ll x =
LL1.push ll.spine_rid (!* ll.v) ll.ptr x;
let v = !* ll.v in
ll.v *= G.hide (x :: v) | {
"file_name": "krmllib/LowStar.Lib.LinkedList2.fst",
"git_rev": "da1e941b2fcb196aa5d1e34941aa00b4c67ac321",
"git_url": "https://github.com/FStarLang/karamel.git",
"project_name": "karamel"
} | {
"end_col": 25,
"end_line": 203,
"start_col": 0,
"start_line": 200
} | module LowStar.Lib.LinkedList2
/// This module provides a convenient abstraction over LL11 which uses a ``v``
/// function, therefore eliminating a large amount of syntactic overhead. It
/// also takes care of packing the existential, dealing with the extra outer
/// reference, and providing inclusion of the footprint in a static region at
/// all times.
///
/// Clients who want to modify the spine of the list or iterate over it can
/// always use the LL11 definitions. AssocList is such an example.
open LowStar.BufferOps
module B = LowStar.Buffer
module HS = FStar.HyperStack
module G = FStar.Ghost
module L = FStar.List.Tot
module U32 = FStar.UInt32
module ST = FStar.HyperStack.ST
module LL1 = LowStar.Lib.LinkedList
open FStar.HyperStack.ST
#set-options "--fuel 0 --ifuel 0"
// Thanks to the KaRaMeL optimization, this type will extract just like
// ``B.pointer (LL1.t a)`` would, with no indirection due to the record.
noeq
type t a = {
ptr: B.pointer (LL1.t a);
// Relies on a new pointer-to-unit elimination phase in KaRaMeL
v: B.pointer (G.erased (list a));
// For separation; all erased.
r: HS.rid;
spine_rid: HS.rid;
ptr_v_rid: HS.rid;
}
val invariant: #a:Type -> h:HS.mem -> ll:t a -> Type0
let invariant #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
// This is where we switch from a predicate (cumbersome for clients, requires
// materializing the list at any time) to a ``v`` function which makes
// specifications much easier. Any time the invariant holds, the pointer ``v``
// holds a computationally-irrelevant representation of the list that in turns
// allows us to under-the-hood state the various predicates from LL1 that
// require exhibiting a list.
B.live h ll.ptr /\
B.freeable ll.ptr /\
B.live h ll.v /\
B.freeable ll.v /\
LL1.well_formed h head v /\
LL1.invariant h head v /\
// We use regions for separation only, not for any footprint reasoning:
// - ptr_v_rid is a sub-region of r and contains ptr and v, disjoint from each other
// - spine_rid is a sub-region of r, disjoint from ptr_v_rid, and contains the LL1.footprint
ST.is_eternal_region ll.r /\
ST.is_eternal_region ll.spine_rid /\
ST.is_eternal_region ll.ptr_v_rid /\
B.(loc_includes (loc_region_only true ll.ptr_v_rid) (loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v)) /\
B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h head v)) /\
B.(loc_disjoint (loc_addr_of_buffer ll.ptr) (loc_addr_of_buffer ll.v)) /\
B.(loc_disjoint (loc_region_only true ll.ptr_v_rid) (loc_region_only true ll.spine_rid)) /\
// These are not redundant, and are important for showing that the footprint
// is contained in ``r`` at any time, so long as the invariant holds.
HS.extends ll.ptr_v_rid ll.r /\
HS.extends ll.spine_rid ll.r /\
HS.parent ll.ptr_v_rid == ll.r /\
HS.parent ll.spine_rid == ll.r
val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc
(requires invariant h ll)
(ensures fun _ -> True)
let footprint #a h ll =
let head = B.deref h ll.ptr in
let v = B.deref h ll.v in
B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)
/// There! Much easier reasoning for clients.
val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)
let v #_ h ll =
B.deref h ll.v
/// Normally clients want to reason via the footprint. However, in some case
/// (e.g. taking pointers directly to list cells), it's helpful to have a more
/// precise way to reason about the footprint. This is done via the cells, a
/// list of pointers to the individual cells, which characterizes fully the
/// footprint and the v function. See LL1.
val cells: #a:Type -> h:HS.mem -> ll: t a -> Ghost (list (B.pointer (LL1.cell a)))
(requires invariant h ll)
(ensures fun _ -> True)
let cells #a h ll =
LL1.cells h (B.deref h ll.ptr) (B.deref h ll.v)
// A workaround to avoid putting loc_all_regions_from true in patterns.
let region_of ll = B.loc_all_regions_from false ll.r
/// This is a most useful lemma for clients: all the bookkeeping of this linked
/// list, including spine, is subsumed in region r, at any time.
///
/// This allows clients to allocate a new region for ``r``, maintain the
/// invariant that ``r`` is disjoint from their own data structures, and get
/// easy separation and framing for their own data this way.
///
/// Note that we don't generally have to state such lemmas, since in many cases,
/// footprints are static and do not grow dynamically.
///
/// Unfortunately, this lemma requires stating some intermediary asserts for
/// some triggers to fire, and I could not find a good SMTPat for it, so clients
/// have to call it manually. See test/Wireguard.fst.
let footprint_in_r #a (h: HS.mem) (ll: t a): Lemma
(requires invariant h ll)
(ensures B.(loc_includes (region_of ll) (footprint h ll)))
//[ SMTPat (footprint h ll) ]
=
assert B.(loc_includes (loc_region_only true ll.spine_rid) (LL1.footprint h (B.deref h ll.ptr) (v h ll)));
assert B.(loc_includes (loc_all_regions_from true ll.r) (loc_region_only true ll.spine_rid))
/// I'm stating this one for completeness, but clients are able to derive this
/// lemma automatically because the representation is transparent.
val frame_footprint (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.loc_disjoint l (footprint h0 ll) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_footprint #_ _ _ _ _ =
()
/// This one is the framing lemma clients want to use if they adopt region-based
/// reasoning for their LL2 instance. Owing to the lack of pattern on footprint_in_r,
/// clients also have to call this one manually, sadly.
val frame_region (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma
(requires
invariant h0 ll /\
B.(loc_disjoint l (region_of ll)) /\
B.modifies l h0 h1)
(ensures
invariant h1 ll /\
footprint h1 ll == footprint h0 ll)
let frame_region #_ ll _ h0 h1 =
footprint_in_r h0 ll;
()
/// Stateful operations
/// -------------------
///
/// These are high-level and use the ``v`` function. I expect clients to drop
/// into the LL1 representation only when they need to iterate, e.g. to find a
/// list element, or to remove a list element.
///
/// Note that these functions have a "dual" specification, both in terms of the
/// ``footprint`` predicate (coarse) and in terms of the ``cells`` predicate
/// (precise). Most clients will be content with the former and region-based
/// reasoning, but advanced clients that e.g. take pointers directly to list
/// cells will most likely need to use the latter.
/// Heap allocation of a fresh linked list.
val create_in: #a:Type -> r:HS.rid -> ST (t a)
(requires fun h0 ->
ST.is_eternal_region r)
(ensures fun h0 ll h1 ->
invariant h1 ll /\
B.(modifies loc_none h0 h1) /\
B.fresh_loc (footprint h1 ll) h0 h1 /\
v h1 ll == [] /\
cells h1 ll == [] /\
ll.r == r)
#push-options "--fuel 1"
let create_in #a r =
let ptr_v_rid = ST.new_region r in
let spine_rid = ST.new_region r in
let ptr = B.malloc ptr_v_rid (B.null <: LL1.t a) 1ul in
let v = B.malloc ptr_v_rid (G.hide ([] <: list a)) 1ul in
{ ptr; v; r; ptr_v_rid; spine_rid }
#pop-options
val push: #a:Type -> ll: t a -> x: a -> ST unit
(requires fun h0 ->
invariant h0 ll)
(ensures fun h0 _ h1 ->
invariant h1 ll /\
// Coarse modifies clause
B.(modifies (footprint h0 ll) h0 h1) /\
// Functional spec
v h1 ll == x :: v h0 ll /\
// Precise effect on memory, ignore if you're content with reasoning via the
// footprint (which is known to be always included in the region).
Cons? (cells h1 ll) /\ List.Tot.tl (cells h1 ll) == cells h0 ll /\
B.fresh_loc (B.loc_addr_of_buffer (List.Tot.hd (cells h1 ll))) h0 h1) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Lib.LinkedList.fst.checked",
"LowStar.BufferOps.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LowStar.Lib.LinkedList2.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "LowStar.Lib.LinkedList",
"short_module": "LL1"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "FStar.List.Tot",
"short_module": "L"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "LowStar.BufferOps",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Lib",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 1,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ll: LowStar.Lib.LinkedList2.t a -> x: a -> FStar.HyperStack.ST.ST Prims.unit | FStar.HyperStack.ST.ST | [] | [] | [
"LowStar.Lib.LinkedList2.t",
"LowStar.BufferOps.op_Star_Equals",
"FStar.Ghost.erased",
"Prims.list",
"LowStar.Buffer.trivial_preorder",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__v",
"FStar.Ghost.hide",
"Prims.Cons",
"FStar.Ghost.reveal",
"Prims.unit",
"LowStar.BufferOps.op_Bang_Star",
"LowStar.Lib.LinkedList.push",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__spine_rid",
"LowStar.Lib.LinkedList2.__proj__Mkt__item__ptr"
] | [] | false | true | false | false | false | let push #a ll x =
| LL1.push ll.spine_rid (!*ll.v) ll.ptr x;
let v = !*ll.v in
ll.v *= G.hide (x :: v) | false |
OPLSS2021.MemCpy.Deps.fst | OPLSS2021.MemCpy.Deps.live | val live : h: FStar.Monotonic.HyperStack.mem -> b: OPLSS2021.MemCpy.Deps.buffer 'a -> Type0 | let live h (b:buffer 'a) = B.live h b | {
"file_name": "examples/oplss2021/OPLSS2021.MemCpy.Deps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 37,
"end_line": 39,
"start_col": 0,
"start_line": 39
} | (*
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 OPLSS2021.MemCpy.Deps
open LowStar.Buffer
open FStar.UInt32
module B = LowStar.Buffer
module U32 = FStar.UInt32
module U8 = FStar.UInt8
module HS = FStar.HyperStack
open FStar.HyperStack.ST
effect St (a:Type) = FStar.HyperStack.ST.St a
let buffer = B.buffer
let uint32 = U32.t
let uint8 = U8.t
unfold
let length (#a:Type) (b:buffer a) : GTot U32.t =
U32.uint_to_t (B.length b)
unfold
let modifies (b:B.buffer 'a) h0 h1 = modifies (loc_buffer b) h0 h1 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "OPLSS2021.MemCpy.Deps.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.UInt32",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | h: FStar.Monotonic.HyperStack.mem -> b: OPLSS2021.MemCpy.Deps.buffer 'a -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.Monotonic.HyperStack.mem",
"OPLSS2021.MemCpy.Deps.buffer",
"LowStar.Monotonic.Buffer.live",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let live h (b: buffer 'a) =
| B.live h b | false |
|
OPLSS2021.MemCpy.Deps.fst | OPLSS2021.MemCpy.Deps.disjoint | val disjoint : b0: LowStar.Buffer.buffer 'a -> b1: LowStar.Buffer.buffer 'a -> Type0 | let disjoint (b0 b1:B.buffer 'a) = B.disjoint b0 b1 | {
"file_name": "examples/oplss2021/OPLSS2021.MemCpy.Deps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 51,
"end_line": 72,
"start_col": 0,
"start_line": 72
} | (*
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 OPLSS2021.MemCpy.Deps
open LowStar.Buffer
open FStar.UInt32
module B = LowStar.Buffer
module U32 = FStar.UInt32
module U8 = FStar.UInt8
module HS = FStar.HyperStack
open FStar.HyperStack.ST
effect St (a:Type) = FStar.HyperStack.ST.St a
let buffer = B.buffer
let uint32 = U32.t
let uint8 = U8.t
unfold
let length (#a:Type) (b:buffer a) : GTot U32.t =
U32.uint_to_t (B.length b)
unfold
let modifies (b:B.buffer 'a) h0 h1 = modifies (loc_buffer b) h0 h1
unfold
let live h (b:buffer 'a) = B.live h b
unfold
let ( .() ) (b:buffer 'a) (i:U32.t)
: ST 'a (requires fun h -> live h b /\ i <^ length b)
(ensures (fun h y h' -> h == h' /\ y == Seq.index (as_seq h b) (U32.v i)))
= B.index b i
unfold
let ( .()<- ) (b:buffer 'a) (i:U32.t) (v:'a)
: ST unit
(requires (fun h ->
live h b /\
i <^ length b))
(ensures (fun h _ h' ->
modifies b h h' /\
live h' b /\
as_seq h' b == Seq.upd (as_seq h b) (U32.v i) v))
= B.upd b i v
unfold
let suffix (#a:Type)
(b:buffer a)
(from:U32.t)
(len:U32.t{len <=^ length b /\ from <=^ len})
: ST (buffer a)
(requires (fun h ->
U32.v from + U32.v len <= U32.v (length b) /\
live h b))
(ensures (fun h y h' -> h == h' /\ y == mgsub _ b from (len -^ from)))
= B.sub b from (len -^ from) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "OPLSS2021.MemCpy.Deps.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.UInt32",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b0: LowStar.Buffer.buffer 'a -> b1: LowStar.Buffer.buffer 'a -> Type0 | Prims.Tot | [
"total"
] | [] | [
"LowStar.Buffer.buffer",
"LowStar.Monotonic.Buffer.disjoint",
"LowStar.Buffer.trivial_preorder"
] | [] | false | false | false | true | true | let disjoint (b0 b1: B.buffer 'a) =
| B.disjoint b0 b1 | false |
|
OPLSS2021.MemCpy.Deps.fst | OPLSS2021.MemCpy.Deps.lbuffer | val lbuffer : len: FStar.UInt32.t -> a: Type0 -> Type0 | let lbuffer (len:U32.t) (a:Type) = b:B.buffer a{len <=^ length b} | {
"file_name": "examples/oplss2021/OPLSS2021.MemCpy.Deps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 65,
"end_line": 74,
"start_col": 0,
"start_line": 74
} | (*
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 OPLSS2021.MemCpy.Deps
open LowStar.Buffer
open FStar.UInt32
module B = LowStar.Buffer
module U32 = FStar.UInt32
module U8 = FStar.UInt8
module HS = FStar.HyperStack
open FStar.HyperStack.ST
effect St (a:Type) = FStar.HyperStack.ST.St a
let buffer = B.buffer
let uint32 = U32.t
let uint8 = U8.t
unfold
let length (#a:Type) (b:buffer a) : GTot U32.t =
U32.uint_to_t (B.length b)
unfold
let modifies (b:B.buffer 'a) h0 h1 = modifies (loc_buffer b) h0 h1
unfold
let live h (b:buffer 'a) = B.live h b
unfold
let ( .() ) (b:buffer 'a) (i:U32.t)
: ST 'a (requires fun h -> live h b /\ i <^ length b)
(ensures (fun h y h' -> h == h' /\ y == Seq.index (as_seq h b) (U32.v i)))
= B.index b i
unfold
let ( .()<- ) (b:buffer 'a) (i:U32.t) (v:'a)
: ST unit
(requires (fun h ->
live h b /\
i <^ length b))
(ensures (fun h _ h' ->
modifies b h h' /\
live h' b /\
as_seq h' b == Seq.upd (as_seq h b) (U32.v i) v))
= B.upd b i v
unfold
let suffix (#a:Type)
(b:buffer a)
(from:U32.t)
(len:U32.t{len <=^ length b /\ from <=^ len})
: ST (buffer a)
(requires (fun h ->
U32.v from + U32.v len <= U32.v (length b) /\
live h b))
(ensures (fun h y h' -> h == h' /\ y == mgsub _ b from (len -^ from)))
= B.sub b from (len -^ from)
unfold
let disjoint (b0 b1:B.buffer 'a) = B.disjoint b0 b1 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "OPLSS2021.MemCpy.Deps.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.UInt32",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | len: FStar.UInt32.t -> a: Type0 -> Type0 | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt32.t",
"LowStar.Buffer.buffer",
"Prims.b2t",
"FStar.UInt32.op_Less_Equals_Hat",
"OPLSS2021.MemCpy.Deps.length"
] | [] | false | false | false | true | true | let lbuffer (len: U32.t) (a: Type) =
| b: B.buffer a {len <=^ length b} | false |
|
OPLSS2021.MemCpy.Deps.fst | OPLSS2021.MemCpy.Deps.modifies_only_not_unused_in | val modifies_only_not_unused_in (l: loc) (h h': HS.mem)
: Lemma (requires (let open B in modifies (loc_union (loc_unused_in h) l) h h'))
(ensures (let open B in modifies l h h'))
[SMTPat B.((modifies l h h'))] | val modifies_only_not_unused_in (l: loc) (h h': HS.mem)
: Lemma (requires (let open B in modifies (loc_union (loc_unused_in h) l) h h'))
(ensures (let open B in modifies l h h'))
[SMTPat B.((modifies l h h'))] | let modifies_only_not_unused_in
(l: loc)
(h h' : HS.mem)
: Lemma
(requires (B.(modifies (loc_union (loc_unused_in h) l) h h')))
(ensures (B.(modifies l h h')))
[SMTPat B.((modifies l h h'))]
= B.modifies_only_not_unused_in l h h' | {
"file_name": "examples/oplss2021/OPLSS2021.MemCpy.Deps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 38,
"end_line": 132,
"start_col": 0,
"start_line": 125
} | (*
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 OPLSS2021.MemCpy.Deps
open LowStar.Buffer
open FStar.UInt32
module B = LowStar.Buffer
module U32 = FStar.UInt32
module U8 = FStar.UInt8
module HS = FStar.HyperStack
open FStar.HyperStack.ST
effect St (a:Type) = FStar.HyperStack.ST.St a
let buffer = B.buffer
let uint32 = U32.t
let uint8 = U8.t
unfold
let length (#a:Type) (b:buffer a) : GTot U32.t =
U32.uint_to_t (B.length b)
unfold
let modifies (b:B.buffer 'a) h0 h1 = modifies (loc_buffer b) h0 h1
unfold
let live h (b:buffer 'a) = B.live h b
unfold
let ( .() ) (b:buffer 'a) (i:U32.t)
: ST 'a (requires fun h -> live h b /\ i <^ length b)
(ensures (fun h y h' -> h == h' /\ y == Seq.index (as_seq h b) (U32.v i)))
= B.index b i
unfold
let ( .()<- ) (b:buffer 'a) (i:U32.t) (v:'a)
: ST unit
(requires (fun h ->
live h b /\
i <^ length b))
(ensures (fun h _ h' ->
modifies b h h' /\
live h' b /\
as_seq h' b == Seq.upd (as_seq h b) (U32.v i) v))
= B.upd b i v
unfold
let suffix (#a:Type)
(b:buffer a)
(from:U32.t)
(len:U32.t{len <=^ length b /\ from <=^ len})
: ST (buffer a)
(requires (fun h ->
U32.v from + U32.v len <= U32.v (length b) /\
live h b))
(ensures (fun h y h' -> h == h' /\ y == mgsub _ b from (len -^ from)))
= B.sub b from (len -^ from)
unfold
let disjoint (b0 b1:B.buffer 'a) = B.disjoint b0 b1
let lbuffer (len:U32.t) (a:Type) = b:B.buffer a{len <=^ length b}
let prefix_equal (#l:uint32) (#a:Type)
(h:HS.mem)
(b1 b2: lbuffer l a)
(i:uint32{i <=^ l})
: prop
= forall (j:uint32). j <^ i ==>
B.get h b1 (U32.v j) == B.get h b2 (U32.v j)
unfold
let ( <= ) x y = U32.(x <=^ y)
unfold
let ( < ) x y = U32.(x <^ y)
let ( + ) (x:U32.t) (y:U32.t{FStar.UInt.size (v x + v y) U32.n}) = U32.(x +^ y)
let op_Subtraction (x:U32.t)
(y:U32.t{FStar.UInt.size (v x - v y) U32.n})
= U32.(x -^ y)
inline_for_extraction
let malloc (init:'a) (len:U32.t)
: ST (lbuffer len 'a)
(requires fun h -> malloc_pre HS.root len)
(ensures fun h0 b h1 ->
alloc_post_mem_common b h0 h1 (Seq.create (U32.v len) init) /\
freeable b)
= B.malloc HS.root init len
inline_for_extraction
let free (#a:Type0) (b:buffer a)
: ST unit
(requires fun h0 ->
live h0 b /\
freeable b)
(ensures (fun h0 _ h1 ->
Map.domain (HS.get_hmap h1) `Set.equal` Map.domain (HS.get_hmap h0) /\
(HS.get_tip h1) == (HS.get_tip h0) /\
B.modifies (loc_addr_of_buffer b) h0 h1 /\
HS.live_region h1 (frameOf b)))
= B.free b
let get (h:HS.mem) (b:buffer 'a{ live h b }) (i:U32.t{ i < length b}) =
B.get h b (U32.v i) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "OPLSS2021.MemCpy.Deps.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.UInt32",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
l: LowStar.Monotonic.Buffer.loc ->
h: FStar.Monotonic.HyperStack.mem ->
h': FStar.Monotonic.HyperStack.mem
-> FStar.Pervasives.Lemma
(requires
LowStar.Monotonic.Buffer.modifies (LowStar.Monotonic.Buffer.loc_union (LowStar.Monotonic.Buffer.loc_unused_in
h)
l)
h
h')
(ensures LowStar.Monotonic.Buffer.modifies l h h')
[SMTPat (LowStar.Monotonic.Buffer.modifies l h h')] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowStar.Monotonic.Buffer.loc",
"FStar.Monotonic.HyperStack.mem",
"LowStar.Monotonic.Buffer.modifies_only_not_unused_in",
"Prims.unit",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_union",
"LowStar.Monotonic.Buffer.loc_unused_in",
"Prims.squash",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | true | false | true | false | false | let modifies_only_not_unused_in (l: loc) (h h': HS.mem)
: Lemma (requires (let open B in modifies (loc_union (loc_unused_in h) l) h h'))
(ensures (let open B in modifies l h h'))
[SMTPat B.((modifies l h h'))] =
| B.modifies_only_not_unused_in l h h' | false |
OPLSS2021.MemCpy.Deps.fst | OPLSS2021.MemCpy.Deps.length | val length (#a: Type) (b: buffer a) : GTot U32.t | val length (#a: Type) (b: buffer a) : GTot U32.t | let length (#a:Type) (b:buffer a) : GTot U32.t =
U32.uint_to_t (B.length b) | {
"file_name": "examples/oplss2021/OPLSS2021.MemCpy.Deps.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 30,
"end_line": 33,
"start_col": 0,
"start_line": 32
} | (*
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 OPLSS2021.MemCpy.Deps
open LowStar.Buffer
open FStar.UInt32
module B = LowStar.Buffer
module U32 = FStar.UInt32
module U8 = FStar.UInt8
module HS = FStar.HyperStack
open FStar.HyperStack.ST
effect St (a:Type) = FStar.HyperStack.ST.St a
let buffer = B.buffer
let uint32 = U32.t
let uint8 = U8.t | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowStar.Buffer.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.UInt.fsti.checked",
"FStar.Set.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Map.fsti.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked"
],
"interface_file": false,
"source_file": "OPLSS2021.MemCpy.Deps.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.HyperStack",
"short_module": "HS"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "FStar.UInt32",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowStar.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "OPLSS2021.MemCpy",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | b: OPLSS2021.MemCpy.Deps.buffer a -> Prims.GTot FStar.UInt32.t | Prims.GTot | [
"sometrivial"
] | [] | [
"OPLSS2021.MemCpy.Deps.buffer",
"FStar.UInt32.uint_to_t",
"LowStar.Monotonic.Buffer.length",
"LowStar.Buffer.trivial_preorder",
"FStar.UInt32.t"
] | [] | false | false | false | false | false | let length (#a: Type) (b: buffer a) : GTot U32.t =
| U32.uint_to_t (B.length b) | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.