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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LList32.fst | LList32.llist | val llist : Type0 | let llist = llist u32 | {
"file_name": "share/steel/examples/steel/LList32.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 21,
"end_line": 38,
"start_col": 0,
"start_line": 38
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: Aseem Rastogi
*)
module LList32
open Steel.Memory
open Steel.ST.Effect
open Steel.ST.Util
open LList.ST
module G = FStar.Ghost
/// Monomorphization of LList.ST for UInt32
#set-options "--ide_id_info_off"
type u32 = FStar.UInt32.t
inline_for_extraction
let llist_node = llist_node u32 | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Effect.fsti.checked",
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"LList.ST.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LList32.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": false,
"full_module": "LList.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": 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 | Type0 | Prims.Tot | [
"total"
] | [] | [
"LList.ST.llist",
"LList32.u32"
] | [] | false | false | false | true | true | let llist =
| llist u32 | false |
|
CQueue.Cell.fst | CQueue.Cell.ccell_ptrvalue | val ccell_ptrvalue (a: Type0) : Tot Type0 | val ccell_ptrvalue (a: Type0) : Tot Type0 | let ccell_ptrvalue a = mcell a | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 30,
"end_line": 14,
"start_col": 0,
"start_line": 14
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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"
] | [] | [
"CQueue.Cell.mcell"
] | [] | false | false | false | true | true | let ccell_ptrvalue a =
| mcell a | false |
CQueue.Cell.fst | CQueue.Cell.ccell_is_lvalue_refine | val ccell_is_lvalue_refine: #a: Type -> c: ccell_ptrvalue a -> t_of emp -> Tot prop | val ccell_is_lvalue_refine: #a: Type -> c: ccell_ptrvalue a -> t_of emp -> Tot prop | let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 35,
"end_line": 31,
"start_col": 0,
"start_line": 26
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_ptrvalue a -> _: Steel.Effect.Common.t_of Steel.Effect.Common.emp -> Prims.prop | Prims.Tot | [
"total"
] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Steel.Effect.Common.t_of",
"Steel.Effect.Common.emp",
"Prims.eq2",
"Prims.bool",
"CQueue.Cell.ccell_ptrvalue_is_null",
"Prims.prop"
] | [] | false | false | false | true | true | let ccell_is_lvalue_refine (#a: Type) (c: ccell_ptrvalue a) (_: t_of emp) : Tot prop =
| ccell_ptrvalue_is_null c == false | false |
CQueue.Cell.fst | CQueue.Cell.ccell_is_lvalue_sel | val ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c)) | val ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c)) | let ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c))
= sel_of (ccell_is_lvalue0 c) | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 29,
"end_line": 57,
"start_col": 0,
"start_line": 53
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c
[@@ __steel_reduce__; __reduce__ ]
let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c
let ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1)
= hp_of (ccell_is_lvalue0 c) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_ptrvalue a
-> Prims.GTot
(Steel.Effect.Common.selector (CQueue.Cell.ccell_lvalue a) (CQueue.Cell.ccell_is_lvalue_hp c)) | Prims.GTot | [
"sometrivial"
] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Steel.Effect.Common.sel_of",
"CQueue.Cell.ccell_is_lvalue0",
"Steel.Effect.Common.selector",
"CQueue.Cell.ccell_lvalue",
"CQueue.Cell.ccell_is_lvalue_hp"
] | [] | false | false | false | false | false | let ccell_is_lvalue_sel (#a: Type) (c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c)) =
| sel_of (ccell_is_lvalue0 c) | false |
CQueue.Cell.fst | CQueue.Cell.ccell_rewrite | val ccell_rewrite
(#a: Type0)
(c: ccell_ptrvalue a)
(x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))
: GTot (vcell a) | val ccell_rewrite
(#a: Type0)
(c: ccell_ptrvalue a)
(x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))
: GTot (vcell a) | let ccell_rewrite
(#a: Type0)
(c: ccell_ptrvalue a)
(x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))
: GTot (vcell a)
= let p =
dsnd #(ccell_lvalue a) #(vdep_payload (ccell_is_lvalue c) (ccell0 a)) x
in
{
vcell_data = fst p;
vcell_next = snd p;
} | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 3,
"end_line": 103,
"start_col": 0,
"start_line": 92
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c
[@@ __steel_reduce__; __reduce__ ]
let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c
let ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1)
= hp_of (ccell_is_lvalue0 c)
let ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c))
= sel_of (ccell_is_lvalue0 c)
let intro_ccell_is_lvalue
#_ #a c
=
intro_vrefine emp (ccell_is_lvalue_refine c);
intro_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
change_slprop_rel
(ccell_is_lvalue0 c)
(ccell_is_lvalue c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
)
let elim_ccell_is_lvalue
#_ #a c
=
change_slprop_rel
(ccell_is_lvalue c)
(ccell_is_lvalue0 c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
);
elim_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
elim_vrefine emp (ccell_is_lvalue_refine c)
[@@ __steel_reduce__]
let ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop =
(vptr (ccell_data c) `star` vptr (ccell_next c)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 |
c: CQueue.Cell.ccell_ptrvalue a ->
x:
Prims.dtuple2 (CQueue.Cell.ccell_lvalue a)
(Steel.Effect.Common.vdep_payload (CQueue.Cell.ccell_is_lvalue c) (CQueue.Cell.ccell0 a))
-> Prims.GTot (CQueue.Cell.vcell a) | Prims.GTot | [
"sometrivial"
] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Prims.dtuple2",
"CQueue.Cell.ccell_lvalue",
"Steel.Effect.Common.vdep_payload",
"CQueue.Cell.ccell_is_lvalue",
"CQueue.Cell.ccell0",
"CQueue.Cell.Mkvcell",
"FStar.Pervasives.Native.fst",
"Steel.Effect.Common.t_of",
"Steel.Reference.vptr",
"CQueue.Cell.ccell_data",
"Prims.__proj__Mkdtuple2__item___1",
"CQueue.Cell.ccell_next",
"FStar.Pervasives.Native.snd",
"FStar.Pervasives.dsnd",
"CQueue.Cell.vcell"
] | [] | false | false | false | false | false | let ccell_rewrite
(#a: Type0)
(c: ccell_ptrvalue a)
(x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))
: GTot (vcell a) =
| let p = dsnd #(ccell_lvalue a) #(vdep_payload (ccell_is_lvalue c) (ccell0 a)) x in
{ vcell_data = fst p; vcell_next = snd p } | false |
CQueue.Cell.fst | CQueue.Cell.ccell_is_lvalue_hp | val ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1) | val ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1) | let ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1)
= hp_of (ccell_is_lvalue0 c) | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 28,
"end_line": 51,
"start_col": 0,
"start_line": 47
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c
[@@ __steel_reduce__; __reduce__ ]
let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_ptrvalue a -> Steel.Memory.slprop | Prims.Tot | [
"total"
] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Steel.Effect.Common.hp_of",
"CQueue.Cell.ccell_is_lvalue0",
"Steel.Memory.slprop"
] | [] | false | false | false | true | false | let ccell_is_lvalue_hp (#a: Type) (c: ccell_ptrvalue a) : Tot (slprop u#1) =
| hp_of (ccell_is_lvalue0 c) | false |
CQueue.Cell.fst | CQueue.Cell.ccell1 | val ccell1 (#a: Type0) (c: ccell_ptrvalue a) : Tot vprop | val ccell1 (#a: Type0) (c: ccell_ptrvalue a) : Tot vprop | let ccell1
(#a: Type0)
(c: ccell_ptrvalue a)
: Tot vprop
= ccell_is_lvalue c `vdep` ccell0 a `vrewrite` ccell_rewrite c | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 62,
"end_line": 110,
"start_col": 0,
"start_line": 106
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c
[@@ __steel_reduce__; __reduce__ ]
let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c
let ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1)
= hp_of (ccell_is_lvalue0 c)
let ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c))
= sel_of (ccell_is_lvalue0 c)
let intro_ccell_is_lvalue
#_ #a c
=
intro_vrefine emp (ccell_is_lvalue_refine c);
intro_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
change_slprop_rel
(ccell_is_lvalue0 c)
(ccell_is_lvalue c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
)
let elim_ccell_is_lvalue
#_ #a c
=
change_slprop_rel
(ccell_is_lvalue c)
(ccell_is_lvalue0 c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
);
elim_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
elim_vrefine emp (ccell_is_lvalue_refine c)
[@@ __steel_reduce__]
let ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop =
(vptr (ccell_data c) `star` vptr (ccell_next c))
// unfold
let ccell_rewrite
(#a: Type0)
(c: ccell_ptrvalue a)
(x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))
: GTot (vcell a)
= let p =
dsnd #(ccell_lvalue a) #(vdep_payload (ccell_is_lvalue c) (ccell0 a)) x
in
{
vcell_data = fst p;
vcell_next = snd p;
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_ptrvalue a -> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Steel.Effect.Common.vrewrite",
"Steel.Effect.Common.vdep",
"CQueue.Cell.ccell_is_lvalue",
"CQueue.Cell.ccell0",
"CQueue.Cell.vcell",
"CQueue.Cell.ccell_rewrite",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let ccell1 (#a: Type0) (c: ccell_ptrvalue a) : Tot vprop =
| ((ccell_is_lvalue c) `vdep` (ccell0 a)) `vrewrite` (ccell_rewrite c) | false |
CQueue.Cell.fst | CQueue.Cell.ccell0 | val ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop | val ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop | let ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop =
(vptr (ccell_data c) `star` vptr (ccell_next c)) | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 50,
"end_line": 89,
"start_col": 0,
"start_line": 88
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c
[@@ __steel_reduce__; __reduce__ ]
let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c
let ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1)
= hp_of (ccell_is_lvalue0 c)
let ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c))
= sel_of (ccell_is_lvalue0 c)
let intro_ccell_is_lvalue
#_ #a c
=
intro_vrefine emp (ccell_is_lvalue_refine c);
intro_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
change_slprop_rel
(ccell_is_lvalue0 c)
(ccell_is_lvalue c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
)
let elim_ccell_is_lvalue
#_ #a c
=
change_slprop_rel
(ccell_is_lvalue c)
(ccell_is_lvalue0 c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
);
elim_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
elim_vrefine emp (ccell_is_lvalue_refine c) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 -> c: CQueue.Cell.ccell_lvalue a -> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"CQueue.Cell.ccell_lvalue",
"Steel.Effect.Common.star",
"Steel.Reference.vptr",
"CQueue.Cell.ccell_data",
"CQueue.Cell.ccell_ptrvalue",
"CQueue.Cell.ccell_next",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop =
| ((vptr (ccell_data c)) `star` (vptr (ccell_next c))) | false |
CQueue.Cell.fst | CQueue.Cell.ccell_hp | val ccell_hp
(#a: Type0)
(c: ccell_ptrvalue a)
: Tot (slprop u#1) | val ccell_hp
(#a: Type0)
(c: ccell_ptrvalue a)
: Tot (slprop u#1) | let ccell_hp
#a c
= hp_of (ccell1 c) | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 18,
"end_line": 114,
"start_col": 0,
"start_line": 112
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c
[@@ __steel_reduce__; __reduce__ ]
let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c
let ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1)
= hp_of (ccell_is_lvalue0 c)
let ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c))
= sel_of (ccell_is_lvalue0 c)
let intro_ccell_is_lvalue
#_ #a c
=
intro_vrefine emp (ccell_is_lvalue_refine c);
intro_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
change_slprop_rel
(ccell_is_lvalue0 c)
(ccell_is_lvalue c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
)
let elim_ccell_is_lvalue
#_ #a c
=
change_slprop_rel
(ccell_is_lvalue c)
(ccell_is_lvalue0 c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
);
elim_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
elim_vrefine emp (ccell_is_lvalue_refine c)
[@@ __steel_reduce__]
let ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop =
(vptr (ccell_data c) `star` vptr (ccell_next c))
// unfold
let ccell_rewrite
(#a: Type0)
(c: ccell_ptrvalue a)
(x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))
: GTot (vcell a)
= let p =
dsnd #(ccell_lvalue a) #(vdep_payload (ccell_is_lvalue c) (ccell0 a)) x
in
{
vcell_data = fst p;
vcell_next = snd p;
}
[@@ __steel_reduce__ ; __reduce__] // to avoid manual unfoldings through change_slprop
let ccell1
(#a: Type0)
(c: ccell_ptrvalue a)
: Tot vprop
= ccell_is_lvalue c `vdep` ccell0 a `vrewrite` ccell_rewrite c | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_ptrvalue a -> Steel.Memory.slprop | Prims.Tot | [
"total"
] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Steel.Effect.Common.hp_of",
"CQueue.Cell.ccell1",
"Steel.Memory.slprop"
] | [] | false | false | false | true | false | let ccell_hp #a c =
| hp_of (ccell1 c) | false |
CQueue.Cell.fst | CQueue.Cell.ccell_sel | val ccell_sel
(#a: Type0)
(c: ccell_ptrvalue a)
: GTot (selector (vcell a) (ccell_hp c)) | val ccell_sel
(#a: Type0)
(c: ccell_ptrvalue a)
: GTot (selector (vcell a) (ccell_hp c)) | let ccell_sel
#a c
= sel_of (ccell1 c) | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 19,
"end_line": 118,
"start_col": 0,
"start_line": 116
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c
[@@ __steel_reduce__; __reduce__ ]
let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c
let ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1)
= hp_of (ccell_is_lvalue0 c)
let ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c))
= sel_of (ccell_is_lvalue0 c)
let intro_ccell_is_lvalue
#_ #a c
=
intro_vrefine emp (ccell_is_lvalue_refine c);
intro_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
change_slprop_rel
(ccell_is_lvalue0 c)
(ccell_is_lvalue c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
)
let elim_ccell_is_lvalue
#_ #a c
=
change_slprop_rel
(ccell_is_lvalue c)
(ccell_is_lvalue0 c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
);
elim_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
elim_vrefine emp (ccell_is_lvalue_refine c)
[@@ __steel_reduce__]
let ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop =
(vptr (ccell_data c) `star` vptr (ccell_next c))
// unfold
let ccell_rewrite
(#a: Type0)
(c: ccell_ptrvalue a)
(x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))
: GTot (vcell a)
= let p =
dsnd #(ccell_lvalue a) #(vdep_payload (ccell_is_lvalue c) (ccell0 a)) x
in
{
vcell_data = fst p;
vcell_next = snd p;
}
[@@ __steel_reduce__ ; __reduce__] // to avoid manual unfoldings through change_slprop
let ccell1
(#a: Type0)
(c: ccell_ptrvalue a)
: Tot vprop
= ccell_is_lvalue c `vdep` ccell0 a `vrewrite` ccell_rewrite c
let ccell_hp
#a c
= hp_of (ccell1 c) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_ptrvalue a
-> Prims.GTot (Steel.Effect.Common.selector (CQueue.Cell.vcell a) (CQueue.Cell.ccell_hp c)) | Prims.GTot | [
"sometrivial"
] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Steel.Effect.Common.sel_of",
"CQueue.Cell.ccell1",
"Steel.Effect.Common.selector",
"CQueue.Cell.vcell",
"CQueue.Cell.ccell_hp"
] | [] | false | false | false | false | false | let ccell_sel #a c =
| sel_of (ccell1 c) | false |
CQueue.Cell.fst | CQueue.Cell.ccell_data | val ccell_data (#a: Type0) (c: ccell_lvalue a) : Pure (ref a)
(requires True)
(ensures (fun v -> ~ (is_null v))) | val ccell_data (#a: Type0) (c: ccell_lvalue a) : Pure (ref a)
(requires True)
(ensures (fun v -> ~ (is_null v))) | let ccell_data #a c =
c.data | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 8,
"end_line": 21,
"start_col": 0,
"start_line": 20
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_lvalue a -> Prims.Pure (Steel.Reference.ref a) | Prims.Pure | [] | [] | [
"CQueue.Cell.ccell_lvalue",
"CQueue.Cell.__proj__Mkmcell__item__data",
"Steel.Reference.ref"
] | [] | false | false | false | false | false | let ccell_data #a c =
| c.data | false |
CQueue.Cell.fst | CQueue.Cell.ccell_next | val ccell_next (#a: Type0) (c: ccell_lvalue a) : Pure (ref (ccell_ptrvalue a))
(requires True)
(ensures (fun v -> ~ (is_null v))) | val ccell_next (#a: Type0) (c: ccell_lvalue a) : Pure (ref (ccell_ptrvalue a))
(requires True)
(ensures (fun v -> ~ (is_null v))) | let ccell_next #a c =
c.next | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 8,
"end_line": 24,
"start_col": 0,
"start_line": 23
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_lvalue a -> Prims.Pure (Steel.Reference.ref (CQueue.Cell.ccell_ptrvalue a)) | Prims.Pure | [] | [] | [
"CQueue.Cell.ccell_lvalue",
"CQueue.Cell.__proj__Mkmcell__item__next",
"Steel.Reference.ref",
"CQueue.Cell.ccell_ptrvalue"
] | [] | false | false | false | false | false | let ccell_next #a c =
| c.next | false |
CQueue.Cell.fst | CQueue.Cell.ccell_ptrvalue_null | val ccell_ptrvalue_null (a: Type0) : Tot (ccell_ptrvalue a) | val ccell_ptrvalue_null (a: Type0) : Tot (ccell_ptrvalue a) | let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()} | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 77,
"end_line": 16,
"start_col": 0,
"start_line": 16
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 -> CQueue.Cell.ccell_ptrvalue a | Prims.Tot | [
"total"
] | [] | [
"CQueue.Cell.Mkmcell",
"Steel.Reference.null",
"CQueue.Cell.mcell",
"CQueue.Cell.ccell_ptrvalue"
] | [] | false | false | false | true | false | let ccell_ptrvalue_null a =
| { data = null; next = null; all_or_none_null = () } | false |
CQueue.Cell.fst | CQueue.Cell.ccell_ptrvalue_is_null | val ccell_ptrvalue_is_null (#a: Type0) (c: ccell_ptrvalue a) : Pure bool
(requires True)
(ensures (fun b -> b == true <==> c == ccell_ptrvalue_null a)) | val ccell_ptrvalue_is_null (#a: Type0) (c: ccell_ptrvalue a) : Pure bool
(requires True)
(ensures (fun b -> b == true <==> c == ccell_ptrvalue_null a)) | let ccell_ptrvalue_is_null #a x = is_null x.data | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 48,
"end_line": 18,
"start_col": 0,
"start_line": 18
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_ptrvalue a -> Prims.Pure Prims.bool | Prims.Pure | [] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Steel.Reference.is_null",
"CQueue.Cell.__proj__Mkmcell__item__data",
"Prims.bool"
] | [] | false | false | false | false | false | let ccell_ptrvalue_is_null #a x =
| is_null x.data | false |
CQueue.Cell.fst | CQueue.Cell.ccell_is_lvalue0 | val ccell_is_lvalue0 (#a: Type) (c: ccell_ptrvalue a) : Tot vprop | val ccell_is_lvalue0 (#a: Type) (c: ccell_ptrvalue a) : Tot vprop | let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 77,
"end_line": 45,
"start_col": 0,
"start_line": 41
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_ptrvalue a -> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Steel.Effect.Common.vrewrite",
"Steel.Effect.Common.vrefine",
"Steel.Effect.Common.emp",
"CQueue.Cell.ccell_is_lvalue_refine",
"CQueue.Cell.ccell_lvalue",
"CQueue.Cell.ccell_is_lvalue_rewrite",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let ccell_is_lvalue0 (#a: Type) (c: ccell_ptrvalue a) : Tot vprop =
| (emp `vrefine` (ccell_is_lvalue_refine c)) `vrewrite` (ccell_is_lvalue_rewrite c) | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_codegen_success_Loop_rounds_0_15 | val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool | val va_codegen_success_Loop_rounds_0_15 : va_dummy:unit -> Tot va_pbool | let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ()))))))))))))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 97,
"end_line": 54,
"start_col": 0,
"start_line": 44
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ()))))))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_pbool_and",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_3_7_11_body",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_1_3",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_5_7",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_9_11",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_13_15",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_16_63_body",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_Loop_rounds_0_15 () =
| (va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4))
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8))
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12))
(va_pbool_and (va_codegen_success_Loop_rounds_1_3 ())
(va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ())
(va_pbool_and (va_codegen_success_Loop_rounds_0_59_b 4)
(va_pbool_and (va_codegen_success_Loop_rounds_9_11 ())
(va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8)
(va_pbool_and (va_codegen_success_Loop_rounds_13_15 ())
(va_pbool_and (va_codegen_success_Loop_rounds_0_59_d 12)
(va_pbool_and (va_codegen_success_Loop_rounds_16_63_body
16
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 14))
(va_ttrue ()))))))))))))) | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_0_15 | val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code | val va_code_Loop_rounds_0_15 : va_dummy:unit -> Tot va_code | let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ()))))))))))))))))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 78,
"end_line": 41,
"start_col": 0,
"start_line": 31
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15 | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_Block",
"Vale.PPC64LE.Decls.va_CCons",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_3_7_11_body",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.PPC64LE.Decls.va_CNil",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_1_3",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_5_7",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_9_11",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_13_15",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_63_body",
"Vale.PPC64LE.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_Loop_rounds_0_15 () =
| (va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4))
(va_CCons (va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8))
(va_CCons (va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ()))
(va_CCons (va_code_Loop_rounds_1_3 ())
(va_CCons (va_code_Loop_rounds_0_59_a 0)
(va_CCons (va_code_Loop_rounds_5_7 ())
(va_CCons (va_code_Loop_rounds_0_59_b 4)
(va_CCons (va_code_Loop_rounds_9_11 ())
(va_CCons (va_code_Loop_rounds_0_59_c 8)
(va_CCons (va_code_Loop_rounds_13_15 ())
(va_CCons (va_code_Loop_rounds_0_59_d 12)
(va_CCons (va_code_Loop_rounds_16_63_body
16
(va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9)
(va_op_vec_opr_vec 14))
(va_CNil ()))))))))))))))))) | false |
CQueue.Cell.fst | CQueue.Cell.ccell_is_lvalue_rewrite | val ccell_is_lvalue_rewrite:
#a: Type ->
c: ccell_ptrvalue a ->
normal (t_of (emp `vrefine` (ccell_is_lvalue_refine c)))
-> GTot (ccell_lvalue a) | val ccell_is_lvalue_rewrite:
#a: Type ->
c: ccell_ptrvalue a ->
normal (t_of (emp `vrefine` (ccell_is_lvalue_refine c)))
-> GTot (ccell_lvalue a) | let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 3,
"end_line": 38,
"start_col": 0,
"start_line": 33
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 |
c: CQueue.Cell.ccell_ptrvalue a ->
_:
Steel.Effect.Common.normal (Steel.Effect.Common.t_of (Steel.Effect.Common.vrefine Steel.Effect.Common.emp
(CQueue.Cell.ccell_is_lvalue_refine c)))
-> Prims.GTot (CQueue.Cell.ccell_lvalue a) | Prims.GTot | [
"sometrivial"
] | [] | [
"CQueue.Cell.ccell_ptrvalue",
"Steel.Effect.Common.normal",
"Steel.Effect.Common.t_of",
"Steel.Effect.Common.vrefine",
"Steel.Effect.Common.emp",
"CQueue.Cell.ccell_is_lvalue_refine",
"CQueue.Cell.ccell_lvalue"
] | [] | false | false | false | false | false | let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` (ccell_is_lvalue_refine c))))
: GTot (ccell_lvalue a) =
| c | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_48_63 | val va_code_Loop_rounds_48_63 : va_dummy:unit -> Tot va_code | val va_code_Loop_rounds_48_63 : va_dummy:unit -> Tot va_code | let va_code_Loop_rounds_48_63 () =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a 48) (va_CCons (va_code_Loop_rounds_0_59_a 48)
(va_CCons (va_code_Loop_rounds_16_59_b 52) (va_CCons (va_code_Loop_rounds_0_59_b 52) (va_CCons
(va_code_Loop_rounds_16_59_c 56) (va_CCons (va_code_Loop_rounds_0_59_c 56) (va_CCons
(va_code_Loop_rounds_60_63_a ()) (va_CCons (va_code_Loop_rounds_60_63_b ()) (va_CNil
())))))))))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 332,
"start_col": 0,
"start_line": 327
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_16_47
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_47 i =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a i) (va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4)) (va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8)) (va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12)) (va_CCons (va_code_Loop_rounds_0_59_d (i +
12)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_47 i =
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a i)
(va_codegen_success_Loop_rounds_16_59_a i)) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a i) (va_codegen_success_Loop_rounds_0_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_b (i + 4))
(va_codegen_success_Loop_rounds_16_59_b (i + 4))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b (i + 4)) (va_codegen_success_Loop_rounds_0_59_b (i +
4))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_c (i + 8))
(va_codegen_success_Loop_rounds_16_59_c (i + 8))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c (i + 8)) (va_codegen_success_Loop_rounds_0_59_c (i +
8))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_d (i + 12))
(va_codegen_success_Loop_rounds_16_59_d (i + 12))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_d (i + 12)) (va_codegen_success_Loop_rounds_0_59_d (i +
12))) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_47 (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 198 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a i k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b (i + 4) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b (i + 4) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c (i + 8) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c (i + 8) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_d (i + 12) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d (i + 12) k_b block hash_orig) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_47 va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_16_47 va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_47 i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 139 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 179 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label va_range1
"***** POSTCONDITION NOT MET AT line 189 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = repeat_range_vale (i + 16) block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == word_to_nat32 (index next_hash 0))
((va_get_vec 17 va_sM).hi3 == word_to_nat32 (index next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
word_to_nat32 (index next_hash 2))) ((va_get_vec 19 va_sM).hi3 == word_to_nat32 (index
next_hash 3))) ((va_get_vec 20 va_sM).hi3 == word_to_nat32 (index next_hash 4))) ((va_get_vec
21 va_sM).hi3 == word_to_nat32 (index next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
word_to_nat32 (index next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32 (word_to_nat32
(index next_hash 7)) (k_index ks (i + 16)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 195 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 16)) ((va_get_vec 1 va_sM).hi3
== ws_opaque block (i + 1))) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque
block (i + 4))) ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 5))) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 6))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 7)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 8))) ((va_get_vec 9 va_sM).hi3 == ws_opaque
block (i + 9))) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 10))) ((va_get_vec 11
va_sM).hi3 == ws_opaque block (i + 11))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
12))) ((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 13))) ((va_get_vec 14 va_sM).hi3 ==
ws_opaque block (i + 14))) ((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 15))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 196 column 98 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == k_index ks (i + 17)) ((va_get_vec 24 va_sM).hi2 ==
k_index ks (i + 18))) ((va_get_vec 24 va_sM).lo1 == k_index ks (i + 19)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_47 (va_code_Loop_rounds_16_47 i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_48_63 | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_Block",
"Vale.PPC64LE.Decls.va_CCons",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_60_63_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_60_63_b",
"Vale.PPC64LE.Decls.va_CNil",
"Vale.PPC64LE.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_Loop_rounds_48_63 () =
| (va_Block (va_CCons (va_code_Loop_rounds_16_59_a 48)
(va_CCons (va_code_Loop_rounds_0_59_a 48)
(va_CCons (va_code_Loop_rounds_16_59_b 52)
(va_CCons (va_code_Loop_rounds_0_59_b 52)
(va_CCons (va_code_Loop_rounds_16_59_c 56)
(va_CCons (va_code_Loop_rounds_0_59_c 56)
(va_CCons (va_code_Loop_rounds_60_63_a ())
(va_CCons (va_code_Loop_rounds_60_63_b ()) (va_CNil ())))))))))) | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_qcode_Loop_rounds_48_63 | val va_qcode_Loop_rounds_48_63
(va_mods: va_mods_t)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_48_63 ())) | val va_qcode_Loop_rounds_48_63
(va_mods: va_mods_t)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_48_63 ())) | let va_qcode_Loop_rounds_48_63 (va_mods:va_mods_t) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_48_63 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 252 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a 48 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 253 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 48 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 255 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b 52 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 256 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 52 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 258 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c 56 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 259 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 56 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 261 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_60_63_a block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 262 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_60_63_b k_b block hash_orig) (va_QEmpty (()))))))))))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 80,
"end_line": 364,
"start_col": 0,
"start_line": 346
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_16_47
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_47 i =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a i) (va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4)) (va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8)) (va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12)) (va_CCons (va_code_Loop_rounds_0_59_d (i +
12)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_47 i =
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a i)
(va_codegen_success_Loop_rounds_16_59_a i)) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a i) (va_codegen_success_Loop_rounds_0_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_b (i + 4))
(va_codegen_success_Loop_rounds_16_59_b (i + 4))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b (i + 4)) (va_codegen_success_Loop_rounds_0_59_b (i +
4))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_c (i + 8))
(va_codegen_success_Loop_rounds_16_59_c (i + 8))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c (i + 8)) (va_codegen_success_Loop_rounds_0_59_c (i +
8))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_d (i + 12))
(va_codegen_success_Loop_rounds_16_59_d (i + 12))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_d (i + 12)) (va_codegen_success_Loop_rounds_0_59_d (i +
12))) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_47 (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 198 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a i k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b (i + 4) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b (i + 4) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c (i + 8) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c (i + 8) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_d (i + 12) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d (i + 12) k_b block hash_orig) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_47 va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_16_47 va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_47 i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 139 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 179 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label va_range1
"***** POSTCONDITION NOT MET AT line 189 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = repeat_range_vale (i + 16) block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == word_to_nat32 (index next_hash 0))
((va_get_vec 17 va_sM).hi3 == word_to_nat32 (index next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
word_to_nat32 (index next_hash 2))) ((va_get_vec 19 va_sM).hi3 == word_to_nat32 (index
next_hash 3))) ((va_get_vec 20 va_sM).hi3 == word_to_nat32 (index next_hash 4))) ((va_get_vec
21 va_sM).hi3 == word_to_nat32 (index next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
word_to_nat32 (index next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32 (word_to_nat32
(index next_hash 7)) (k_index ks (i + 16)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 195 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 16)) ((va_get_vec 1 va_sM).hi3
== ws_opaque block (i + 1))) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque
block (i + 4))) ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 5))) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 6))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 7)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 8))) ((va_get_vec 9 va_sM).hi3 == ws_opaque
block (i + 9))) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 10))) ((va_get_vec 11
va_sM).hi3 == ws_opaque block (i + 11))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
12))) ((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 13))) ((va_get_vec 14 va_sM).hi3 ==
ws_opaque block (i + 14))) ((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 15))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 196 column 98 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == k_index ks (i + 17)) ((va_get_vec 24 va_sM).hi2 ==
k_index ks (i + 18))) ((va_get_vec 24 va_sM).lo1 == k_index ks (i + 19)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_47 (va_code_Loop_rounds_16_47 i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_48_63
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_48_63 () =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a 48) (va_CCons (va_code_Loop_rounds_0_59_a 48)
(va_CCons (va_code_Loop_rounds_16_59_b 52) (va_CCons (va_code_Loop_rounds_0_59_b 52) (va_CCons
(va_code_Loop_rounds_16_59_c 56) (va_CCons (va_code_Loop_rounds_0_59_c 56) (va_CCons
(va_code_Loop_rounds_60_63_a ()) (va_CCons (va_code_Loop_rounds_60_63_b ()) (va_CNil
()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_48_63 () =
(va_pbool_and (va_codegen_success_Loop_rounds_16_59_a 48) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a 48) (va_pbool_and
(va_codegen_success_Loop_rounds_16_59_b 52) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 52) (va_pbool_and
(va_codegen_success_Loop_rounds_16_59_c 56) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c 56) (va_pbool_and
(va_codegen_success_Loop_rounds_60_63_a ()) (va_pbool_and
(va_codegen_success_Loop_rounds_60_63_b ()) (va_ttrue ()))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_mods: Vale.PPC64LE.QuickCode.va_mods_t ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_48_63 ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.QuickCode.va_mods_t",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.PPC64LE.Decls.va_code",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_60_63_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_60_63_b",
"Prims.Nil",
"Vale.PPC64LE.Machine_s.precode",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.QuickCodes.va_QSeq",
"Vale.PPC64LE.QuickCodes.va_range1",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_60_63_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_60_63_b",
"Vale.PPC64LE.QuickCodes.va_QEmpty",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCodes.quickCodes",
"Vale.PPC64LE.QuickCode.va_quickCode",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_48_63"
] | [] | false | false | false | false | false | let va_qcode_Loop_rounds_48_63
(va_mods: va_mods_t)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_48_63 ())) =
| (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 252 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a 48 block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 253 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 48 k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 255 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b 52 block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 256 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 52 k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 258 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c 56 block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 259 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 56 k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 261 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_60_63_a block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 262 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_60_63_b k_b block hash_orig)
(va_QEmpty (()))))))))))) | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_codegen_success_Loop_rounds_48_63 | val va_codegen_success_Loop_rounds_48_63 : va_dummy:unit -> Tot va_pbool | val va_codegen_success_Loop_rounds_48_63 : va_dummy:unit -> Tot va_pbool | let va_codegen_success_Loop_rounds_48_63 () =
(va_pbool_and (va_codegen_success_Loop_rounds_16_59_a 48) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a 48) (va_pbool_and
(va_codegen_success_Loop_rounds_16_59_b 52) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 52) (va_pbool_and
(va_codegen_success_Loop_rounds_16_59_c 56) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c 56) (va_pbool_and
(va_codegen_success_Loop_rounds_60_63_a ()) (va_pbool_and
(va_codegen_success_Loop_rounds_60_63_b ()) (va_ttrue ()))))))))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 69,
"end_line": 343,
"start_col": 0,
"start_line": 335
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_16_47
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_47 i =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a i) (va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4)) (va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8)) (va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12)) (va_CCons (va_code_Loop_rounds_0_59_d (i +
12)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_47 i =
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a i)
(va_codegen_success_Loop_rounds_16_59_a i)) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a i) (va_codegen_success_Loop_rounds_0_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_b (i + 4))
(va_codegen_success_Loop_rounds_16_59_b (i + 4))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b (i + 4)) (va_codegen_success_Loop_rounds_0_59_b (i +
4))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_c (i + 8))
(va_codegen_success_Loop_rounds_16_59_c (i + 8))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c (i + 8)) (va_codegen_success_Loop_rounds_0_59_c (i +
8))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_d (i + 12))
(va_codegen_success_Loop_rounds_16_59_d (i + 12))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_d (i + 12)) (va_codegen_success_Loop_rounds_0_59_d (i +
12))) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_47 (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 198 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a i k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b (i + 4) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b (i + 4) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c (i + 8) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c (i + 8) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_d (i + 12) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d (i + 12) k_b block hash_orig) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_47 va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_16_47 va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_47 i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 139 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 179 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label va_range1
"***** POSTCONDITION NOT MET AT line 189 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = repeat_range_vale (i + 16) block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == word_to_nat32 (index next_hash 0))
((va_get_vec 17 va_sM).hi3 == word_to_nat32 (index next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
word_to_nat32 (index next_hash 2))) ((va_get_vec 19 va_sM).hi3 == word_to_nat32 (index
next_hash 3))) ((va_get_vec 20 va_sM).hi3 == word_to_nat32 (index next_hash 4))) ((va_get_vec
21 va_sM).hi3 == word_to_nat32 (index next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
word_to_nat32 (index next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32 (word_to_nat32
(index next_hash 7)) (k_index ks (i + 16)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 195 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 16)) ((va_get_vec 1 va_sM).hi3
== ws_opaque block (i + 1))) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque
block (i + 4))) ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 5))) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 6))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 7)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 8))) ((va_get_vec 9 va_sM).hi3 == ws_opaque
block (i + 9))) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 10))) ((va_get_vec 11
va_sM).hi3 == ws_opaque block (i + 11))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
12))) ((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 13))) ((va_get_vec 14 va_sM).hi3 ==
ws_opaque block (i + 14))) ((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 15))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 196 column 98 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == k_index ks (i + 17)) ((va_get_vec 24 va_sM).hi2 ==
k_index ks (i + 18))) ((va_get_vec 24 va_sM).lo1 == k_index ks (i + 19)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_47 (va_code_Loop_rounds_16_47 i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_48_63
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_48_63 () =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a 48) (va_CCons (va_code_Loop_rounds_0_59_a 48)
(va_CCons (va_code_Loop_rounds_16_59_b 52) (va_CCons (va_code_Loop_rounds_0_59_b 52) (va_CCons
(va_code_Loop_rounds_16_59_c 56) (va_CCons (va_code_Loop_rounds_0_59_c 56) (va_CCons
(va_code_Loop_rounds_60_63_a ()) (va_CCons (va_code_Loop_rounds_60_63_b ()) (va_CNil
())))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | va_dummy: Prims.unit -> Vale.PPC64LE.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"Vale.PPC64LE.Decls.va_pbool_and",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_16_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_16_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_16_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_60_63_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_60_63_b",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_Loop_rounds_48_63 () =
| (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a 48)
(va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 48)
(va_pbool_and (va_codegen_success_Loop_rounds_16_59_b 52)
(va_pbool_and (va_codegen_success_Loop_rounds_0_59_b 52)
(va_pbool_and (va_codegen_success_Loop_rounds_16_59_c 56)
(va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 56)
(va_pbool_and (va_codegen_success_Loop_rounds_60_63_a ())
(va_pbool_and (va_codegen_success_Loop_rounds_60_63_b ()) (va_ttrue ()))
))))))) | false |
OWGCounter.ST.fst | OWGCounter.ST.incr | val incr:
r: R.ref int ->
r_mine: GR.ref int ->
r_other: GR.ref int ->
b: G.erased bool ->
l: lock (lock_inv r (if b then r_mine else r_other) (if b then r_other else r_mine)) ->
n: G.erased int ->
Prims.unit
-> STT unit (GR.pts_to r_mine half_perm n) (fun _ -> GR.pts_to r_mine half_perm (n + 1)) | val incr:
r: R.ref int ->
r_mine: GR.ref int ->
r_other: GR.ref int ->
b: G.erased bool ->
l: lock (lock_inv r (if b then r_mine else r_other) (if b then r_other else r_mine)) ->
n: G.erased int ->
Prims.unit
-> STT unit (GR.pts_to r_mine half_perm n) (fun _ -> GR.pts_to r_mine half_perm (n + 1)) | let incr (r:R.ref int) (r_mine r_other:GR.ref int) (b:G.erased bool)
(l:lock (lock_inv r (if b then r_mine else r_other)
(if b then r_other else r_mine)))
(n:G.erased int)
()
: STT unit
(GR.pts_to r_mine half_perm n)
(fun _ -> GR.pts_to r_mine half_perm (n+1))
= acquire r r_mine r_other b l;
let w = elim_exists () in
//
// The lock has full permission to r,
// so we can just increment it
//
let v = R.read r in
R.write r (v+1);
rewrite
(R.pts_to r full_perm (v+1))
(R.pts_to r full_perm ((fst w+1) + snd w));
//
// The permission to the ghost reference is split
// between the lock and the thread, so we need to gather
// before we can increment
//
GR.gather #_ #_ #_ #_ #n #(G.hide (fst w)) r_mine;
rewrite (GR.pts_to r_mine (sum_perm half_perm half_perm) n)
(GR.pts_to r_mine full_perm n);
GR.write r_mine (n+1);
//
// Now we share back the ghost ref,
// and restore the lock invariant
//
GR.share r_mine;
rewrite (GR.pts_to r_mine (P.half_perm full_perm) (n+1))
(GR.pts_to r_mine half_perm (fst w+1));
intro_exists (fst w+1, snd w)
(lock_inv_predicate r r_mine r_other);
release r r_mine r_other b l;
rewrite (GR.pts_to r_mine (P.half_perm full_perm) (n+1))
(GR.pts_to r_mine half_perm (n+1)) | {
"file_name": "share/steel/examples/steel/OWGCounter.ST.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 46,
"end_line": 207,
"start_col": 0,
"start_line": 165
} | (*
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.
Author: Aseem Rastogi
*)
module OWGCounter.ST
open Steel.Memory
open Steel.ST.Effect.Atomic
open Steel.ST.Effect
open Steel.ST.SpinLock
open Steel.ST.Util
module G = FStar.Ghost
module R = Steel.ST.Reference
module GR = Steel.ST.GhostReference
(*
* An implementation of the parallel counter presented by Owicki and Gries
* "Verifying properties of parallel programs: An axiomatic approach.", CACM'76
*
* In this example, the main thread forks two worker thread that both
* increment a shared counter. The goal of the example is to show that
* after both the worker threads are done, the value of the counter is
* its original value + 2.
*
* See http://pm.inf.ethz.ch/publications/getpdf.php for an implementation
* of the OWG counters in the Chalice framework.
*
* The main idea is that the worker threads maintain ghost state
* that stores their respective contributions to the counter
* And the invariant between the counter and their contributions is
* protected by a lock
*)
#set-options "--ide_id_info_off"
let half_perm = half_perm full_perm
/// r1 and r2 are the ghost references for the two worker threads
///
/// The counter's value is the sum of values of r1 and r2
///
/// The lock contains full permission to the counter,
/// and half permission each for r1 and r2
///
/// Rest of the half permissions for r1 and r2 are given to the
/// two worker threads
[@@ __reduce__]
let lock_inv_predicate (r:R.ref int) (r1 r2:GR.ref int)
: int & int -> vprop
= fun w ->
GR.pts_to r1 half_perm (fst w)
`star`
GR.pts_to r2 half_perm (snd w)
`star`
R.pts_to r full_perm (fst w + snd w)
[@@ __reduce__]
let lock_inv (r:R.ref int) (r1 r2:GR.ref int) : vprop =
exists_ (lock_inv_predicate r r1 r2)
/// For the auxiliary functions, we maintain r1 and r2 as
/// (if b then r1 else r2) and (if b then r2 else r1),
/// where b is a ghost boolean
///
/// This allows us to write a single function that both threads
/// can invoke by switching r1 and r2 as r_mine and r_other
inline_for_extraction
noextract
let acquire (r:R.ref int) (r_mine r_other:GR.ref int) (b:G.erased bool)
(l:lock (lock_inv r (if b then r_mine else r_other)
(if b then r_other else r_mine)))
: STT unit
emp
(fun _ -> lock_inv r r_mine r_other)
= acquire l;
if b returns STGhostT unit
Set.empty
_
(fun _ -> lock_inv r r_mine r_other)
then begin
rewrite (lock_inv _ _ _)
(lock_inv r r_mine r_other)
end
else begin
rewrite (lock_inv _ _ _)
(lock_inv r r_other r_mine);
let w = elim_exists () in
rewrite
(GR.pts_to r_other _ _
`star`
GR.pts_to r_mine _ _
`star`
R.pts_to _ _ _)
(GR.pts_to r_other half_perm (snd (snd w, fst w))
`star`
GR.pts_to r_mine half_perm (fst (snd w, fst w))
`star`
R.pts_to r full_perm (fst (snd w, fst w) + snd (snd w, fst w)));
intro_exists (snd w, fst w) (lock_inv_predicate r r_mine r_other)
end
inline_for_extraction
noextract
let release (r:R.ref int) (r_mine r_other:GR.ref int) (b:G.erased bool)
(l:lock (lock_inv r (if b then r_mine else r_other)
(if b then r_other else r_mine)))
: STT unit
(lock_inv r r_mine r_other)
(fun _ -> emp)
= if b
then begin
rewrite (lock_inv r r_mine r_other)
(lock_inv r (if b then r_mine else r_other)
(if b then r_other else r_mine))
end
else begin
let w = elim_exists () in
rewrite
(GR.pts_to r_mine half_perm (fst w)
`star`
GR.pts_to r_other half_perm (snd w)
`star`
R.pts_to r full_perm (fst w + snd w))
(GR.pts_to r_mine half_perm (snd (snd w, fst w))
`star`
GR.pts_to r_other half_perm (fst (snd w, fst w))
`star`
R.pts_to r full_perm (fst (snd w, fst w) + snd (snd w, fst w)));
intro_exists
(snd w, fst w)
(lock_inv_predicate r r_other r_mine);
rewrite (lock_inv r r_other r_mine)
(lock_inv r (if b then r_mine else r_other)
(if b then r_other else r_mine))
end;
release l
module P = Steel.FractionalPermission
/// The incr function that each thread invokes in parallel
///
/// It acquires the lock and increments the counter
/// as well as the ghost reference
///
/// Finally releasing the lock after establishing the lock invariant | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.SpinLock.fsti.checked",
"Steel.ST.Reference.fsti.checked",
"Steel.ST.GhostReference.fsti.checked",
"Steel.ST.Effect.Atomic.fsti.checked",
"Steel.ST.Effect.fsti.checked",
"Steel.Memory.fsti.checked",
"Steel.FractionalPermission.fst.checked",
"prims.fst.checked",
"FStar.Set.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "OWGCounter.ST.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.FractionalPermission",
"short_module": "P"
},
{
"abbrev": true,
"full_module": "Steel.ST.GhostReference",
"short_module": "GR"
},
{
"abbrev": true,
"full_module": "Steel.ST.Reference",
"short_module": "R"
},
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.SpinLock",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "OWGCounter",
"short_module": null
},
{
"abbrev": false,
"full_module": "OWGCounter",
"short_module": null
},
{
"abbrev": 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 |
r: Steel.ST.Reference.ref Prims.int ->
r_mine: Steel.ST.GhostReference.ref Prims.int ->
r_other: Steel.ST.GhostReference.ref Prims.int ->
b: FStar.Ghost.erased Prims.bool ->
l:
Steel.ST.SpinLock.lock (OWGCounter.ST.lock_inv r
(match FStar.Ghost.reveal b with
| true -> r_mine
| _ -> r_other)
(match FStar.Ghost.reveal b with
| true -> r_other
| _ -> r_mine)) ->
n: FStar.Ghost.erased Prims.int ->
_: Prims.unit
-> Steel.ST.Effect.STT Prims.unit | Steel.ST.Effect.STT | [] | [] | [
"Steel.ST.Reference.ref",
"Prims.int",
"Steel.ST.GhostReference.ref",
"FStar.Ghost.erased",
"Prims.bool",
"Steel.ST.SpinLock.lock",
"OWGCounter.ST.lock_inv",
"FStar.Ghost.reveal",
"Prims.unit",
"Steel.ST.Util.rewrite",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"Steel.ST.GhostReference.pts_to",
"Steel.FractionalPermission.half_perm",
"Steel.FractionalPermission.full_perm",
"Prims.op_Addition",
"OWGCounter.ST.half_perm",
"OWGCounter.ST.release",
"Steel.ST.Util.intro_exists",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.fst",
"FStar.Pervasives.Native.snd",
"OWGCounter.ST.lock_inv_predicate",
"Steel.ST.GhostReference.share",
"Steel.ST.GhostReference.write",
"Steel.FractionalPermission.sum_perm",
"Steel.ST.GhostReference.gather",
"Steel.ST.Reference.pts_to",
"Steel.ST.Reference.write",
"Steel.ST.Reference.read",
"Steel.ST.Util.elim_exists",
"Steel.Effect.Common.VStar",
"Steel.Effect.Common.vprop",
"OWGCounter.ST.acquire"
] | [] | false | true | false | false | false | let incr
(r: R.ref int)
(r_mine: GR.ref int)
(r_other: GR.ref int)
(b: G.erased bool)
(l: lock (lock_inv r (if b then r_mine else r_other) (if b then r_other else r_mine)))
(n: G.erased int)
()
: STT unit (GR.pts_to r_mine half_perm n) (fun _ -> GR.pts_to r_mine half_perm (n + 1)) =
| acquire r r_mine r_other b l;
let w = elim_exists () in
let v = R.read r in
R.write r (v + 1);
rewrite (R.pts_to r full_perm (v + 1)) (R.pts_to r full_perm ((fst w + 1) + snd w));
GR.gather #_ #_ #_ #_ #n #(G.hide (fst w)) r_mine;
rewrite (GR.pts_to r_mine (sum_perm half_perm half_perm) n) (GR.pts_to r_mine full_perm n);
GR.write r_mine (n + 1);
GR.share r_mine;
rewrite (GR.pts_to r_mine (P.half_perm full_perm) (n + 1)) (GR.pts_to r_mine half_perm (fst w + 1));
intro_exists (fst w + 1, snd w) (lock_inv_predicate r r_mine r_other);
release r r_mine r_other b l;
rewrite (GR.pts_to r_mine (P.half_perm full_perm) (n + 1)) (GR.pts_to r_mine half_perm (n + 1)) | false |
Pulse.Checker.Prover.IntroExists.fst | Pulse.Checker.Prover.IntroExists.coerce_eq | val coerce_eq: #a: Type -> #b: Type -> x: a -> squash (a == b) -> y: b{y == x} | val coerce_eq: #a: Type -> #b: Type -> x: a -> squash (a == b) -> y: b{y == x} | let coerce_eq (#a #b:Type) (x:a) (_:squash (a == b)) : y:b{y == x} = x | {
"file_name": "lib/steel/pulse/Pulse.Checker.Prover.IntroExists.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 70,
"end_line": 32,
"start_col": 0,
"start_line": 32
} | (*
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.IntroExists
open Pulse.Syntax
open Pulse.Typing
open Pulse.Typing.Combinators
open Pulse.Typing.Metatheory
open Pulse.Checker.VPropEquiv
open Pulse.Checker.Prover.Base
open Pulse.Checker.Base
module RU = Pulse.RuntimeUtils
module T = FStar.Tactics.V2
module PS = Pulse.Checker.Prover.Substs
module Metatheory = Pulse.Typing.Metatheory | {
"checked_file": "/",
"dependencies": [
"Pulse.Typing.Metatheory.fsti.checked",
"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.Prover.Base.fsti.checked",
"Pulse.Checker.Base.fsti.checked",
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Printf.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Pulse.Checker.Prover.IntroExists.fst"
} | [
{
"abbrev": true,
"full_module": "Pulse.Typing.Metatheory",
"short_module": "Metatheory"
},
{
"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.Checker.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.Prover.Base",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Checker.VPropEquiv",
"short_module": null
},
{
"abbrev": false,
"full_module": "Pulse.Typing.Metatheory",
"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.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": "FStar.Tactics",
"short_module": "T"
},
{
"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 | x: a -> _: Prims.squash (a == b) -> y: b{y == x} | Prims.Tot | [
"total"
] | [] | [
"Prims.squash",
"Prims.eq2"
] | [] | false | false | false | false | false | let coerce_eq (#a: Type) (#b: Type) (x: a) (_: squash (a == b)) : y: b{y == x} =
| x | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_codegen_success_Loop_rounds_16_47 | val va_codegen_success_Loop_rounds_16_47 : i:nat -> Tot va_pbool | val va_codegen_success_Loop_rounds_16_47 : i:nat -> Tot va_pbool | let va_codegen_success_Loop_rounds_16_47 i =
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a i)
(va_codegen_success_Loop_rounds_16_59_a i)) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a i) (va_codegen_success_Loop_rounds_0_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_b (i + 4))
(va_codegen_success_Loop_rounds_16_59_b (i + 4))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b (i + 4)) (va_codegen_success_Loop_rounds_0_59_b (i +
4))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_c (i + 8))
(va_codegen_success_Loop_rounds_16_59_c (i + 8))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c (i + 8)) (va_codegen_success_Loop_rounds_0_59_c (i +
8))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_d (i + 12))
(va_codegen_success_Loop_rounds_16_59_d (i + 12))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_d (i + 12)) (va_codegen_success_Loop_rounds_0_59_d (i +
12))) (va_ttrue ()))))))))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 31,
"end_line": 229,
"start_col": 0,
"start_line": 216
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_16_47
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_47 i =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a i) (va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4)) (va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8)) (va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12)) (va_CCons (va_code_Loop_rounds_0_59_d (i +
12)) (va_CNil ())))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i: Prims.nat -> Vale.PPC64LE.Decls.va_pbool | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Decls.va_pbool_and",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_16_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_16_59_b",
"Prims.op_Addition",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_16_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_16_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_codegen_success_Loop_rounds_0_59_d",
"Vale.PPC64LE.Decls.va_ttrue",
"Vale.PPC64LE.Decls.va_pbool"
] | [] | false | false | false | true | false | let va_codegen_success_Loop_rounds_16_47 i =
| (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a i)
(va_codegen_success_Loop_rounds_16_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a i)
(va_codegen_success_Loop_rounds_0_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_b (i + 4))
(va_codegen_success_Loop_rounds_16_59_b (i + 4)))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_0_59_b (i + 4))
(va_codegen_success_Loop_rounds_0_59_b (i + 4)))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_c (i + 8))
(va_codegen_success_Loop_rounds_16_59_c (i + 8)))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c (i + 8))
(va_codegen_success_Loop_rounds_0_59_c (i + 8)))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_d (i + 12)
)
(va_codegen_success_Loop_rounds_16_59_d (i + 12)))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d (i +
12))
(va_codegen_success_Loop_rounds_0_59_d (i + 12)))
(va_ttrue ()))))))))) | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_16_47 | val va_code_Loop_rounds_16_47 : i:nat -> Tot va_code | val va_code_Loop_rounds_16_47 : i:nat -> Tot va_code | let va_code_Loop_rounds_16_47 i =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a i) (va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4)) (va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8)) (va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12)) (va_CCons (va_code_Loop_rounds_0_59_d (i +
12)) (va_CNil ())))))))))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 30,
"end_line": 213,
"start_col": 0,
"start_line": 208
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_16_47 | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | i: Prims.nat -> Vale.PPC64LE.Decls.va_code | Prims.Tot | [
"total"
] | [] | [
"Prims.nat",
"Vale.PPC64LE.Decls.va_Block",
"Vale.PPC64LE.Decls.va_CCons",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_b",
"Prims.op_Addition",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_d",
"Vale.PPC64LE.Decls.va_CNil",
"Vale.PPC64LE.Decls.va_code"
] | [] | false | false | false | true | false | let va_code_Loop_rounds_16_47 i =
| (va_Block (va_CCons (va_code_Loop_rounds_16_59_a i)
(va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12))
(va_CCons (va_code_Loop_rounds_0_59_d (i + 12)) (va_CNil ())))))))))
) | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_qcode_Loop_rounds_16_47 | val va_qcode_Loop_rounds_16_47
(va_mods: va_mods_t)
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_16_47 i)) | val va_qcode_Loop_rounds_16_47
(va_mods: va_mods_t)
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_16_47 i)) | let va_qcode_Loop_rounds_16_47 (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 198 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a i k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b (i + 4) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b (i + 4) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c (i + 8) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c (i + 8) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_d (i + 12) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d (i + 12) k_b block hash_orig) (va_QEmpty (()))))))))))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 88,
"end_line": 250,
"start_col": 0,
"start_line": 232
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_16_47
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_47 i =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a i) (va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4)) (va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8)) (va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12)) (va_CCons (va_code_Loop_rounds_0_59_d (i +
12)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_47 i =
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a i)
(va_codegen_success_Loop_rounds_16_59_a i)) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a i) (va_codegen_success_Loop_rounds_0_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_b (i + 4))
(va_codegen_success_Loop_rounds_16_59_b (i + 4))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b (i + 4)) (va_codegen_success_Loop_rounds_0_59_b (i +
4))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_c (i + 8))
(va_codegen_success_Loop_rounds_16_59_c (i + 8))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c (i + 8)) (va_codegen_success_Loop_rounds_0_59_c (i +
8))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_d (i + 12))
(va_codegen_success_Loop_rounds_16_59_d (i + 12))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_d (i + 12)) (va_codegen_success_Loop_rounds_0_59_d (i +
12))) (va_ttrue ()))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_mods: Vale.PPC64LE.QuickCode.va_mods_t ->
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_16_47 i) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.QuickCode.va_mods_t",
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.PPC64LE.Decls.va_code",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_b",
"Prims.op_Addition",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_d",
"Prims.Nil",
"Vale.PPC64LE.Machine_s.precode",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.QuickCodes.va_QSeq",
"Vale.PPC64LE.QuickCodes.va_range1",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_d",
"Vale.PPC64LE.QuickCodes.va_QEmpty",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCodes.quickCodes",
"Vale.PPC64LE.QuickCode.va_quickCode",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_16_47"
] | [] | false | false | false | false | false | let va_qcode_Loop_rounds_16_47
(va_mods: va_mods_t)
(i: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
: (va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
| (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 198 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a i block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a i k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b (i + 4) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b (i + 4) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c (i + 8) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c (i + 8) k_b block hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_d (i + 12) block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d (i + 12) k_b block hash_orig)
(va_QEmpty (()))))))))))) | false |
LList32.fst | LList32.cons | val cons (#l: G.erased (list u32)) (x: u32) (ll: llist)
: STT llist (ll `is_list` l) (fun ll -> ll `is_list` (x :: l)) | val cons (#l: G.erased (list u32)) (x: u32) (ll: llist)
: STT llist (ll `is_list` l) (fun ll -> ll `is_list` (x :: l)) | let cons (#l:G.erased (list u32)) (x:u32) (ll:llist)
: STT llist
(ll `is_list` l)
(fun ll -> ll `is_list` (x::l))
= cons x ll | {
"file_name": "share/steel/examples/steel/LList32.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 13,
"end_line": 46,
"start_col": 0,
"start_line": 42
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: Aseem Rastogi
*)
module LList32
open Steel.Memory
open Steel.ST.Effect
open Steel.ST.Util
open LList.ST
module G = FStar.Ghost
/// Monomorphization of LList.ST for UInt32
#set-options "--ide_id_info_off"
type u32 = FStar.UInt32.t
inline_for_extraction
let llist_node = llist_node u32
inline_for_extraction
let llist = llist u32
let is_list (ll:llist) (l:list u32) = is_list ll l | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Effect.fsti.checked",
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"LList.ST.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LList32.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": false,
"full_module": "LList.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": 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: LList32.u32 -> ll: LList32.llist -> Steel.ST.Effect.STT LList32.llist | Steel.ST.Effect.STT | [] | [] | [
"FStar.Ghost.erased",
"Prims.list",
"LList32.u32",
"LList32.llist",
"LList.ST.cons",
"LList.ST.llist",
"LList32.is_list",
"FStar.Ghost.reveal",
"Prims.Cons",
"Steel.Effect.Common.vprop"
] | [] | false | true | false | false | false | let cons (#l: G.erased (list u32)) (x: u32) (ll: llist)
: STT llist (ll `is_list` l) (fun ll -> ll `is_list` (x :: l)) =
| cons x ll | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_wpProof_Loop_rounds_48_63 | val va_wpProof_Loop_rounds_48_63 : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_48_63 k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_48_63 ()) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14;
va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
1; va_Mod_vec 0; va_Mod_reg 6]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_Loop_rounds_48_63 : k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_48_63 k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_48_63 ()) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14;
va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
1; va_Mod_vec 0; va_Mod_reg 6]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_Loop_rounds_48_63 k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_48_63 (va_code_Loop_rounds_48_63 ()) va_s0 k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 413,
"start_col": 0,
"start_line": 395
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_16_47
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_47 i =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a i) (va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4)) (va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8)) (va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12)) (va_CCons (va_code_Loop_rounds_0_59_d (i +
12)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_47 i =
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a i)
(va_codegen_success_Loop_rounds_16_59_a i)) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a i) (va_codegen_success_Loop_rounds_0_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_b (i + 4))
(va_codegen_success_Loop_rounds_16_59_b (i + 4))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b (i + 4)) (va_codegen_success_Loop_rounds_0_59_b (i +
4))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_c (i + 8))
(va_codegen_success_Loop_rounds_16_59_c (i + 8))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c (i + 8)) (va_codegen_success_Loop_rounds_0_59_c (i +
8))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_d (i + 12))
(va_codegen_success_Loop_rounds_16_59_d (i + 12))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_d (i + 12)) (va_codegen_success_Loop_rounds_0_59_d (i +
12))) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_47 (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 198 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a i k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b (i + 4) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b (i + 4) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c (i + 8) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c (i + 8) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_d (i + 12) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d (i + 12) k_b block hash_orig) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_47 va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_16_47 va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_47 i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 139 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 179 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label va_range1
"***** POSTCONDITION NOT MET AT line 189 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = repeat_range_vale (i + 16) block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == word_to_nat32 (index next_hash 0))
((va_get_vec 17 va_sM).hi3 == word_to_nat32 (index next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
word_to_nat32 (index next_hash 2))) ((va_get_vec 19 va_sM).hi3 == word_to_nat32 (index
next_hash 3))) ((va_get_vec 20 va_sM).hi3 == word_to_nat32 (index next_hash 4))) ((va_get_vec
21 va_sM).hi3 == word_to_nat32 (index next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
word_to_nat32 (index next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32 (word_to_nat32
(index next_hash 7)) (k_index ks (i + 16)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 195 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 16)) ((va_get_vec 1 va_sM).hi3
== ws_opaque block (i + 1))) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque
block (i + 4))) ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 5))) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 6))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 7)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 8))) ((va_get_vec 9 va_sM).hi3 == ws_opaque
block (i + 9))) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 10))) ((va_get_vec 11
va_sM).hi3 == ws_opaque block (i + 11))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
12))) ((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 13))) ((va_get_vec 14 va_sM).hi3 ==
ws_opaque block (i + 14))) ((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 15))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 196 column 98 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == k_index ks (i + 17)) ((va_get_vec 24 va_sM).hi2 ==
k_index ks (i + 18))) ((va_get_vec 24 va_sM).lo1 == k_index ks (i + 19)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_47 (va_code_Loop_rounds_16_47 i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_48_63
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_48_63 () =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a 48) (va_CCons (va_code_Loop_rounds_0_59_a 48)
(va_CCons (va_code_Loop_rounds_16_59_b 52) (va_CCons (va_code_Loop_rounds_0_59_b 52) (va_CCons
(va_code_Loop_rounds_16_59_c 56) (va_CCons (va_code_Loop_rounds_0_59_c 56) (va_CCons
(va_code_Loop_rounds_60_63_a ()) (va_CCons (va_code_Loop_rounds_60_63_b ()) (va_CNil
()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_48_63 () =
(va_pbool_and (va_codegen_success_Loop_rounds_16_59_a 48) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a 48) (va_pbool_and
(va_codegen_success_Loop_rounds_16_59_b 52) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 52) (va_pbool_and
(va_codegen_success_Loop_rounds_16_59_c 56) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c 56) (va_pbool_and
(va_codegen_success_Loop_rounds_60_63_a ()) (va_pbool_and
(va_codegen_success_Loop_rounds_60_63_b ()) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_48_63 (va_mods:va_mods_t) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_48_63 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 252 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a 48 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 253 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 48 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 255 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b 52 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 256 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 52 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 258 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c 56 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 259 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 56 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 261 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_60_63_a block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 262 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_60_63_b k_b block hash_orig) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_48_63 va_b0 va_s0 k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_48_63 va_mods k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_48_63 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 211 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 249 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 250 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.SHA.PPC64LE.Rounds.va_lemma_Loop_rounds_48_63",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_48_63"
] | [] | false | false | false | false | false | let va_wpProof_Loop_rounds_48_63 k_b block hash_orig va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_Loop_rounds_48_63 (va_code_Loop_rounds_48_63 ()) va_s0 k_b block hash_orig
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_vec 26
va_sM
(va_update_vec 25
va_sM
(va_update_vec 24
va_sM
(va_update_vec 23
va_sM
(va_update_vec 22
va_sM
(va_update_vec 21
va_sM
(va_update_vec 20
va_sM
(va_update_vec 19
va_sM
(va_update_vec 18
va_sM
(va_update_vec 17
va_sM
(va_update_vec 16
va_sM
(va_update_vec 15
va_sM
(va_update_vec 14
va_sM
(va_update_vec 13
va_sM
(va_update_vec 12
va_sM
(va_update_vec 11
va_sM
(va_update_vec 10
va_sM
(va_update_vec 9
va_sM
(va_update_vec 8
va_sM
(va_update_vec 7
va_sM
(va_update_vec
6
va_sM
(va_update_vec
5
va_sM
(va_update_vec
4
va_sM
(va_update_vec
3
va_sM
(
va_update_vec
2
va_sM
(
va_update_vec
1
va_sM
(
va_update_vec
0
va_sM
(
va_update_reg
6
va_sM
(
va_update_ok
va_sM
va_s0
)
)
)
)
)
))
))))))))))
)))))))))))));
va_lemma_norm_mods ([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_wpProof_Loop_rounds_0_15 | val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> offset:nat -> k_b:buffer128 -> block:block_w ->
hash_orig:hash256 -> input_BE:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14;
va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_Loop_rounds_0_15 : in_b:buffer128 -> offset:nat -> k_b:buffer128 -> block:block_w ->
hash_orig:hash256 -> input_BE:(seq quad32) -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE
va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_0_15 ()) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14;
va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 202,
"start_col": 0,
"start_line": 183
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
in_b: Vale.PPC64LE.Memory.buffer128 ->
offset: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
input_BE: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Memory.buffer128",
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.SHA.PPC64LE.Rounds.va_lemma_Loop_rounds_0_15",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_0_15"
] | [] | false | false | false | false | false | let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ())
va_s0
in_b
offset
k_b
block
hash_orig
input_BE
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_vec 26
va_sM
(va_update_vec 25
va_sM
(va_update_vec 24
va_sM
(va_update_vec 23
va_sM
(va_update_vec 22
va_sM
(va_update_vec 21
va_sM
(va_update_vec 20
va_sM
(va_update_vec 19
va_sM
(va_update_vec 18
va_sM
(va_update_vec 17
va_sM
(va_update_vec 16
va_sM
(va_update_vec 15
va_sM
(va_update_vec 14
va_sM
(va_update_vec 13
va_sM
(va_update_vec 12
va_sM
(va_update_vec 11
va_sM
(va_update_vec 10
va_sM
(va_update_vec 9
va_sM
(va_update_vec 8
va_sM
(va_update_vec 7
va_sM
(va_update_vec
6
va_sM
(va_update_vec
5
va_sM
(va_update_vec
4
va_sM
(va_update_vec
3
va_sM
(
va_update_vec
2
va_sM
(
va_update_vec
1
va_sM
(
va_update_vec
0
va_sM
(
va_update_reg
6
va_sM
(
va_update_reg
4
va_sM
(
va_update_ok
va_sM
va_s0
)
)
)
)
)
)
))
))))))))))
)))))))))))));
va_lemma_norm_mods ([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
LListReverse.fst | LListReverse.llist_nil | val llist_nil (p: ref llist_cell) : Tot vprop | val llist_nil (p: ref llist_cell) : Tot vprop | let llist_nil
(p: ref llist_cell)
: Tot vprop
= pure (p == null) | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 18,
"end_line": 20,
"start_col": 0,
"start_line": 17
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64
let main () = C.EXIT_SUCCESS // dummy for compilation
noeq
type llist_cell = {
value: U64.t;
next: ref llist_cell;
} | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | p: Steel.ST.Reference.ref LListReverse.llist_cell -> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.Reference.ref",
"LListReverse.llist_cell",
"Steel.ST.Util.pure",
"Prims.eq2",
"Steel.ST.Reference.null",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let llist_nil (p: ref llist_cell) : Tot vprop =
| pure (p == null) | false |
LListReverse.fst | LListReverse.main | val main : _: Prims.unit -> C.exit_code | let main () = C.EXIT_SUCCESS | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 28,
"end_line": 8,
"start_col": 0,
"start_line": 8
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64 | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | _: Prims.unit -> C.exit_code | Prims.Tot | [
"total"
] | [] | [
"Prims.unit",
"C.EXIT_SUCCESS",
"C.exit_code"
] | [] | false | false | false | true | false | let main () =
| C.EXIT_SUCCESS | false |
|
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_qcode_Loop_rounds_0_15 | val va_qcode_Loop_rounds_0_15
(va_mods: va_mods_t)
(in_b: buffer128)
(offset: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(input_BE: (seq quad32))
: (va_quickCode unit (va_code_Loop_rounds_0_15 ())) | val va_qcode_Loop_rounds_0_15
(va_mods: va_mods_t)
(in_b: buffer128)
(offset: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(input_BE: (seq quad32))
: (va_quickCode unit (va_code_Loop_rounds_0_15 ())) | let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (())))))))))))))))))))))) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 92,
"end_line": 109,
"start_col": 0,
"start_line": 57
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ()))))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_mods: Vale.PPC64LE.QuickCode.va_mods_t ->
in_b: Vale.PPC64LE.Memory.buffer128 ->
offset: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
input_BE: FStar.Seq.Base.seq Vale.PPC64LE.Memory.quad32
-> Vale.PPC64LE.QuickCode.va_quickCode Prims.unit
(Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_0_15 ()) | Prims.Tot | [
"total"
] | [] | [
"Vale.PPC64LE.QuickCode.va_mods_t",
"Vale.PPC64LE.Memory.buffer128",
"Prims.nat",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"FStar.Seq.Base.seq",
"Vale.PPC64LE.Memory.quad32",
"Vale.PPC64LE.QuickCodes.qblock",
"Prims.unit",
"Prims.Cons",
"Vale.PPC64LE.Decls.va_code",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_3_7_11_body",
"Vale.PPC64LE.Decls.va_op_vec_opr_vec",
"Vale.PPC64LE.Machine_s.Block",
"Vale.PPC64LE.Decls.ins",
"Vale.PPC64LE.Decls.ocmp",
"Prims.Nil",
"Vale.PPC64LE.Machine_s.precode",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_1_3",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_5_7",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_9_11",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_13_15",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_0_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_code_Loop_rounds_16_63_body",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.QuickCodes.va_qPURE",
"Prims.pure_post",
"Prims.l_and",
"Prims.eq2",
"Prims.int",
"FStar.Seq.Base.length",
"Vale.Def.Types_s.quad32",
"Prims.l_Forall",
"Prims.l_imp",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Prims.op_LessThan",
"Prims.op_LessThanOrEqual",
"Vale.Def.Words_s.nat32",
"Vale.Def.Words_s.__proj__Mkfour__item__hi3",
"FStar.Seq.Base.index",
"Vale.SHA.PPC64LE.SHA_helpers.ws_opaque",
"Vale.SHA.PPC64LE.SHA_helpers.quads_to_block_be",
"Prims.op_Addition",
"Prims.op_Multiply",
"Vale.Def.Words_s.__proj__Mkfour__item__hi2",
"Vale.Def.Words_s.__proj__Mkfour__item__lo1",
"Vale.Def.Words_s.__proj__Mkfour__item__lo0",
"Vale.PPC64LE.QuickCodes.va_range1",
"Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be",
"Vale.PPC64LE.QuickCodes.va_QSeq",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_3_7_11_body",
"Vale.PPC64LE.QuickCodes.va_QBind",
"Vale.PPC64LE.QuickCodes.va_qAssertSquash",
"Prims.squash",
"Vale.PPC64LE.QuickCodes.va_qAssert",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_1_3",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_a",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_5_7",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_b",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_9_11",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_c",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_13_15",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_0_59_d",
"Vale.SHA.PPC64LE.Rounds.Core.va_quick_Loop_rounds_16_63_body",
"Vale.PPC64LE.QuickCodes.va_QEmpty",
"Vale.PPC64LE.QuickCodes.quickCodes",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCode.va_quickCode",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_0_15"
] | [] | false | false | false | false | false | let va_qcode_Loop_rounds_0_15
(va_mods: va_mods_t)
(in_b: buffer128)
(offset: nat)
(k_b: buffer128)
(block: block_w)
(hash_orig: hash256)
(input_BE: (seq quad32))
: (va_quickCode unit (va_code_Loop_rounds_0_15 ())) =
| (qblock va_mods
(fun (va_s: va_state) ->
let va_old_s:va_state = va_s in
let va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32) = input_BE in
va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_: unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1))
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2))
(va_QBind va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3))
(fun (va_s: va_state) _ ->
va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540: (FStar.Seq.Base.seq a_539)) (i_541: Prims.nat) ->
let i_515:Prims.nat = i_541 in
Prims.b2t (Prims.op_LessThan i_515
(FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE
1)
(fun _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun
a_539
(s_540: (FStar.Seq.Base.seq a_539))
(i_541: Prims.nat)
->
let i_515:Prims.nat = i_541 in
Prims.b2t (Prims.op_LessThan i_515
(FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE
2)
(fun _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s ==
FStar.Seq.Base.index #quad32 input_BE 2)
(va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun
a_539
(s_540: (FStar.Seq.Base.seq a_539))
(i_541: Prims.nat)
->
let i_515:Prims.nat = i_541 in
Prims.b2t (Prims.op_LessThan i_515
(FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE
3)
(fun _ ->
va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s ==
FStar.Seq.Base.index #quad32 input_BE 3)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0
k_b
block
hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4
k_b
block
hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11
block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c
8
k_b
block
hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15
block)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d
12
k_b
block
hash_orig)
(va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body
16
(va_op_vec_opr_vec
0)
(va_op_vec_opr_vec
1)
(va_op_vec_opr_vec
9)
(va_op_vec_opr_vec
14
)
block)
(va_QEmpty
(())))
))))))))))))))))))
) | false |
CQueue.Cell.fst | CQueue.Cell.ralloc | val ralloc (#a: Type0) (x: a)
: Steel (ref a)
emp
(fun r -> vptr r)
(requires fun _ -> True)
(ensures fun _ r h1 -> h1 (vptr r) == x /\ not (is_null r)) | val ralloc (#a: Type0) (x: a)
: Steel (ref a)
emp
(fun r -> vptr r)
(requires fun _ -> True)
(ensures fun _ r h1 -> h1 (vptr r) == x /\ not (is_null r)) | let ralloc (#a:Type0) (x:a) : Steel (ref a)
emp (fun r -> vptr r)
(requires fun _ -> True)
(ensures fun _ r h1 -> h1 (vptr r) == x /\ not (is_null r))
=
malloc x | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 10,
"end_line": 191,
"start_col": 0,
"start_line": 186
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c
[@@ __steel_reduce__; __reduce__ ]
let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c
let ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1)
= hp_of (ccell_is_lvalue0 c)
let ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c))
= sel_of (ccell_is_lvalue0 c)
let intro_ccell_is_lvalue
#_ #a c
=
intro_vrefine emp (ccell_is_lvalue_refine c);
intro_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
change_slprop_rel
(ccell_is_lvalue0 c)
(ccell_is_lvalue c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
)
let elim_ccell_is_lvalue
#_ #a c
=
change_slprop_rel
(ccell_is_lvalue c)
(ccell_is_lvalue0 c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
);
elim_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
elim_vrefine emp (ccell_is_lvalue_refine c)
[@@ __steel_reduce__]
let ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop =
(vptr (ccell_data c) `star` vptr (ccell_next c))
// unfold
let ccell_rewrite
(#a: Type0)
(c: ccell_ptrvalue a)
(x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))
: GTot (vcell a)
= let p =
dsnd #(ccell_lvalue a) #(vdep_payload (ccell_is_lvalue c) (ccell0 a)) x
in
{
vcell_data = fst p;
vcell_next = snd p;
}
[@@ __steel_reduce__ ; __reduce__] // to avoid manual unfoldings through change_slprop
let ccell1
(#a: Type0)
(c: ccell_ptrvalue a)
: Tot vprop
= ccell_is_lvalue c `vdep` ccell0 a `vrewrite` ccell_rewrite c
let ccell_hp
#a c
= hp_of (ccell1 c)
let ccell_sel
#a c
= sel_of (ccell1 c)
let intro_ccell
#opened #a c
=
intro_ccell_is_lvalue c;
reveal_star (vptr (ccell_data c)) (vptr (ccell_next c));
intro_vdep
(ccell_is_lvalue c)
(vptr (ccell_data c) `star` vptr (ccell_next c))
(ccell0 a);
intro_vrewrite
(ccell_is_lvalue c `vdep` ccell0 a)
(ccell_rewrite c);
change_slprop_rel
(ccell1 c)
(ccell c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell1 c) == ccell_hp c);
assert_norm (sel_of (ccell1 c) m === sel_of (ccell c) m)
)
let elim_ccell_ghost
#opened #a c
=
change_slprop_rel
(ccell c)
(ccell1 c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell1 c) == ccell_hp c);
assert_norm (sel_of (ccell1 c) m === sel_of (ccell c) m)
);
elim_vrewrite
(ccell_is_lvalue c `vdep` ccell0 a)
(ccell_rewrite c);
let c' : Ghost.erased (ccell_lvalue a) = elim_vdep
(ccell_is_lvalue c)
(ccell0 a)
in
elim_ccell_is_lvalue c;
change_equal_slprop
(ccell0 a c')
(vptr (ccell_data (Ghost.reveal c')) `star` vptr (ccell_next (Ghost.reveal c')));
reveal_star (vptr (ccell_data (Ghost.reveal c'))) (vptr (ccell_next (Ghost.reveal c')));
c'
let elim_ccell
#opened #a c
=
let c2 = elim_ccell_ghost c in
let c : ccell_lvalue a = c in
change_equal_slprop (vptr (ccell_data c2)) (vptr (ccell_data c));
change_equal_slprop (vptr (ccell_next c2)) (vptr (ccell_next c));
return c
let ccell_not_null
#opened #a c
=
let c1 = elim_ccell_ghost c in
let c2 : ccell_lvalue a = c in
change_equal_slprop (vptr (ccell_data c1)) (vptr (ccell_data c2));
change_equal_slprop (vptr (ccell_next c1)) (vptr (ccell_next c2));
intro_ccell c2;
change_equal_slprop (ccell c2) (ccell c);
() | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 -> Steel.Effect.Steel (Steel.Reference.ref a) | Steel.Effect.Steel | [] | [] | [
"Steel.Reference.malloc",
"Steel.Reference.ref",
"Steel.Effect.Common.emp",
"Steel.Reference.vptr",
"Steel.Effect.Common.vprop",
"Steel.Effect.Common.rmem",
"Prims.l_True",
"Prims.l_and",
"Prims.eq2",
"Steel.Effect.Common.normal",
"Steel.Effect.Common.t_of",
"Prims.b2t",
"Prims.op_Negation",
"Steel.Reference.is_null"
] | [] | false | true | false | false | false | let ralloc (#a: Type0) (x: a)
: Steel (ref a)
emp
(fun r -> vptr r)
(requires fun _ -> True)
(ensures fun _ r h1 -> h1 (vptr r) == x /\ not (is_null r)) =
| malloc x | false |
Spec.SHA1.fst | Spec.SHA1.compute_w_n' | val compute_w_n'
(mi: Seq.lseq (word SHA1) (block_word_length SHA1))
(n: nat{n <= 79})
(w: (i: nat{i < n} -> Tot (y: word SHA1 {y == w' mi i})))
: Tot (y: word SHA1 {y == w' mi n}) | val compute_w_n'
(mi: Seq.lseq (word SHA1) (block_word_length SHA1))
(n: nat{n <= 79})
(w: (i: nat{i < n} -> Tot (y: word SHA1 {y == w' mi i})))
: Tot (y: word SHA1 {y == w' mi n}) | let compute_w_n'
(mi: Seq.lseq (word SHA1) (block_word_length SHA1))
(n: nat { n <= 79 } )
(w: ((i: nat {i < n}) -> Tot (y: word SHA1 {y == w' mi i})))
: Tot (y: word SHA1 {y == w' mi n})
= let r =
if n < 16
then Seq.index mi n
else (w (n - 3) ^. w (n - 8) ^. w (n - 14) ^. w (n - 16)) <<<. 1ul
in
r | {
"file_name": "specs/Spec.SHA1.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 3,
"end_line": 64,
"start_col": 0,
"start_line": 54
} | module Spec.SHA1
open Lib.IntTypes
module H = Spec.Hash.Definitions
module Seq = FStar.Seq
open Spec.Hash.Definitions
(* Source: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf *)
(* Section 5.3.1 *)
inline_for_extraction
let init_as_list : list uint32 = [
u32 0x67452301;
u32 0xefcdab89;
u32 0x98badcfe;
u32 0x10325476;
u32 0xc3d2e1f0;
]
let init : words_state SHA1 = Seq.seq_of_list init_as_list
(* Section 6.1.2 Step 1: message schedule *)
let rec w' (mi: Seq.lseq (word SHA1) (block_word_length SHA1)) (t: nat {t <= 79}) : GTot (word SHA1) (decreases (t)) =
if t < 16
then Seq.index mi (t)
else (w' mi (t - 3) ^. w' mi (t - 8) ^. w' mi (t - 14) ^. w' mi (t - 16)) <<<. 1ul
let w (mi: Seq.lseq (word SHA1) (block_word_length SHA1)) (t: size_t {v t <= 79}) : GTot (word SHA1) = w' mi (v t)
let compute_w_post
(mi: Seq.lseq (word SHA1) (block_word_length SHA1))
(n: nat)
(res: Seq.lseq (word SHA1) n)
: GTot Type0
= (n <= 80 /\ (
forall (i: nat) . i < n ==> Seq.index res i == w' mi i
))
let compute_w_post_intro
(mi: Seq.lseq (word SHA1) (block_word_length SHA1))
(n: nat)
(res: Seq.lseq (word SHA1) n)
(u: squash (n <= 80))
(f: (i: nat) -> Lemma
(requires (i < n))
(ensures (i < n /\ Seq.index res i == w' mi i)))
: Lemma
(compute_w_post mi n res)
= Classical.forall_intro (Classical.move_requires f) | {
"checked_file": "/",
"dependencies": [
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"prims.fst.checked",
"Lib.IntTypes.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": true,
"source_file": "Spec.SHA1.fst"
} | [
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "Spec.Hash.Definitions",
"short_module": "H"
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
mi:
FStar.Seq.Properties.lseq (Spec.Hash.Definitions.word Spec.Hash.Definitions.SHA1)
(Spec.Hash.Definitions.block_word_length Spec.Hash.Definitions.SHA1) ->
n: Prims.nat{n <= 79} ->
w:
(i: Prims.nat{i < n}
-> y: Spec.Hash.Definitions.word Spec.Hash.Definitions.SHA1 {y == Spec.SHA1.w' mi i})
-> y: Spec.Hash.Definitions.word Spec.Hash.Definitions.SHA1 {y == Spec.SHA1.w' mi n} | Prims.Tot | [
"total"
] | [] | [
"FStar.Seq.Properties.lseq",
"Spec.Hash.Definitions.word",
"Spec.Hash.Definitions.SHA1",
"Spec.Hash.Definitions.block_word_length",
"Prims.nat",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_LessThan",
"Prims.eq2",
"Spec.SHA1.w'",
"FStar.Seq.Base.index",
"Prims.bool",
"Lib.IntTypes.op_Less_Less_Less_Dot",
"Spec.Hash.Definitions.word_t",
"Lib.IntTypes.SEC",
"Lib.IntTypes.op_Hat_Dot",
"Prims.op_Subtraction",
"FStar.UInt32.__uint_to_t"
] | [] | false | false | false | false | false | let compute_w_n'
(mi: Seq.lseq (word SHA1) (block_word_length SHA1))
(n: nat{n <= 79})
(w: (i: nat{i < n} -> Tot (y: word SHA1 {y == w' mi i})))
: Tot (y: word SHA1 {y == w' mi n}) =
| let r =
if n < 16 then Seq.index mi n else (w (n - 3) ^. w (n - 8) ^. w (n - 14) ^. w (n - 16)) <<<. 1ul
in
r | false |
LListReverse.fst | LListReverse.llist_cons | val llist_cons (a: U64.t) (llist: (ref llist_cell -> Tot vprop)) (p: ref llist_cell) : Tot vprop | val llist_cons (a: U64.t) (llist: (ref llist_cell -> Tot vprop)) (p: ref llist_cell) : Tot vprop | let llist_cons
(a: U64.t)
(llist: (ref llist_cell -> Tot vprop))
(p: ref llist_cell)
: Tot vprop
= exists_ (fun c ->
pts_to p full_perm c `star`
pure (c.value == a) `star`
llist c.next
) | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 3,
"end_line": 32,
"start_col": 0,
"start_line": 23
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64
let main () = C.EXIT_SUCCESS // dummy for compilation
noeq
type llist_cell = {
value: U64.t;
next: ref llist_cell;
}
[@@__reduce__]
let llist_nil
(p: ref llist_cell)
: Tot vprop
= pure (p == null) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
a: FStar.UInt64.t ->
llist: (_: Steel.ST.Reference.ref LListReverse.llist_cell -> Steel.Effect.Common.vprop) ->
p: Steel.ST.Reference.ref LListReverse.llist_cell
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"FStar.UInt64.t",
"Steel.ST.Reference.ref",
"LListReverse.llist_cell",
"Steel.Effect.Common.vprop",
"Steel.ST.Util.exists_",
"Steel.Effect.Common.star",
"Steel.ST.Reference.pts_to",
"Steel.FractionalPermission.full_perm",
"Steel.ST.Util.pure",
"Prims.eq2",
"LListReverse.__proj__Mkllist_cell__item__value",
"LListReverse.__proj__Mkllist_cell__item__next"
] | [] | false | false | false | true | false | let llist_cons (a: U64.t) (llist: (ref llist_cell -> Tot vprop)) (p: ref llist_cell) : Tot vprop =
| exists_ (fun c -> ((pts_to p full_perm c) `star` (pure (c.value == a))) `star` (llist c.next)) | false |
LListReverse.fst | LListReverse.llist_reverse_invariant_prop | val llist_reverse_invariant_prop (l done todo: list U64.t) (cont: bool) : GTot prop | val llist_reverse_invariant_prop (l done todo: list U64.t) (cont: bool) : GTot prop | let llist_reverse_invariant_prop
(l: list U64.t)
(done todo: list U64.t)
(cont: bool)
: GTot prop
=
l == List.Tot.append (List.Tot.rev done) todo /\
cont == Cons? todo | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 22,
"end_line": 102,
"start_col": 0,
"start_line": 95
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64
let main () = C.EXIT_SUCCESS // dummy for compilation
noeq
type llist_cell = {
value: U64.t;
next: ref llist_cell;
}
[@@__reduce__]
let llist_nil
(p: ref llist_cell)
: Tot vprop
= pure (p == null)
[@@__reduce__]
let llist_cons
(a: U64.t)
(llist: (ref llist_cell -> Tot vprop))
(p: ref llist_cell)
: Tot vprop
= exists_ (fun c ->
pts_to p full_perm c `star`
pure (c.value == a) `star`
llist c.next
)
let rec llist
(l: Ghost.erased (list U64.t))
: Tot (ref llist_cell -> vprop)
(decreases Ghost.reveal l)
= match Ghost.reveal l with
| [] -> llist_nil
| a :: q -> llist_cons a (llist q)
let llist_nil_is_null
(#opened: _)
(l: Ghost.erased (list U64.t))
(p: ref llist_cell)
: STGhost unit opened
(llist l p)
(fun _ -> llist l p)
True
(fun _ -> (p == null <==> Nil? l))
= if Nil? l
then begin
rewrite (llist l p) (llist_nil p);
let _ = gen_elim () in
rewrite (llist_nil p) (llist l p)
end else begin
let a :: q = Ghost.reveal l in
rewrite (llist l p) (llist_cons a (llist q) p);
let _ = gen_elim () in
pts_to_not_null p;
rewrite (llist_cons a (llist q) p) (llist l p)
end
let pop
(#l: Ghost.erased (list U64.t))
(p: ref llist_cell { Cons? l })
: STT (ref llist_cell)
(llist l p)
(fun p' -> exists_ (fun x -> pts_to p full_perm x `star` llist (List.Tot.tl l) p' `star` pure (x.value == List.Tot.hd l)))
= rewrite (llist l p) (llist_cons (List.Tot.hd l) (llist (List.Tot.tl l)) p);
let _ = gen_elim () in
// let p' = (read p).next in // FIXME: "Effects STBase and Tot cannot be composed"
let x = read p in
let p' = x.next in
vpattern_rewrite (llist _) p';
return p'
let push
(#l': Ghost.erased (list U64.t))
(#x: Ghost.erased llist_cell)
(p: ref llist_cell)
(p': ref llist_cell)
: STT unit
(llist l' p' `star` pts_to p full_perm x)
(fun p' -> llist (x.value :: l') p)
=
// write p ({ read p with next = p' }); // weird Steel error
let x_ = read p in
write p ({ x_ with next = p' });
let x' = vpattern_replace (pts_to p full_perm) in
vpattern_rewrite (llist _) x'.next;
rewrite (llist_cons x.value (llist l') p) (llist (x.value :: l') p) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
l: Prims.list FStar.UInt64.t ->
done: Prims.list FStar.UInt64.t ->
todo: Prims.list FStar.UInt64.t ->
cont: Prims.bool
-> Prims.GTot Prims.prop | Prims.GTot | [
"sometrivial"
] | [] | [
"Prims.list",
"FStar.UInt64.t",
"Prims.bool",
"Prims.l_and",
"Prims.eq2",
"FStar.List.Tot.Base.append",
"FStar.List.Tot.Base.rev",
"Prims.uu___is_Cons",
"Prims.prop"
] | [] | false | false | false | false | true | let llist_reverse_invariant_prop (l done todo: list U64.t) (cont: bool) : GTot prop =
| l == List.Tot.append (List.Tot.rev done) todo /\ cont == Cons? todo | false |
LListReverse.fst | LListReverse.llist_reverse_invariant | val llist_reverse_invariant
(l: Ghost.erased (list U64.t))
(ppdone pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop | val llist_reverse_invariant
(l: Ghost.erased (list U64.t))
(ppdone pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop | let llist_reverse_invariant
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop
= llist_reverse_invariant0 l ppdone pptodo cont | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 47,
"end_line": 141,
"start_col": 0,
"start_line": 135
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64
let main () = C.EXIT_SUCCESS // dummy for compilation
noeq
type llist_cell = {
value: U64.t;
next: ref llist_cell;
}
[@@__reduce__]
let llist_nil
(p: ref llist_cell)
: Tot vprop
= pure (p == null)
[@@__reduce__]
let llist_cons
(a: U64.t)
(llist: (ref llist_cell -> Tot vprop))
(p: ref llist_cell)
: Tot vprop
= exists_ (fun c ->
pts_to p full_perm c `star`
pure (c.value == a) `star`
llist c.next
)
let rec llist
(l: Ghost.erased (list U64.t))
: Tot (ref llist_cell -> vprop)
(decreases Ghost.reveal l)
= match Ghost.reveal l with
| [] -> llist_nil
| a :: q -> llist_cons a (llist q)
let llist_nil_is_null
(#opened: _)
(l: Ghost.erased (list U64.t))
(p: ref llist_cell)
: STGhost unit opened
(llist l p)
(fun _ -> llist l p)
True
(fun _ -> (p == null <==> Nil? l))
= if Nil? l
then begin
rewrite (llist l p) (llist_nil p);
let _ = gen_elim () in
rewrite (llist_nil p) (llist l p)
end else begin
let a :: q = Ghost.reveal l in
rewrite (llist l p) (llist_cons a (llist q) p);
let _ = gen_elim () in
pts_to_not_null p;
rewrite (llist_cons a (llist q) p) (llist l p)
end
let pop
(#l: Ghost.erased (list U64.t))
(p: ref llist_cell { Cons? l })
: STT (ref llist_cell)
(llist l p)
(fun p' -> exists_ (fun x -> pts_to p full_perm x `star` llist (List.Tot.tl l) p' `star` pure (x.value == List.Tot.hd l)))
= rewrite (llist l p) (llist_cons (List.Tot.hd l) (llist (List.Tot.tl l)) p);
let _ = gen_elim () in
// let p' = (read p).next in // FIXME: "Effects STBase and Tot cannot be composed"
let x = read p in
let p' = x.next in
vpattern_rewrite (llist _) p';
return p'
let push
(#l': Ghost.erased (list U64.t))
(#x: Ghost.erased llist_cell)
(p: ref llist_cell)
(p': ref llist_cell)
: STT unit
(llist l' p' `star` pts_to p full_perm x)
(fun p' -> llist (x.value :: l') p)
=
// write p ({ read p with next = p' }); // weird Steel error
let x_ = read p in
write p ({ x_ with next = p' });
let x' = vpattern_replace (pts_to p full_perm) in
vpattern_rewrite (llist _) x'.next;
rewrite (llist_cons x.value (llist l') p) (llist (x.value :: l') p)
noextract
let llist_reverse_invariant_prop
(l: list U64.t)
(done todo: list U64.t)
(cont: bool)
: GTot prop
=
l == List.Tot.append (List.Tot.rev done) todo /\
cont == Cons? todo
[@@erasable]
noeq
type llist_reverse_invariant_t (l: list U64.t) (cont: bool) = {
pdone: ref llist_cell;
done: list U64.t;
ptodo: ref llist_cell;
todo: list U64.t;
prf: squash (llist_reverse_invariant_prop l done todo cont);
}
[@@__reduce__]
let llist_reverse_invariant_body
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: Tot vprop
= pts_to ppdone full_perm pdone `star` llist done pdone `star`
pts_to pptodo full_perm ptodo `star` llist todo ptodo
[@@__reduce__]
let llist_reverse_invariant0
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop
= exists_ (fun (x: llist_reverse_invariant_t l cont) -> llist_reverse_invariant_body ppdone pptodo x.pdone x.done x.ptodo x.todo) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
l: FStar.Ghost.erased (Prims.list FStar.UInt64.t) ->
ppdone: Steel.ST.Reference.ref (Steel.ST.Reference.ref LListReverse.llist_cell) ->
pptodo: Steel.ST.Reference.ref (Steel.ST.Reference.ref LListReverse.llist_cell) ->
cont: Prims.bool
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.erased",
"Prims.list",
"FStar.UInt64.t",
"Steel.ST.Reference.ref",
"LListReverse.llist_cell",
"Prims.bool",
"LListReverse.llist_reverse_invariant0",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let llist_reverse_invariant
(l: Ghost.erased (list U64.t))
(ppdone pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop =
| llist_reverse_invariant0 l ppdone pptodo cont | false |
LListReverse.fst | LListReverse.llist_reverse_invariant_body | val llist_reverse_invariant_body
(ppdone pptodo: ref (ref llist_cell))
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: Tot vprop | val llist_reverse_invariant_body
(ppdone pptodo: ref (ref llist_cell))
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: Tot vprop | let llist_reverse_invariant_body
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: Tot vprop
= pts_to ppdone full_perm pdone `star` llist done pdone `star`
pts_to pptodo full_perm ptodo `star` llist todo ptodo | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 55,
"end_line": 124,
"start_col": 0,
"start_line": 115
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64
let main () = C.EXIT_SUCCESS // dummy for compilation
noeq
type llist_cell = {
value: U64.t;
next: ref llist_cell;
}
[@@__reduce__]
let llist_nil
(p: ref llist_cell)
: Tot vprop
= pure (p == null)
[@@__reduce__]
let llist_cons
(a: U64.t)
(llist: (ref llist_cell -> Tot vprop))
(p: ref llist_cell)
: Tot vprop
= exists_ (fun c ->
pts_to p full_perm c `star`
pure (c.value == a) `star`
llist c.next
)
let rec llist
(l: Ghost.erased (list U64.t))
: Tot (ref llist_cell -> vprop)
(decreases Ghost.reveal l)
= match Ghost.reveal l with
| [] -> llist_nil
| a :: q -> llist_cons a (llist q)
let llist_nil_is_null
(#opened: _)
(l: Ghost.erased (list U64.t))
(p: ref llist_cell)
: STGhost unit opened
(llist l p)
(fun _ -> llist l p)
True
(fun _ -> (p == null <==> Nil? l))
= if Nil? l
then begin
rewrite (llist l p) (llist_nil p);
let _ = gen_elim () in
rewrite (llist_nil p) (llist l p)
end else begin
let a :: q = Ghost.reveal l in
rewrite (llist l p) (llist_cons a (llist q) p);
let _ = gen_elim () in
pts_to_not_null p;
rewrite (llist_cons a (llist q) p) (llist l p)
end
let pop
(#l: Ghost.erased (list U64.t))
(p: ref llist_cell { Cons? l })
: STT (ref llist_cell)
(llist l p)
(fun p' -> exists_ (fun x -> pts_to p full_perm x `star` llist (List.Tot.tl l) p' `star` pure (x.value == List.Tot.hd l)))
= rewrite (llist l p) (llist_cons (List.Tot.hd l) (llist (List.Tot.tl l)) p);
let _ = gen_elim () in
// let p' = (read p).next in // FIXME: "Effects STBase and Tot cannot be composed"
let x = read p in
let p' = x.next in
vpattern_rewrite (llist _) p';
return p'
let push
(#l': Ghost.erased (list U64.t))
(#x: Ghost.erased llist_cell)
(p: ref llist_cell)
(p': ref llist_cell)
: STT unit
(llist l' p' `star` pts_to p full_perm x)
(fun p' -> llist (x.value :: l') p)
=
// write p ({ read p with next = p' }); // weird Steel error
let x_ = read p in
write p ({ x_ with next = p' });
let x' = vpattern_replace (pts_to p full_perm) in
vpattern_rewrite (llist _) x'.next;
rewrite (llist_cons x.value (llist l') p) (llist (x.value :: l') p)
noextract
let llist_reverse_invariant_prop
(l: list U64.t)
(done todo: list U64.t)
(cont: bool)
: GTot prop
=
l == List.Tot.append (List.Tot.rev done) todo /\
cont == Cons? todo
[@@erasable]
noeq
type llist_reverse_invariant_t (l: list U64.t) (cont: bool) = {
pdone: ref llist_cell;
done: list U64.t;
ptodo: ref llist_cell;
todo: list U64.t;
prf: squash (llist_reverse_invariant_prop l done todo cont);
} | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
ppdone: Steel.ST.Reference.ref (Steel.ST.Reference.ref LListReverse.llist_cell) ->
pptodo: Steel.ST.Reference.ref (Steel.ST.Reference.ref LListReverse.llist_cell) ->
pdone: Steel.ST.Reference.ref LListReverse.llist_cell ->
done: FStar.Ghost.erased (Prims.list FStar.UInt64.t) ->
ptodo: Steel.ST.Reference.ref LListReverse.llist_cell ->
todo: FStar.Ghost.erased (Prims.list FStar.UInt64.t)
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.Reference.ref",
"LListReverse.llist_cell",
"FStar.Ghost.erased",
"Prims.list",
"FStar.UInt64.t",
"Steel.Effect.Common.star",
"Steel.ST.Reference.pts_to",
"Steel.FractionalPermission.full_perm",
"LListReverse.llist",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let llist_reverse_invariant_body
(ppdone pptodo: ref (ref llist_cell))
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: Tot vprop =
| (((pts_to ppdone full_perm pdone) `star` (llist done pdone)) `star` (pts_to pptodo full_perm ptodo))
`star`
(llist todo ptodo) | false |
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_wpProof_Loop_rounds_16_47 | val va_wpProof_Loop_rounds_16_47 : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_47 i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14;
va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
1; va_Mod_vec 0; va_Mod_reg 6]) va_s0 va_k ((va_sM, va_f0, va_g)))) | val va_wpProof_Loop_rounds_16_47 : i:nat -> k_b:buffer128 -> block:block_w -> hash_orig:hash256 ->
va_s0:va_state -> va_k:(va_state -> unit -> Type0)
-> Ghost (va_state & va_fuel & unit)
(requires (va_t_require va_s0 /\ va_wp_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k))
(ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Loop_rounds_16_47 i) ([va_Mod_vec 26;
va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;
va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14;
va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8;
va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec
1; va_Mod_vec 0; va_Mod_reg 6]) va_s0 va_k ((va_sM, va_f0, va_g)))) | let va_wpProof_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_47 (va_code_Loop_rounds_16_47 i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 22,
"end_line": 321,
"start_col": 0,
"start_line": 303
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_16_47
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_47 i =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a i) (va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4)) (va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8)) (va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12)) (va_CCons (va_code_Loop_rounds_0_59_d (i +
12)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_47 i =
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a i)
(va_codegen_success_Loop_rounds_16_59_a i)) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a i) (va_codegen_success_Loop_rounds_0_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_b (i + 4))
(va_codegen_success_Loop_rounds_16_59_b (i + 4))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b (i + 4)) (va_codegen_success_Loop_rounds_0_59_b (i +
4))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_c (i + 8))
(va_codegen_success_Loop_rounds_16_59_c (i + 8))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c (i + 8)) (va_codegen_success_Loop_rounds_0_59_c (i +
8))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_d (i + 12))
(va_codegen_success_Loop_rounds_16_59_d (i + 12))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_d (i + 12)) (va_codegen_success_Loop_rounds_0_59_d (i +
12))) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_47 (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 198 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a i k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b (i + 4) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b (i + 4) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c (i + 8) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c (i + 8) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_d (i + 12) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d (i + 12) k_b block hash_orig) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_47 va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_16_47 va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_47 i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 139 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 179 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label va_range1
"***** POSTCONDITION NOT MET AT line 189 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = repeat_range_vale (i + 16) block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == word_to_nat32 (index next_hash 0))
((va_get_vec 17 va_sM).hi3 == word_to_nat32 (index next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
word_to_nat32 (index next_hash 2))) ((va_get_vec 19 va_sM).hi3 == word_to_nat32 (index
next_hash 3))) ((va_get_vec 20 va_sM).hi3 == word_to_nat32 (index next_hash 4))) ((va_get_vec
21 va_sM).hi3 == word_to_nat32 (index next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
word_to_nat32 (index next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32 (word_to_nat32
(index next_hash 7)) (k_index ks (i + 16)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 195 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 16)) ((va_get_vec 1 va_sM).hi3
== ws_opaque block (i + 1))) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque
block (i + 4))) ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 5))) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 6))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 7)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 8))) ((va_get_vec 9 va_sM).hi3 == ws_opaque
block (i + 9))) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 10))) ((va_get_vec 11
va_sM).hi3 == ws_opaque block (i + 11))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
12))) ((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 13))) ((va_get_vec 14 va_sM).hi3 ==
ws_opaque block (i + 14))) ((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 15))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 196 column 98 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == k_index ks (i + 17)) ((va_get_vec 24 va_sM).hi2 ==
k_index ks (i + 18))) ((va_get_vec 24 va_sM).lo1 == k_index ks (i + 19)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
i: Prims.nat ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256 ->
va_s0: Vale.PPC64LE.Decls.va_state ->
va_k: (_: Vale.PPC64LE.Decls.va_state -> _: Prims.unit -> Type0)
-> Prims.Ghost ((Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) * Prims.unit) | Prims.Ghost | [] | [] | [
"Prims.nat",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.Decls.va_state",
"Prims.unit",
"Vale.PPC64LE.Decls.va_fuel",
"FStar.Pervasives.Native.Mktuple3",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Prims.Nil",
"Prims._assert",
"Vale.PPC64LE.Decls.va_state_eq",
"Vale.PPC64LE.Decls.va_update_vec",
"Vale.PPC64LE.Decls.va_update_reg",
"Vale.PPC64LE.Decls.va_update_ok",
"Vale.PPC64LE.Decls.va_lemma_upd_update",
"FStar.Pervasives.Native.tuple3",
"FStar.Pervasives.Native.tuple2",
"Vale.PPC64LE.Machine_s.state",
"Vale.SHA.PPC64LE.Rounds.va_lemma_Loop_rounds_16_47",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_16_47"
] | [] | false | false | false | false | false | let va_wpProof_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k =
| let va_sM, va_f0 =
va_lemma_Loop_rounds_16_47 (va_code_Loop_rounds_16_47 i) va_s0 i k_b block hash_orig
in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM
(va_update_vec 26
va_sM
(va_update_vec 25
va_sM
(va_update_vec 24
va_sM
(va_update_vec 23
va_sM
(va_update_vec 22
va_sM
(va_update_vec 21
va_sM
(va_update_vec 20
va_sM
(va_update_vec 19
va_sM
(va_update_vec 18
va_sM
(va_update_vec 17
va_sM
(va_update_vec 16
va_sM
(va_update_vec 15
va_sM
(va_update_vec 14
va_sM
(va_update_vec 13
va_sM
(va_update_vec 12
va_sM
(va_update_vec 11
va_sM
(va_update_vec 10
va_sM
(va_update_vec 9
va_sM
(va_update_vec 8
va_sM
(va_update_vec 7
va_sM
(va_update_vec
6
va_sM
(va_update_vec
5
va_sM
(va_update_vec
4
va_sM
(va_update_vec
3
va_sM
(
va_update_vec
2
va_sM
(
va_update_vec
1
va_sM
(
va_update_vec
0
va_sM
(
va_update_reg
6
va_sM
(
va_update_ok
va_sM
va_s0
)
)
)
)
)
))
))))))))))
)))))))))))));
va_lemma_norm_mods ([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6
])
va_sM
va_s0;
let va_g = () in
(va_sM, va_f0, va_g) | false |
Steel.ST.HigherReference.fst | Steel.ST.HigherReference.ref | val ref ([@@@ strictly_positive] a:Type u#1)
: Type0 | val ref ([@@@ strictly_positive] a:Type u#1)
: Type0 | let ref (a:Type u#1)
: Type0
= R.ref a | {
"file_name": "lib/steel/Steel.ST.HigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 11,
"end_line": 25,
"start_col": 0,
"start_line": 23
} | (*
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.HigherReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.HigherReference | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.HigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Steel.HigherReference.ref"
] | [] | false | false | false | true | true | let ref (a: Type u#1) : Type0 =
| R.ref a | false |
Steel.ST.HigherReference.fst | Steel.ST.HigherReference.null | val null (#a:Type)
: ref a | val null (#a:Type)
: ref a | let null (#a:Type)
: ref a
= R.null #a | {
"file_name": "lib/steel/Steel.ST.HigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 13,
"end_line": 29,
"start_col": 0,
"start_line": 27
} | (*
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.HigherReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.HigherReference
let ref (a:Type u#1)
: Type0
= R.ref a | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.HigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | Steel.ST.HigherReference.ref a | Prims.Tot | [
"total"
] | [] | [
"Steel.HigherReference.null",
"Steel.ST.HigherReference.ref"
] | [] | false | false | false | true | false | let null (#a: Type) : ref a =
| R.null #a | false |
Steel.ST.HigherReference.fst | Steel.ST.HigherReference.pts_to | val pts_to (#a:Type)
(r:ref a)
([@@@smt_fallback] p:perm)
([@@@smt_fallback] v:a)
: vprop | val pts_to (#a:Type)
(r:ref a)
([@@@smt_fallback] p:perm)
([@@@smt_fallback] v:a)
: vprop | let pts_to (#a:Type)
(r:ref a)
([@@@smt_fallback] p:perm)
([@@@smt_fallback] v:a)
: vprop
= R.pts_to r p v | {
"file_name": "lib/steel/Steel.ST.HigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 18,
"end_line": 40,
"start_col": 0,
"start_line": 35
} | (*
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.HigherReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.HigherReference
let ref (a:Type u#1)
: Type0
= R.ref a
let null (#a:Type)
: ref a
= R.null #a
let is_null (#a:Type) (r:ref a)
: b:bool{b <==> r == null}
= R.is_null r | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.HigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | r: Steel.ST.HigherReference.ref a -> p: Steel.FractionalPermission.perm -> v: a
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.HigherReference.ref",
"Steel.FractionalPermission.perm",
"Steel.HigherReference.pts_to",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let pts_to (#a: Type) (r: ref a) ([@@@ smt_fallback]p: perm) ([@@@ smt_fallback]v: a) : vprop =
| R.pts_to r p v | false |
LListReverse.fst | LListReverse.llist_reverse_invariant0 | val llist_reverse_invariant0
(l: Ghost.erased (list U64.t))
(ppdone pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop | val llist_reverse_invariant0
(l: Ghost.erased (list U64.t))
(ppdone pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop | let llist_reverse_invariant0
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop
= exists_ (fun (x: llist_reverse_invariant_t l cont) -> llist_reverse_invariant_body ppdone pptodo x.pdone x.done x.ptodo x.todo) | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 129,
"end_line": 133,
"start_col": 0,
"start_line": 127
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64
let main () = C.EXIT_SUCCESS // dummy for compilation
noeq
type llist_cell = {
value: U64.t;
next: ref llist_cell;
}
[@@__reduce__]
let llist_nil
(p: ref llist_cell)
: Tot vprop
= pure (p == null)
[@@__reduce__]
let llist_cons
(a: U64.t)
(llist: (ref llist_cell -> Tot vprop))
(p: ref llist_cell)
: Tot vprop
= exists_ (fun c ->
pts_to p full_perm c `star`
pure (c.value == a) `star`
llist c.next
)
let rec llist
(l: Ghost.erased (list U64.t))
: Tot (ref llist_cell -> vprop)
(decreases Ghost.reveal l)
= match Ghost.reveal l with
| [] -> llist_nil
| a :: q -> llist_cons a (llist q)
let llist_nil_is_null
(#opened: _)
(l: Ghost.erased (list U64.t))
(p: ref llist_cell)
: STGhost unit opened
(llist l p)
(fun _ -> llist l p)
True
(fun _ -> (p == null <==> Nil? l))
= if Nil? l
then begin
rewrite (llist l p) (llist_nil p);
let _ = gen_elim () in
rewrite (llist_nil p) (llist l p)
end else begin
let a :: q = Ghost.reveal l in
rewrite (llist l p) (llist_cons a (llist q) p);
let _ = gen_elim () in
pts_to_not_null p;
rewrite (llist_cons a (llist q) p) (llist l p)
end
let pop
(#l: Ghost.erased (list U64.t))
(p: ref llist_cell { Cons? l })
: STT (ref llist_cell)
(llist l p)
(fun p' -> exists_ (fun x -> pts_to p full_perm x `star` llist (List.Tot.tl l) p' `star` pure (x.value == List.Tot.hd l)))
= rewrite (llist l p) (llist_cons (List.Tot.hd l) (llist (List.Tot.tl l)) p);
let _ = gen_elim () in
// let p' = (read p).next in // FIXME: "Effects STBase and Tot cannot be composed"
let x = read p in
let p' = x.next in
vpattern_rewrite (llist _) p';
return p'
let push
(#l': Ghost.erased (list U64.t))
(#x: Ghost.erased llist_cell)
(p: ref llist_cell)
(p': ref llist_cell)
: STT unit
(llist l' p' `star` pts_to p full_perm x)
(fun p' -> llist (x.value :: l') p)
=
// write p ({ read p with next = p' }); // weird Steel error
let x_ = read p in
write p ({ x_ with next = p' });
let x' = vpattern_replace (pts_to p full_perm) in
vpattern_rewrite (llist _) x'.next;
rewrite (llist_cons x.value (llist l') p) (llist (x.value :: l') p)
noextract
let llist_reverse_invariant_prop
(l: list U64.t)
(done todo: list U64.t)
(cont: bool)
: GTot prop
=
l == List.Tot.append (List.Tot.rev done) todo /\
cont == Cons? todo
[@@erasable]
noeq
type llist_reverse_invariant_t (l: list U64.t) (cont: bool) = {
pdone: ref llist_cell;
done: list U64.t;
ptodo: ref llist_cell;
todo: list U64.t;
prf: squash (llist_reverse_invariant_prop l done todo cont);
}
[@@__reduce__]
let llist_reverse_invariant_body
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: Tot vprop
= pts_to ppdone full_perm pdone `star` llist done pdone `star`
pts_to pptodo full_perm ptodo `star` llist todo ptodo | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
l: FStar.Ghost.erased (Prims.list FStar.UInt64.t) ->
ppdone: Steel.ST.Reference.ref (Steel.ST.Reference.ref LListReverse.llist_cell) ->
pptodo: Steel.ST.Reference.ref (Steel.ST.Reference.ref LListReverse.llist_cell) ->
cont: Prims.bool
-> Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"FStar.Ghost.erased",
"Prims.list",
"FStar.UInt64.t",
"Steel.ST.Reference.ref",
"LListReverse.llist_cell",
"Prims.bool",
"Steel.ST.Util.exists_",
"LListReverse.llist_reverse_invariant_t",
"FStar.Ghost.reveal",
"LListReverse.llist_reverse_invariant_body",
"LListReverse.__proj__Mkllist_reverse_invariant_t__item__pdone",
"FStar.Ghost.hide",
"LListReverse.__proj__Mkllist_reverse_invariant_t__item__done",
"LListReverse.__proj__Mkllist_reverse_invariant_t__item__ptodo",
"LListReverse.__proj__Mkllist_reverse_invariant_t__item__todo",
"Steel.Effect.Common.vprop"
] | [] | false | false | false | true | false | let llist_reverse_invariant0
(l: Ghost.erased (list U64.t))
(ppdone pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop =
| exists_ (fun (x: llist_reverse_invariant_t l cont) ->
llist_reverse_invariant_body ppdone pptodo x.pdone x.done x.ptodo x.todo) | false |
Steel.ST.HigherReference.fst | Steel.ST.HigherReference._stack_frame | val _stack_frame:vprop | val _stack_frame:vprop | let _stack_frame : vprop = pure True | {
"file_name": "lib/steel/Steel.ST.HigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 36,
"end_line": 103,
"start_col": 0,
"start_line": 103
} | (*
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.HigherReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.HigherReference
let ref (a:Type u#1)
: Type0
= R.ref a
let null (#a:Type)
: ref a
= R.null #a
let is_null (#a:Type) (r:ref a)
: b:bool{b <==> r == null}
= R.is_null r
let pts_to (#a:Type)
(r:ref a)
([@@@smt_fallback] p:perm)
([@@@smt_fallback] v:a)
: vprop
= R.pts_to r p v
let pts_to_injective_eq
(#a: Type)
(#opened:inames)
(#p0 #p1:perm)
(#v0 #v1:a)
(r: ref a)
: STGhost unit opened
(pts_to r p0 v0 `star` pts_to r p1 v1)
(fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)
(requires True)
(ensures fun _ -> v0 == v1)
= coerce_ghost
(fun _ -> R.higher_ref_pts_to_injective_eq #a #opened #p0 #p1 #(hide v0) #(hide v1) r)
let pts_to_not_null #a #opened #p #v r
= extract_fact #opened (pts_to r p v) (r =!= null) (R.pts_to_not_null r p v);
()
let alloc (#a:Type) (x:a)
: ST (ref a)
emp
(fun r -> pts_to r full_perm x)
(requires True)
(ensures fun r -> not (is_null r))
= let r = coerce_steel (fun _ -> R.alloc x) in
r
let read (#a:Type)
(#p:perm)
(#v:erased a)
(r:ref a)
: ST a
(pts_to r p v)
(fun _ -> pts_to r p v)
(requires True)
(ensures fun x -> x == Ghost.reveal v)
= let u = coerce_steel (fun _ -> R.read r) in
return u
let write (#a:Type)
(#v:erased a)
(r:ref a)
(x:a)
: STT unit
(pts_to r full_perm v)
(fun _ -> pts_to r full_perm x)
= coerce_steel (fun _ -> R.write r x);
return ()
let free (#a:Type)
(#v:erased a)
(r:ref a)
: STT unit
(pts_to r full_perm v)
(fun _ -> emp)
= coerce_steel(fun _ -> R.free r);
return ()
/// Local primitive, to be extracted to Low* EPushFrame. To remember
/// that we need to call some pop_frame later, we insert some dummy | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.HigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | Steel.Effect.Common.vprop | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.Util.pure",
"Prims.l_True"
] | [] | false | false | false | true | false | let _stack_frame:vprop =
| pure True | false |
NormLHS.fst | NormLHS.tau | val tau : _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit | let tau () = norm_lhs [delta; hnf; weak]; trefl () | {
"file_name": "examples/tactics/NormLHS.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 50,
"end_line": 21,
"start_col": 0,
"start_line": 21
} | module NormLHS
open FStar.Tactics.V2
private
let trans (#t:Type) (b a c : t)
(_ : squash (a == b))
(_ : squash (b == c)) : squash (a == c) = ()
let norm_lhs steps : Tac unit =
match cur_formula () with
| Comp (Eq _) lhs _ ->
let lhs' = norm_term steps lhs in
apply_lemma (`trans (`#lhs'));
trefl ()
| _ ->
fail "not an eq"
type unit_t = unit | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "NormLHS.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": 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 -> FStar.Tactics.Effect.Tac Prims.unit | FStar.Tactics.Effect.Tac | [] | [] | [
"Prims.unit",
"FStar.Tactics.V2.Derived.trefl",
"NormLHS.norm_lhs",
"Prims.Cons",
"FStar.Pervasives.norm_step",
"FStar.Pervasives.delta",
"FStar.Pervasives.hnf",
"FStar.Pervasives.weak",
"Prims.Nil"
] | [] | false | true | false | false | false | let tau () =
| norm_lhs [delta; hnf; weak];
trefl () | false |
|
NormLHS.fst | NormLHS.test | val test : Prims.eqtype | let test = unit_t | {
"file_name": "examples/tactics/NormLHS.fst",
"git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3",
"git_url": "https://github.com/FStarLang/FStar.git",
"project_name": "FStar"
} | {
"end_col": 17,
"end_line": 24,
"start_col": 0,
"start_line": 24
} | module NormLHS
open FStar.Tactics.V2
private
let trans (#t:Type) (b a c : t)
(_ : squash (a == b))
(_ : squash (b == c)) : squash (a == c) = ()
let norm_lhs steps : Tac unit =
match cur_formula () with
| Comp (Eq _) lhs _ ->
let lhs' = norm_term steps lhs in
apply_lemma (`trans (`#lhs'));
trefl ()
| _ ->
fail "not an eq"
type unit_t = unit
let tau () = norm_lhs [delta; hnf; weak]; trefl () | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Tactics.V2.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": false,
"source_file": "NormLHS.fst"
} | [
{
"abbrev": false,
"full_module": "FStar.Tactics.V2",
"short_module": null
},
{
"abbrev": 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"
] | [] | [
"Prims.unit"
] | [] | false | false | false | true | false | let test =
| unit_t | false |
|
CBOR.Spec.fsti | CBOR.Spec.serialize_cbor_inj' | val serialize_cbor_inj' (c1: raw_data_item) (s1: Seq.seq U8.t)
: Lemma
(forall c2 s2.
(serialize_cbor c1) `Seq.append` s1 == (serialize_cbor c2) `Seq.append` s2 ==>
(c1 == c2 /\ s1 == s2)) | val serialize_cbor_inj' (c1: raw_data_item) (s1: Seq.seq U8.t)
: Lemma
(forall c2 s2.
(serialize_cbor c1) `Seq.append` s1 == (serialize_cbor c2) `Seq.append` s2 ==>
(c1 == c2 /\ s1 == s2)) | let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 3,
"end_line": 42,
"start_col": 0,
"start_line": 35
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | c1: CBOR.Spec.Type.raw_data_item -> s1: FStar.Seq.Base.seq FStar.UInt8.t
-> FStar.Pervasives.Lemma
(ensures
forall (c2: CBOR.Spec.Type.raw_data_item) (s2: FStar.Seq.Base.seq FStar.UInt8.t).
FStar.Seq.Base.append (CBOR.Spec.serialize_cbor c1) s1 ==
FStar.Seq.Base.append (CBOR.Spec.serialize_cbor c2) s2 ==>
c1 == c2 /\ s1 == s2) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"CBOR.Spec.Type.raw_data_item",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"FStar.Classical.forall_intro_2",
"Prims.l_imp",
"Prims.eq2",
"FStar.Seq.Base.append",
"CBOR.Spec.serialize_cbor",
"Prims.l_and",
"FStar.Classical.move_requires",
"CBOR.Spec.serialize_cbor_inj",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.l_Forall",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let serialize_cbor_inj' (c1: raw_data_item) (s1: Seq.seq U8.t)
: Lemma
(forall c2 s2.
(serialize_cbor c1) `Seq.append` s1 == (serialize_cbor c2) `Seq.append` s2 ==>
(c1 == c2 /\ s1 == s2)) =
| Classical.forall_intro_2 (fun c2 s2 -> Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2) | false |
CBOR.Spec.fsti | CBOR.Spec.int_compare | val int_compare (x1 x2: int) : Tot int | val int_compare (x1 x2: int) : Tot int | let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1 | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 8,
"end_line": 112,
"start_col": 0,
"start_line": 107
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | x1: Prims.int -> x2: Prims.int -> Prims.int | Prims.Tot | [
"total"
] | [] | [
"Prims.int",
"Prims.op_LessThan",
"Prims.op_Minus",
"Prims.bool",
"Prims.op_Equality"
] | [] | false | false | false | true | false | let int_compare (x1 x2: int) : Tot int =
| if x1 < x2 then - 1 else if x1 = x2 then 0 else 1 | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.parse_ifthenelse_payload_kind | val parse_ifthenelse_payload_kind (p: parse_ifthenelse_param) : Tot parser_kind | val parse_ifthenelse_payload_kind (p: parse_ifthenelse_param) : Tot parser_kind | let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false)) | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 102,
"end_line": 33,
"start_col": 0,
"start_line": 30
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: LowParse.Spec.IfThenElse.parse_ifthenelse_param -> LowParse.Spec.Base.parser_kind | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.Base.glb",
"FStar.Pervasives.dfst",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser"
] | [] | false | false | false | true | false | let parse_ifthenelse_payload_kind (p: parse_ifthenelse_param) : Tot parser_kind =
| glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false)) | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.parse_ifthenelse_kind | val parse_ifthenelse_kind (p: parse_ifthenelse_param) : Tot parser_kind | val parse_ifthenelse_kind (p: parse_ifthenelse_param) : Tot parser_kind | let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p) | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 77,
"end_line": 39,
"start_col": 0,
"start_line": 36
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: LowParse.Spec.IfThenElse.parse_ifthenelse_param -> LowParse.Spec.Base.parser_kind | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.Combinators.and_then_kind",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_kind",
"LowParse.Spec.IfThenElse.parse_ifthenelse_payload_kind",
"LowParse.Spec.Base.parser_kind"
] | [] | false | false | false | true | false | let parse_ifthenelse_kind (p: parse_ifthenelse_param) : Tot parser_kind =
| and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p) | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.bare_serialize_ifthenelse | val bare_serialize_ifthenelse (#p: parse_ifthenelse_param) (s: serialize_ifthenelse_param p)
: Tot (bare_serializer p.parse_ifthenelse_t) | val bare_serialize_ifthenelse (#p: parse_ifthenelse_param) (s: serialize_ifthenelse_param p)
: Tot (bare_serializer p.parse_ifthenelse_t) | let bare_serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
: Tot (bare_serializer p.parse_ifthenelse_t)
= fun (d: p.parse_ifthenelse_t) ->
let (| t, y |) = s.serialize_ifthenelse_synth_recip d in
Seq.append (serialize s.serialize_ifthenelse_tag_serializer t) (serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y) | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 154,
"end_line": 112,
"start_col": 0,
"start_line": 106
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p)
let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2)
let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
weaken (parse_ifthenelse_payload_kind p) (parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) (p.parse_ifthenelse_synth t))
let parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param) : Lemma
(and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))]
= and_then_cases_injective_intro
(parse_ifthenelse_payload p)
(fun t1 t2 b1 b2 ->
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) (p.parse_ifthenelse_synth t1) b1;
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) (p.parse_ifthenelse_synth t2) b2;
let Some (x1, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) b1 in
let Some (x2, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) b2 in
p.parse_ifthenelse_synth_injective t1 x1 t2 x2
)
let parse_ifthenelse (p: parse_ifthenelse_param) : Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) =
and_then p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p)
let parse_ifthenelse_eq
(p: parse_ifthenelse_param)
(input: bytes)
: Lemma
(parse (parse_ifthenelse p) input == (
match parse p.parse_ifthenelse_tag_parser input with
| None -> None
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
match parse (dsnd (p.parse_ifthenelse_payload_parser b)) input' with
| None -> None
| Some (x, consumed_x) -> Some (p.parse_ifthenelse_synth t x, consumed_t + consumed_x)
))
= and_then_eq p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) input;
match parse p.parse_ifthenelse_tag_parser input with
| None -> ()
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
let f : (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t) -> GTot p.parse_ifthenelse_t) = (p.parse_ifthenelse_synth) t in
let f' = coerce (p.parse_ifthenelse_payload_t b -> GTot p.parse_ifthenelse_t) f in
parse_synth_eq
#(dfst (p.parse_ifthenelse_payload_parser b))
#(p.parse_ifthenelse_payload_t b)
#(p.parse_ifthenelse_t)
(dsnd (p.parse_ifthenelse_payload_parser b)) f' input'
noextract
inline_for_extraction
noeq
type serialize_ifthenelse_param (p: parse_ifthenelse_param) = {
serialize_ifthenelse_tag_serializer: serializer p.parse_ifthenelse_tag_parser;
serialize_ifthenelse_payload_serializer: ((b: bool) -> Tot (serializer (dsnd (p.parse_ifthenelse_payload_parser b))));
serialize_ifthenelse_synth_recip: (p.parse_ifthenelse_t -> GTot ( t: p.parse_ifthenelse_tag_t & (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t))));
serialize_ifthenelse_synth_inverse: (
(x: p.parse_ifthenelse_t) ->
Lemma
(let (| t, y |) = serialize_ifthenelse_synth_recip x in
p.parse_ifthenelse_synth t y == x)
);
} | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: LowParse.Spec.IfThenElse.serialize_ifthenelse_param p
-> LowParse.Spec.Base.bare_serializer (Mkparse_ifthenelse_param?.parse_ifthenelse_t p) | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.IfThenElse.serialize_ifthenelse_param",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"FStar.Seq.Base.append",
"LowParse.Bytes.byte",
"LowParse.Spec.Base.serialize",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_kind",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_parser",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_tag_serializer",
"Prims.__proj__Mkdtuple2__item___1",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser",
"FStar.Pervasives.dsnd",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_payload_serializer",
"LowParse.Bytes.bytes",
"Prims.dtuple2",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_synth_recip",
"LowParse.Spec.Base.bare_serializer"
] | [] | false | false | false | false | false | let bare_serialize_ifthenelse (#p: parse_ifthenelse_param) (s: serialize_ifthenelse_param p)
: Tot (bare_serializer p.parse_ifthenelse_t) =
| fun (d: p.parse_ifthenelse_t) ->
let (| t , y |) = s.serialize_ifthenelse_synth_recip d in
Seq.append (serialize s.serialize_ifthenelse_tag_serializer t)
(serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y) | false |
CBOR.Spec.fsti | CBOR.Spec.serialize_cbor_with_test_correct | val serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma (requires (~(p c suff)))
(ensures
(forall (c': raw_data_item) (suff': Seq.seq U8.t).
(serialize_cbor c) `Seq.append` suff == (serialize_cbor c') `Seq.append` suff' ==>
~(p c' suff'))) | val serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma (requires (~(p c suff)))
(ensures
(forall (c': raw_data_item) (suff': Seq.seq U8.t).
(serialize_cbor c) `Seq.append` suff == (serialize_cbor c') `Seq.append` suff' ==>
~(p c' suff'))) | let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 3,
"end_line": 58,
"start_col": 0,
"start_line": 44
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 |
c: CBOR.Spec.Type.raw_data_item ->
suff: FStar.Seq.Base.seq FStar.UInt8.t ->
p: (_: CBOR.Spec.Type.raw_data_item -> _: FStar.Seq.Base.seq FStar.UInt8.t -> Prims.prop)
-> FStar.Pervasives.Lemma (requires ~(p c suff))
(ensures
forall (c': CBOR.Spec.Type.raw_data_item) (suff': FStar.Seq.Base.seq FStar.UInt8.t).
FStar.Seq.Base.append (CBOR.Spec.serialize_cbor c) suff ==
FStar.Seq.Base.append (CBOR.Spec.serialize_cbor c') suff' ==>
~(p c' suff')) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"CBOR.Spec.Type.raw_data_item",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.prop",
"FStar.Classical.forall_intro_2",
"Prims.l_imp",
"Prims.eq2",
"FStar.Seq.Base.append",
"CBOR.Spec.serialize_cbor",
"Prims.l_and",
"FStar.Classical.move_requires",
"CBOR.Spec.serialize_cbor_inj",
"Prims.unit",
"Prims.l_not",
"Prims.squash",
"Prims.l_Forall",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma (requires (~(p c suff)))
(ensures
(forall (c': raw_data_item) (suff': Seq.seq U8.t).
(serialize_cbor c) `Seq.append` suff == (serialize_cbor c') `Seq.append` suff' ==>
~(p c' suff'))) =
| Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff') | false |
LListReverse.fst | LListReverse.llist | val llist (l: Ghost.erased (list U64.t)) : Tot (ref llist_cell -> vprop) (decreases Ghost.reveal l) | val llist (l: Ghost.erased (list U64.t)) : Tot (ref llist_cell -> vprop) (decreases Ghost.reveal l) | let rec llist
(l: Ghost.erased (list U64.t))
: Tot (ref llist_cell -> vprop)
(decreases Ghost.reveal l)
= match Ghost.reveal l with
| [] -> llist_nil
| a :: q -> llist_cons a (llist q) | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 36,
"end_line": 40,
"start_col": 0,
"start_line": 34
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64
let main () = C.EXIT_SUCCESS // dummy for compilation
noeq
type llist_cell = {
value: U64.t;
next: ref llist_cell;
}
[@@__reduce__]
let llist_nil
(p: ref llist_cell)
: Tot vprop
= pure (p == null)
[@@__reduce__]
let llist_cons
(a: U64.t)
(llist: (ref llist_cell -> Tot vprop))
(p: ref llist_cell)
: Tot vprop
= exists_ (fun c ->
pts_to p full_perm c `star`
pure (c.value == a) `star`
llist c.next
) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l: FStar.Ghost.erased (Prims.list FStar.UInt64.t)
-> Prims.Tot (_: Steel.ST.Reference.ref LListReverse.llist_cell -> Steel.Effect.Common.vprop) | Prims.Tot | [
"total",
""
] | [] | [
"FStar.Ghost.erased",
"Prims.list",
"FStar.UInt64.t",
"FStar.Ghost.reveal",
"LListReverse.llist_nil",
"LListReverse.llist_cons",
"LListReverse.llist",
"FStar.Ghost.hide",
"Steel.ST.Reference.ref",
"LListReverse.llist_cell",
"Steel.Effect.Common.vprop"
] | [
"recursion"
] | false | false | false | false | false | let rec llist (l: Ghost.erased (list U64.t))
: Tot (ref llist_cell -> vprop) (decreases Ghost.reveal l) =
| match Ghost.reveal l with
| [] -> llist_nil
| a :: q -> llist_cons a (llist q) | false |
CBOR.Spec.fsti | CBOR.Spec.list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats | val list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l)
) (ensures (List.Tot.no_repeats_p (List.Tot.map fst l))) | val list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l)
) (ensures (List.Tot.no_repeats_p (List.Tot.map fst l))) | let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 87,
"end_line": 100,
"start_col": 0,
"start_line": 94
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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: Prims.list (CBOR.Spec.Type.raw_data_item * t)
-> FStar.Pervasives.Lemma
(requires
FStar.List.Tot.Properties.sorted (CBOR.Spec.Type.map_entry_order (FStar.Ghost.reveal CBOR.Spec.deterministically_encoded_cbor_map_key_order
)
t)
l)
(ensures
FStar.List.Tot.Base.no_repeats_p (FStar.List.Tot.Base.map FStar.Pervasives.Native.fst l)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"CBOR.Spec.Type.raw_data_item",
"CBOR.Spec.Map.list_sorted_map_entry_order_no_repeats",
"FStar.Ghost.reveal",
"Prims.bool",
"CBOR.Spec.deterministically_encoded_cbor_map_key_order",
"Prims.unit",
"Prims.b2t",
"FStar.List.Tot.Properties.sorted",
"CBOR.Spec.Type.map_entry_order",
"Prims.squash",
"FStar.List.Tot.Base.no_repeats_p",
"FStar.List.Tot.Base.map",
"FStar.Pervasives.Native.fst",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l)
) (ensures (List.Tot.no_repeats_p (List.Tot.map fst l))) =
| list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l | false |
Steel.ST.HigherReference.fst | Steel.ST.HigherReference.is_null | val is_null (#a:Type) (r:ref a)
: b:bool{b <==> r == null} | val is_null (#a:Type) (r:ref a)
: b:bool{b <==> r == null} | let is_null (#a:Type) (r:ref a)
: b:bool{b <==> r == null}
= R.is_null r | {
"file_name": "lib/steel/Steel.ST.HigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 15,
"end_line": 33,
"start_col": 0,
"start_line": 31
} | (*
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.HigherReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.HigherReference
let ref (a:Type u#1)
: Type0
= R.ref a
let null (#a:Type)
: ref a
= R.null #a | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.HigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | r: Steel.ST.HigherReference.ref a -> b: Prims.bool{b <==> r == Steel.ST.HigherReference.null} | Prims.Tot | [
"total"
] | [] | [
"Steel.ST.HigherReference.ref",
"Steel.HigherReference.is_null",
"Prims.bool",
"Prims.l_iff",
"Prims.b2t",
"Prims.eq2",
"Steel.ST.HigherReference.null"
] | [] | false | false | false | false | false | let is_null (#a: Type) (r: ref a) : b: bool{b <==> r == null} =
| R.is_null r | false |
CBOR.Spec.fsti | CBOR.Spec.bytes_lex_compare | val bytes_lex_compare (s1 s2: Seq.seq U8.t) : Tot int (decreases (Seq.length s1)) | val bytes_lex_compare (s1 s2: Seq.seq U8.t) : Tot int (decreases (Seq.length s1)) | let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 10,
"end_line": 125,
"start_col": 0,
"start_line": 115
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | s1: FStar.Seq.Base.seq FStar.UInt8.t -> s2: FStar.Seq.Base.seq FStar.UInt8.t -> Prims.Tot Prims.int | Prims.Tot | [
"total",
""
] | [] | [
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.op_BarBar",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"CBOR.Spec.int_compare",
"Prims.bool",
"CBOR.Spec.bytes_lex_compare",
"FStar.Seq.Properties.tail",
"FStar.UInt8.v",
"FStar.Seq.Base.index"
] | [
"recursion"
] | false | false | false | true | false | let rec bytes_lex_compare (s1 s2: Seq.seq U8.t) : Tot int (decreases (Seq.length s1)) =
| if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0 then bytes_lex_compare (Seq.tail s1) (Seq.tail s2) else c | false |
CBOR.Spec.fsti | CBOR.Spec.bytes_lex_compare_opp | val bytes_lex_compare_opp (s1 s2: Seq.seq U8.t)
: Lemma (ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2)) | val bytes_lex_compare_opp (s1 s2: Seq.seq U8.t)
: Lemma (ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2)) | let rec bytes_lex_compare_opp
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 56,
"end_line": 134,
"start_col": 0,
"start_line": 127
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1
noextract [@@noextract_to "krml"]
let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | s1: FStar.Seq.Base.seq FStar.UInt8.t -> s2: FStar.Seq.Base.seq FStar.UInt8.t
-> FStar.Pervasives.Lemma
(ensures CBOR.Spec.bytes_lex_compare s1 s2 == - CBOR.Spec.bytes_lex_compare s2 s1)
(decreases FStar.Seq.Base.length s1 + FStar.Seq.Base.length s2) | FStar.Pervasives.Lemma | [
"lemma",
""
] | [] | [
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.op_BarBar",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.bool",
"CBOR.Spec.bytes_lex_compare_opp",
"FStar.Seq.Properties.tail",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"CBOR.Spec.bytes_lex_compare",
"Prims.op_Minus",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [
"recursion"
] | false | false | true | false | false | let rec bytes_lex_compare_opp (s1 s2: Seq.seq U8.t)
: Lemma (ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2)) =
| if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2) | false |
CBOR.Spec.fsti | CBOR.Spec.bytes_lex_compare_values | val bytes_lex_compare_values (s1 s2: Seq.seq U8.t)
: Lemma
(ensures
(let c = bytes_lex_compare s1 s2 in
c == - 1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)] | val bytes_lex_compare_values (s1 s2: Seq.seq U8.t)
: Lemma
(ensures
(let c = bytes_lex_compare s1 s2 in
c == - 1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)] | let rec bytes_lex_compare_values
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (let c = bytes_lex_compare s1 s2 in
c == -1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)]
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_values (Seq.tail s1) (Seq.tail s2) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 59,
"end_line": 145,
"start_col": 0,
"start_line": 136
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1
noextract [@@noextract_to "krml"]
let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c
let rec bytes_lex_compare_opp
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | s1: FStar.Seq.Base.seq FStar.UInt8.t -> s2: FStar.Seq.Base.seq FStar.UInt8.t
-> FStar.Pervasives.Lemma
(ensures
(let c = CBOR.Spec.bytes_lex_compare s1 s2 in
c == - 1 \/ c == 0 \/ c == 1))
(decreases FStar.Seq.Base.length s1)
[SMTPat (CBOR.Spec.bytes_lex_compare s1 s2)] | FStar.Pervasives.Lemma | [
"lemma",
""
] | [] | [
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.op_BarBar",
"Prims.op_Equality",
"Prims.int",
"FStar.Seq.Base.length",
"Prims.bool",
"CBOR.Spec.bytes_lex_compare_values",
"FStar.Seq.Properties.tail",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.l_or",
"Prims.eq2",
"Prims.op_Minus",
"CBOR.Spec.bytes_lex_compare",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [
"recursion"
] | false | false | true | false | false | let rec bytes_lex_compare_values (s1 s2: Seq.seq U8.t)
: Lemma
(ensures
(let c = bytes_lex_compare s1 s2 in
c == - 1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)] =
| if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_values (Seq.tail s1) (Seq.tail s2) | false |
LList32.fst | LList32.peek | val peek: #l: G.erased (list u32) -> ll: llist -> squash (Cons? l)
-> ST u32
(ll `is_list` l)
(fun _ -> ll `is_list` l)
(requires True)
(ensures fun x -> x == Cons?.hd l) | val peek: #l: G.erased (list u32) -> ll: llist -> squash (Cons? l)
-> ST u32
(ll `is_list` l)
(fun _ -> ll `is_list` l)
(requires True)
(ensures fun x -> x == Cons?.hd l) | let peek (#l:G.erased (list u32)) (ll:llist) (_:squash (Cons? l))
: ST u32
(ll `is_list` l)
(fun _ -> ll `is_list` l)
(requires True)
(ensures fun x -> x == Cons?.hd l)
= peek ll () | {
"file_name": "share/steel/examples/steel/LList32.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 14,
"end_line": 54,
"start_col": 0,
"start_line": 48
} | (*
Copyright 2021 Microsoft Research
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: Aseem Rastogi
*)
module LList32
open Steel.Memory
open Steel.ST.Effect
open Steel.ST.Util
open LList.ST
module G = FStar.Ghost
/// Monomorphization of LList.ST for UInt32
#set-options "--ide_id_info_off"
type u32 = FStar.UInt32.t
inline_for_extraction
let llist_node = llist_node u32
inline_for_extraction
let llist = llist u32
let is_list (ll:llist) (l:list u32) = is_list ll l
let cons (#l:G.erased (list u32)) (x:u32) (ll:llist)
: STT llist
(ll `is_list` l)
(fun ll -> ll `is_list` (x::l))
= cons x ll | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Effect.fsti.checked",
"Steel.Memory.fsti.checked",
"prims.fst.checked",
"LList.ST.fsti.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "LList32.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Ghost",
"short_module": "G"
},
{
"abbrev": false,
"full_module": "LList.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": 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 | ll: LList32.llist -> _: Prims.squash (Cons? (FStar.Ghost.reveal l))
-> Steel.ST.Effect.ST LList32.u32 | Steel.ST.Effect.ST | [] | [] | [
"FStar.Ghost.erased",
"Prims.list",
"LList32.u32",
"LList32.llist",
"Prims.squash",
"Prims.b2t",
"Prims.uu___is_Cons",
"FStar.Ghost.reveal",
"LList.ST.peek",
"LList32.is_list",
"Steel.Effect.Common.vprop",
"Prims.l_True",
"Prims.eq2",
"Prims.__proj__Cons__item__hd"
] | [] | false | true | false | false | false | let peek (#l: G.erased (list u32)) (ll: llist) (_: squash (Cons? l))
: ST u32
(ll `is_list` l)
(fun _ -> ll `is_list` l)
(requires True)
(ensures fun x -> x == Cons?.hd l) =
| peek ll () | false |
CBOR.Spec.fsti | CBOR.Spec.deterministically_encoded_cbor_map_key_order_major_type_intro | val deterministically_encoded_cbor_map_key_order_major_type_intro (v1 v2: raw_data_item)
: Lemma (requires (U8.v (get_major_type v1) < U8.v (get_major_type v2)))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order v1 v2 == true)) | val deterministically_encoded_cbor_map_key_order_major_type_intro (v1 v2: raw_data_item)
: Lemma (requires (U8.v (get_major_type v1) < U8.v (get_major_type v2)))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order v1 v2 == true)) | let deterministically_encoded_cbor_map_key_order_major_type_intro
(v1 v2: raw_data_item)
: Lemma
(requires (
U8.v (get_major_type v1) < U8.v (get_major_type v2)
))
(ensures (
Ghost.reveal deterministically_encoded_cbor_map_key_order v1 v2 == true
))
= deterministically_encoded_cbor_map_key_order_spec v1 v2;
cbor_compare_correct v1 v2 | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 28,
"end_line": 254,
"start_col": 0,
"start_line": 244
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1
noextract [@@noextract_to "krml"]
let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c
let rec bytes_lex_compare_opp
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2)
let rec bytes_lex_compare_values
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (let c = bytes_lex_compare s1 s2 in
c == -1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)]
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_values (Seq.tail s1) (Seq.tail s2)
val bytes_lex_compare_equal
(s1 s2: Seq.seq U8.t)
: Lemma
(bytes_lex_compare s1 s2 == 0 <==> s1 == s2)
val deterministically_encoded_cbor_map_key_order_spec
(x1 x2: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x1 x2 == (bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2) < 0))
noextract [@@noextract_to "krml"]
let rec cbor_compare
(x1 x2: raw_data_item)
: Tot int
(decreases x1)
= let ty1 = get_major_type x1 in
let ty2 = get_major_type x2 in
let c = int_compare (U8.v ty1) (U8.v ty2) in
if c <> 0
then c
else if ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64
then int_compare (U64.v (Int64?.v x1)) (U64.v (Int64?.v x2))
else if ty1 = cbor_major_type_simple_value
then int_compare (U8.v (Simple?.v x1)) (U8.v (Simple?.v x2))
else if ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string
then
let c = int_compare (Seq.length (String?.v x1)) (Seq.length (String?.v x2)) in
if c <> 0
then c
else bytes_lex_compare (String?.v x1) (String?.v x2)
else if ty1 = cbor_major_type_tagged
then
let c = int_compare (U64.v (Tagged?.tag x1)) (U64.v (Tagged?.tag x2)) in
if c <> 0
then c
else cbor_compare (Tagged?.v x1) (Tagged?.v x2)
else if ty1 = cbor_major_type_array
then
let c = int_compare (List.Tot.length (Array?.v x1)) (List.Tot.length (Array?.v x2)) in
if c <> 0
then c
else cbor_compare_array (Array?.v x1) (Array?.v x2)
else if ty1 = cbor_major_type_map
then
let c = int_compare (List.Tot.length (Map?.v x1)) (List.Tot.length (Map?.v x2)) in
if c <> 0
then c
else cbor_compare_map (Map?.v x1) (Map?.v x2)
else false_elim ()
and cbor_compare_array
(x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare a1 a2 in
if c <> 0
then c
else cbor_compare_array q1 q2
and cbor_compare_map
(x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare (fst a1) (fst a2) in
if c <> 0
then c
else
let c = cbor_compare (snd a1) (snd a2) in
if c <> 0
then c
else cbor_compare_map q1 q2
val cbor_compare_correct
(x1 x2: raw_data_item)
: Lemma
(ensures (cbor_compare x1 x2 == bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2)))
let cbor_compare_equal
(x1 x2: raw_data_item)
: Lemma
(cbor_compare x1 x2 == 0 <==> x1 == x2)
= cbor_compare_correct x1 x2;
bytes_lex_compare_equal (serialize_cbor x1) (serialize_cbor x2);
Seq.append_empty_r (serialize_cbor x1);
Seq.append_empty_r (serialize_cbor x2);
Classical.move_requires (serialize_cbor_inj x1 x2 Seq.empty) Seq.empty | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | v1: CBOR.Spec.Type.raw_data_item -> v2: CBOR.Spec.Type.raw_data_item
-> FStar.Pervasives.Lemma
(requires
FStar.UInt8.v (CBOR.Spec.Type.get_major_type v1) <
FStar.UInt8.v (CBOR.Spec.Type.get_major_type v2))
(ensures
FStar.Ghost.reveal CBOR.Spec.deterministically_encoded_cbor_map_key_order v1 v2 == true) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"CBOR.Spec.Type.raw_data_item",
"CBOR.Spec.cbor_compare_correct",
"Prims.unit",
"CBOR.Spec.deterministically_encoded_cbor_map_key_order_spec",
"Prims.b2t",
"Prims.op_LessThan",
"FStar.UInt8.v",
"CBOR.Spec.Type.get_major_type",
"Prims.squash",
"Prims.eq2",
"Prims.bool",
"FStar.Ghost.reveal",
"CBOR.Spec.deterministically_encoded_cbor_map_key_order",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let deterministically_encoded_cbor_map_key_order_major_type_intro (v1 v2: raw_data_item)
: Lemma (requires (U8.v (get_major_type v1) < U8.v (get_major_type v2)))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order v1 v2 == true)) =
| deterministically_encoded_cbor_map_key_order_spec v1 v2;
cbor_compare_correct v1 v2 | false |
CBOR.Spec.fsti | CBOR.Spec.cbor_compare_equal | val cbor_compare_equal (x1 x2: raw_data_item) : Lemma (cbor_compare x1 x2 == 0 <==> x1 == x2) | val cbor_compare_equal (x1 x2: raw_data_item) : Lemma (cbor_compare x1 x2 == 0 <==> x1 == x2) | let cbor_compare_equal
(x1 x2: raw_data_item)
: Lemma
(cbor_compare x1 x2 == 0 <==> x1 == x2)
= cbor_compare_correct x1 x2;
bytes_lex_compare_equal (serialize_cbor x1) (serialize_cbor x2);
Seq.append_empty_r (serialize_cbor x1);
Seq.append_empty_r (serialize_cbor x2);
Classical.move_requires (serialize_cbor_inj x1 x2 Seq.empty) Seq.empty | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 72,
"end_line": 242,
"start_col": 0,
"start_line": 234
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1
noextract [@@noextract_to "krml"]
let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c
let rec bytes_lex_compare_opp
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2)
let rec bytes_lex_compare_values
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (let c = bytes_lex_compare s1 s2 in
c == -1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)]
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_values (Seq.tail s1) (Seq.tail s2)
val bytes_lex_compare_equal
(s1 s2: Seq.seq U8.t)
: Lemma
(bytes_lex_compare s1 s2 == 0 <==> s1 == s2)
val deterministically_encoded_cbor_map_key_order_spec
(x1 x2: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x1 x2 == (bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2) < 0))
noextract [@@noextract_to "krml"]
let rec cbor_compare
(x1 x2: raw_data_item)
: Tot int
(decreases x1)
= let ty1 = get_major_type x1 in
let ty2 = get_major_type x2 in
let c = int_compare (U8.v ty1) (U8.v ty2) in
if c <> 0
then c
else if ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64
then int_compare (U64.v (Int64?.v x1)) (U64.v (Int64?.v x2))
else if ty1 = cbor_major_type_simple_value
then int_compare (U8.v (Simple?.v x1)) (U8.v (Simple?.v x2))
else if ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string
then
let c = int_compare (Seq.length (String?.v x1)) (Seq.length (String?.v x2)) in
if c <> 0
then c
else bytes_lex_compare (String?.v x1) (String?.v x2)
else if ty1 = cbor_major_type_tagged
then
let c = int_compare (U64.v (Tagged?.tag x1)) (U64.v (Tagged?.tag x2)) in
if c <> 0
then c
else cbor_compare (Tagged?.v x1) (Tagged?.v x2)
else if ty1 = cbor_major_type_array
then
let c = int_compare (List.Tot.length (Array?.v x1)) (List.Tot.length (Array?.v x2)) in
if c <> 0
then c
else cbor_compare_array (Array?.v x1) (Array?.v x2)
else if ty1 = cbor_major_type_map
then
let c = int_compare (List.Tot.length (Map?.v x1)) (List.Tot.length (Map?.v x2)) in
if c <> 0
then c
else cbor_compare_map (Map?.v x1) (Map?.v x2)
else false_elim ()
and cbor_compare_array
(x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare a1 a2 in
if c <> 0
then c
else cbor_compare_array q1 q2
and cbor_compare_map
(x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare (fst a1) (fst a2) in
if c <> 0
then c
else
let c = cbor_compare (snd a1) (snd a2) in
if c <> 0
then c
else cbor_compare_map q1 q2
val cbor_compare_correct
(x1 x2: raw_data_item)
: Lemma
(ensures (cbor_compare x1 x2 == bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2))) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | x1: CBOR.Spec.Type.raw_data_item -> x2: CBOR.Spec.Type.raw_data_item
-> FStar.Pervasives.Lemma (ensures CBOR.Spec.cbor_compare x1 x2 == 0 <==> x1 == x2) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"CBOR.Spec.Type.raw_data_item",
"FStar.Classical.move_requires",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.eq2",
"FStar.Seq.Base.append",
"CBOR.Spec.serialize_cbor",
"FStar.Seq.Base.empty",
"Prims.l_and",
"CBOR.Spec.serialize_cbor_inj",
"Prims.unit",
"FStar.Seq.Base.append_empty_r",
"CBOR.Spec.bytes_lex_compare_equal",
"CBOR.Spec.cbor_compare_correct",
"Prims.l_True",
"Prims.squash",
"Prims.l_iff",
"Prims.int",
"CBOR.Spec.cbor_compare",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let cbor_compare_equal (x1 x2: raw_data_item) : Lemma (cbor_compare x1 x2 == 0 <==> x1 == x2) =
| cbor_compare_correct x1 x2;
bytes_lex_compare_equal (serialize_cbor x1) (serialize_cbor x2);
Seq.append_empty_r (serialize_cbor x1);
Seq.append_empty_r (serialize_cbor x2);
Classical.move_requires (serialize_cbor_inj x1 x2 Seq.empty) Seq.empty | false |
CBOR.Spec.fsti | CBOR.Spec.deterministically_encoded_cbor_map_key_order_int64 | val deterministically_encoded_cbor_map_key_order_int64
(ty: major_type_uint64_or_neg_int64)
(v1 v2: U64.t)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2) ==
U64.lt v1 v2)
[
SMTPat
(Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2))
] | val deterministically_encoded_cbor_map_key_order_int64
(ty: major_type_uint64_or_neg_int64)
(v1 v2: U64.t)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2) ==
U64.lt v1 v2)
[
SMTPat
(Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2))
] | let deterministically_encoded_cbor_map_key_order_int64
(ty: major_type_uint64_or_neg_int64)
(v1 v2: U64.t)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2) == U64.lt v1 v2)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2))]
= deterministically_encoded_cbor_map_key_order_spec (Int64 ty v1) (Int64 ty v2);
cbor_compare_correct (Int64 ty v1) (Int64 ty v2) | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 50,
"end_line": 263,
"start_col": 0,
"start_line": 256
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1
noextract [@@noextract_to "krml"]
let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c
let rec bytes_lex_compare_opp
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2)
let rec bytes_lex_compare_values
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (let c = bytes_lex_compare s1 s2 in
c == -1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)]
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_values (Seq.tail s1) (Seq.tail s2)
val bytes_lex_compare_equal
(s1 s2: Seq.seq U8.t)
: Lemma
(bytes_lex_compare s1 s2 == 0 <==> s1 == s2)
val deterministically_encoded_cbor_map_key_order_spec
(x1 x2: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x1 x2 == (bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2) < 0))
noextract [@@noextract_to "krml"]
let rec cbor_compare
(x1 x2: raw_data_item)
: Tot int
(decreases x1)
= let ty1 = get_major_type x1 in
let ty2 = get_major_type x2 in
let c = int_compare (U8.v ty1) (U8.v ty2) in
if c <> 0
then c
else if ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64
then int_compare (U64.v (Int64?.v x1)) (U64.v (Int64?.v x2))
else if ty1 = cbor_major_type_simple_value
then int_compare (U8.v (Simple?.v x1)) (U8.v (Simple?.v x2))
else if ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string
then
let c = int_compare (Seq.length (String?.v x1)) (Seq.length (String?.v x2)) in
if c <> 0
then c
else bytes_lex_compare (String?.v x1) (String?.v x2)
else if ty1 = cbor_major_type_tagged
then
let c = int_compare (U64.v (Tagged?.tag x1)) (U64.v (Tagged?.tag x2)) in
if c <> 0
then c
else cbor_compare (Tagged?.v x1) (Tagged?.v x2)
else if ty1 = cbor_major_type_array
then
let c = int_compare (List.Tot.length (Array?.v x1)) (List.Tot.length (Array?.v x2)) in
if c <> 0
then c
else cbor_compare_array (Array?.v x1) (Array?.v x2)
else if ty1 = cbor_major_type_map
then
let c = int_compare (List.Tot.length (Map?.v x1)) (List.Tot.length (Map?.v x2)) in
if c <> 0
then c
else cbor_compare_map (Map?.v x1) (Map?.v x2)
else false_elim ()
and cbor_compare_array
(x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare a1 a2 in
if c <> 0
then c
else cbor_compare_array q1 q2
and cbor_compare_map
(x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare (fst a1) (fst a2) in
if c <> 0
then c
else
let c = cbor_compare (snd a1) (snd a2) in
if c <> 0
then c
else cbor_compare_map q1 q2
val cbor_compare_correct
(x1 x2: raw_data_item)
: Lemma
(ensures (cbor_compare x1 x2 == bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2)))
let cbor_compare_equal
(x1 x2: raw_data_item)
: Lemma
(cbor_compare x1 x2 == 0 <==> x1 == x2)
= cbor_compare_correct x1 x2;
bytes_lex_compare_equal (serialize_cbor x1) (serialize_cbor x2);
Seq.append_empty_r (serialize_cbor x1);
Seq.append_empty_r (serialize_cbor x2);
Classical.move_requires (serialize_cbor_inj x1 x2 Seq.empty) Seq.empty
let deterministically_encoded_cbor_map_key_order_major_type_intro
(v1 v2: raw_data_item)
: Lemma
(requires (
U8.v (get_major_type v1) < U8.v (get_major_type v2)
))
(ensures (
Ghost.reveal deterministically_encoded_cbor_map_key_order v1 v2 == true
))
= deterministically_encoded_cbor_map_key_order_spec v1 v2;
cbor_compare_correct v1 v2 | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | ty: CBOR.Spec.Constants.major_type_uint64_or_neg_int64 -> v1: FStar.UInt64.t -> v2: FStar.UInt64.t
-> FStar.Pervasives.Lemma
(ensures
FStar.Ghost.reveal CBOR.Spec.deterministically_encoded_cbor_map_key_order
(CBOR.Spec.Type.Int64 ty v1)
(CBOR.Spec.Type.Int64 ty v2) ==
FStar.UInt64.lt v1 v2)
[
SMTPat (FStar.Ghost.reveal CBOR.Spec.deterministically_encoded_cbor_map_key_order
(CBOR.Spec.Type.Int64 ty v1)
(CBOR.Spec.Type.Int64 ty v2))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"CBOR.Spec.Constants.major_type_uint64_or_neg_int64",
"FStar.UInt64.t",
"CBOR.Spec.cbor_compare_correct",
"CBOR.Spec.Type.Int64",
"Prims.unit",
"CBOR.Spec.deterministically_encoded_cbor_map_key_order_spec",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.bool",
"FStar.Ghost.reveal",
"CBOR.Spec.Type.raw_data_item",
"CBOR.Spec.deterministically_encoded_cbor_map_key_order",
"FStar.UInt64.lt",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | true | false | true | false | false | let deterministically_encoded_cbor_map_key_order_int64
(ty: major_type_uint64_or_neg_int64)
(v1 v2: U64.t)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2) ==
U64.lt v1 v2)
[
SMTPat
(Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2))
] =
| deterministically_encoded_cbor_map_key_order_spec (Int64 ty v1) (Int64 ty v2);
cbor_compare_correct (Int64 ty v1) (Int64 ty v2) | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.parse_ifthenelse_payload | val parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t)
: Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) | val parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t)
: Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) | let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
weaken (parse_ifthenelse_payload_kind p) (parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) (p.parse_ifthenelse_synth t)) | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 160,
"end_line": 45,
"start_col": 0,
"start_line": 44
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p)
let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: LowParse.Spec.IfThenElse.parse_ifthenelse_param ->
t: Mkparse_ifthenelse_param?.parse_ifthenelse_tag_t p
-> LowParse.Spec.Base.parser (LowParse.Spec.IfThenElse.parse_ifthenelse_payload_kind p)
(Mkparse_ifthenelse_param?.parse_ifthenelse_t p) | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.Base.weaken",
"LowParse.Spec.IfThenElse.parse_ifthenelse_payload_kind",
"Prims.__proj__Mkdtuple2__item___1",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.Combinators.parse_synth",
"FStar.Pervasives.dsnd",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_synth"
] | [] | false | false | false | false | false | let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t)
: Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
| weaken (parse_ifthenelse_payload_kind p)
(parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t)))
(p.parse_ifthenelse_synth t)) | false |
LListReverse.fst | LListReverse.list_rev_transfer | val list_rev_transfer (ll: list U64.t) (x: U64.t) (lr: list U64.t)
: Lemma
(List.Tot.append (List.Tot.rev ll) (x :: lr) == List.Tot.append (List.Tot.rev (x :: ll)) lr) | val list_rev_transfer (ll: list U64.t) (x: U64.t) (lr: list U64.t)
: Lemma
(List.Tot.append (List.Tot.rev ll) (x :: lr) == List.Tot.append (List.Tot.rev (x :: ll)) lr) | let list_rev_transfer
(ll: list U64.t) (x: U64.t) (lr: list U64.t)
: Lemma
(List.Tot.append (List.Tot.rev ll) (x :: lr) == List.Tot.append (List.Tot.rev (x :: ll)) lr)
= List.Tot.rev_rev' (x :: ll);
List.Tot.rev_rev' ll;
List.Tot.append_assoc (List.Tot.rev ll) [x] lr | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 48,
"end_line": 191,
"start_col": 0,
"start_line": 185
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64
let main () = C.EXIT_SUCCESS // dummy for compilation
noeq
type llist_cell = {
value: U64.t;
next: ref llist_cell;
}
[@@__reduce__]
let llist_nil
(p: ref llist_cell)
: Tot vprop
= pure (p == null)
[@@__reduce__]
let llist_cons
(a: U64.t)
(llist: (ref llist_cell -> Tot vprop))
(p: ref llist_cell)
: Tot vprop
= exists_ (fun c ->
pts_to p full_perm c `star`
pure (c.value == a) `star`
llist c.next
)
let rec llist
(l: Ghost.erased (list U64.t))
: Tot (ref llist_cell -> vprop)
(decreases Ghost.reveal l)
= match Ghost.reveal l with
| [] -> llist_nil
| a :: q -> llist_cons a (llist q)
let llist_nil_is_null
(#opened: _)
(l: Ghost.erased (list U64.t))
(p: ref llist_cell)
: STGhost unit opened
(llist l p)
(fun _ -> llist l p)
True
(fun _ -> (p == null <==> Nil? l))
= if Nil? l
then begin
rewrite (llist l p) (llist_nil p);
let _ = gen_elim () in
rewrite (llist_nil p) (llist l p)
end else begin
let a :: q = Ghost.reveal l in
rewrite (llist l p) (llist_cons a (llist q) p);
let _ = gen_elim () in
pts_to_not_null p;
rewrite (llist_cons a (llist q) p) (llist l p)
end
let pop
(#l: Ghost.erased (list U64.t))
(p: ref llist_cell { Cons? l })
: STT (ref llist_cell)
(llist l p)
(fun p' -> exists_ (fun x -> pts_to p full_perm x `star` llist (List.Tot.tl l) p' `star` pure (x.value == List.Tot.hd l)))
= rewrite (llist l p) (llist_cons (List.Tot.hd l) (llist (List.Tot.tl l)) p);
let _ = gen_elim () in
// let p' = (read p).next in // FIXME: "Effects STBase and Tot cannot be composed"
let x = read p in
let p' = x.next in
vpattern_rewrite (llist _) p';
return p'
let push
(#l': Ghost.erased (list U64.t))
(#x: Ghost.erased llist_cell)
(p: ref llist_cell)
(p': ref llist_cell)
: STT unit
(llist l' p' `star` pts_to p full_perm x)
(fun p' -> llist (x.value :: l') p)
=
// write p ({ read p with next = p' }); // weird Steel error
let x_ = read p in
write p ({ x_ with next = p' });
let x' = vpattern_replace (pts_to p full_perm) in
vpattern_rewrite (llist _) x'.next;
rewrite (llist_cons x.value (llist l') p) (llist (x.value :: l') p)
noextract
let llist_reverse_invariant_prop
(l: list U64.t)
(done todo: list U64.t)
(cont: bool)
: GTot prop
=
l == List.Tot.append (List.Tot.rev done) todo /\
cont == Cons? todo
[@@erasable]
noeq
type llist_reverse_invariant_t (l: list U64.t) (cont: bool) = {
pdone: ref llist_cell;
done: list U64.t;
ptodo: ref llist_cell;
todo: list U64.t;
prf: squash (llist_reverse_invariant_prop l done todo cont);
}
[@@__reduce__]
let llist_reverse_invariant_body
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: Tot vprop
= pts_to ppdone full_perm pdone `star` llist done pdone `star`
pts_to pptodo full_perm ptodo `star` llist todo ptodo
[@@__reduce__]
let llist_reverse_invariant0
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop
= exists_ (fun (x: llist_reverse_invariant_t l cont) -> llist_reverse_invariant_body ppdone pptodo x.pdone x.done x.ptodo x.todo)
let llist_reverse_invariant
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop
= llist_reverse_invariant0 l ppdone pptodo cont
let intro_llist_reverse_invariant
(#opened: _)
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: STGhost unit opened
(llist_reverse_invariant_body ppdone pptodo pdone done ptodo todo)
(fun _ -> llist_reverse_invariant l ppdone pptodo cont)
(llist_reverse_invariant_prop l done todo cont)
(fun _ -> True)
= let x : llist_reverse_invariant_t l cont = {
pdone = pdone;
done = done;
ptodo = ptodo;
todo = todo;
prf = ();
}
in
rewrite
(llist_reverse_invariant_body ppdone pptodo pdone done ptodo todo)
(llist_reverse_invariant_body ppdone pptodo x.pdone x.done x.ptodo x.todo);
rewrite
(llist_reverse_invariant0 l ppdone pptodo cont)
(llist_reverse_invariant l ppdone pptodo cont)
let elim_llist_reverse_invariant
(#opened: _)
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
: STGhostT (llist_reverse_invariant_t l cont) opened
(llist_reverse_invariant l ppdone pptodo cont)
(fun x -> llist_reverse_invariant_body ppdone pptodo x.pdone x.done x.ptodo x.todo)
= let x = elim_exists () in
x | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | ll: Prims.list FStar.UInt64.t -> x: FStar.UInt64.t -> lr: Prims.list FStar.UInt64.t
-> FStar.Pervasives.Lemma
(ensures FStar.List.Tot.Base.rev ll @ x :: lr == FStar.List.Tot.Base.rev (x :: ll) @ lr) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.UInt64.t",
"FStar.List.Tot.Properties.append_assoc",
"FStar.List.Tot.Base.rev",
"Prims.Cons",
"Prims.Nil",
"Prims.unit",
"FStar.List.Tot.Properties.rev_rev'",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.List.Tot.Base.append",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let list_rev_transfer (ll: list U64.t) (x: U64.t) (lr: list U64.t)
: Lemma
(List.Tot.append (List.Tot.rev ll) (x :: lr) == List.Tot.append (List.Tot.rev (x :: ll)) lr) =
| List.Tot.rev_rev' (x :: ll);
List.Tot.rev_rev' ll;
List.Tot.append_assoc (List.Tot.rev ll) [x] lr | false |
CBOR.Spec.fsti | CBOR.Spec.cbor_map_sort_correct | val cbor_map_sort_correct (l: list (raw_data_item & raw_data_item))
: Lemma
(ensures
(let res, l' = cbor_map_sort l in
(forall x. List.Tot.memP x l' <==> List.Tot.memP x l) /\
(List.Tot.no_repeats_p (List.Tot.map fst l') <==> List.Tot.no_repeats_p (List.Tot.map fst l)
) /\ (res == true <==> List.Tot.no_repeats_p (List.Tot.map fst l)) /\
(res == true ==>
(List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l' /\
(forall k. list_ghost_assoc k l' == list_ghost_assoc k l))))) | val cbor_map_sort_correct (l: list (raw_data_item & raw_data_item))
: Lemma
(ensures
(let res, l' = cbor_map_sort l in
(forall x. List.Tot.memP x l' <==> List.Tot.memP x l) /\
(List.Tot.no_repeats_p (List.Tot.map fst l') <==> List.Tot.no_repeats_p (List.Tot.map fst l)
) /\ (res == true <==> List.Tot.no_repeats_p (List.Tot.map fst l)) /\
(res == true ==>
(List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l' /\
(forall k. list_ghost_assoc k l' == list_ghost_assoc k l))))) | let cbor_map_sort_correct
(l: list (raw_data_item & raw_data_item))
: Lemma
(ensures (let (res, l') = cbor_map_sort l in
(forall x . List.Tot.memP x l' <==> List.Tot.memP x l) /\
(List.Tot.no_repeats_p (List.Tot.map fst l') <==> List.Tot.no_repeats_p (List.Tot.map fst l)) /\
(res == true <==> List.Tot.no_repeats_p (List.Tot.map fst l)) /\
(res == true ==> (
List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l' /\
(forall k . list_ghost_assoc k l' == list_ghost_assoc k l)
))
))
= cbor_map_sort_eq l;
Classical.forall_intro_2 deterministically_encoded_cbor_map_key_order_spec;
Classical.forall_intro_2 cbor_compare_correct;
Classical.forall_intro_2 cbor_compare_equal;
Classical.forall_intro_2 bytes_lex_compare_opp;
map_sort_correct deterministically_encoded_cbor_map_key_order cbor_compare l | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 78,
"end_line": 293,
"start_col": 0,
"start_line": 276
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1
noextract [@@noextract_to "krml"]
let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c
let rec bytes_lex_compare_opp
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2)
let rec bytes_lex_compare_values
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (let c = bytes_lex_compare s1 s2 in
c == -1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)]
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_values (Seq.tail s1) (Seq.tail s2)
val bytes_lex_compare_equal
(s1 s2: Seq.seq U8.t)
: Lemma
(bytes_lex_compare s1 s2 == 0 <==> s1 == s2)
val deterministically_encoded_cbor_map_key_order_spec
(x1 x2: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x1 x2 == (bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2) < 0))
noextract [@@noextract_to "krml"]
let rec cbor_compare
(x1 x2: raw_data_item)
: Tot int
(decreases x1)
= let ty1 = get_major_type x1 in
let ty2 = get_major_type x2 in
let c = int_compare (U8.v ty1) (U8.v ty2) in
if c <> 0
then c
else if ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64
then int_compare (U64.v (Int64?.v x1)) (U64.v (Int64?.v x2))
else if ty1 = cbor_major_type_simple_value
then int_compare (U8.v (Simple?.v x1)) (U8.v (Simple?.v x2))
else if ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string
then
let c = int_compare (Seq.length (String?.v x1)) (Seq.length (String?.v x2)) in
if c <> 0
then c
else bytes_lex_compare (String?.v x1) (String?.v x2)
else if ty1 = cbor_major_type_tagged
then
let c = int_compare (U64.v (Tagged?.tag x1)) (U64.v (Tagged?.tag x2)) in
if c <> 0
then c
else cbor_compare (Tagged?.v x1) (Tagged?.v x2)
else if ty1 = cbor_major_type_array
then
let c = int_compare (List.Tot.length (Array?.v x1)) (List.Tot.length (Array?.v x2)) in
if c <> 0
then c
else cbor_compare_array (Array?.v x1) (Array?.v x2)
else if ty1 = cbor_major_type_map
then
let c = int_compare (List.Tot.length (Map?.v x1)) (List.Tot.length (Map?.v x2)) in
if c <> 0
then c
else cbor_compare_map (Map?.v x1) (Map?.v x2)
else false_elim ()
and cbor_compare_array
(x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare a1 a2 in
if c <> 0
then c
else cbor_compare_array q1 q2
and cbor_compare_map
(x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare (fst a1) (fst a2) in
if c <> 0
then c
else
let c = cbor_compare (snd a1) (snd a2) in
if c <> 0
then c
else cbor_compare_map q1 q2
val cbor_compare_correct
(x1 x2: raw_data_item)
: Lemma
(ensures (cbor_compare x1 x2 == bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2)))
let cbor_compare_equal
(x1 x2: raw_data_item)
: Lemma
(cbor_compare x1 x2 == 0 <==> x1 == x2)
= cbor_compare_correct x1 x2;
bytes_lex_compare_equal (serialize_cbor x1) (serialize_cbor x2);
Seq.append_empty_r (serialize_cbor x1);
Seq.append_empty_r (serialize_cbor x2);
Classical.move_requires (serialize_cbor_inj x1 x2 Seq.empty) Seq.empty
let deterministically_encoded_cbor_map_key_order_major_type_intro
(v1 v2: raw_data_item)
: Lemma
(requires (
U8.v (get_major_type v1) < U8.v (get_major_type v2)
))
(ensures (
Ghost.reveal deterministically_encoded_cbor_map_key_order v1 v2 == true
))
= deterministically_encoded_cbor_map_key_order_spec v1 v2;
cbor_compare_correct v1 v2
let deterministically_encoded_cbor_map_key_order_int64
(ty: major_type_uint64_or_neg_int64)
(v1 v2: U64.t)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2) == U64.lt v1 v2)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order (Int64 ty v1) (Int64 ty v2))]
= deterministically_encoded_cbor_map_key_order_spec (Int64 ty v1) (Int64 ty v2);
cbor_compare_correct (Int64 ty v1) (Int64 ty v2)
noextract [@@noextract_to "krml"]
val cbor_map_sort
(l: list (raw_data_item & raw_data_item))
: Tot (bool & list (raw_data_item & raw_data_item))
// this is to avoid unnecessary unfolding of cbor_map_sort
val cbor_map_sort_eq
(l: list (raw_data_item & raw_data_item))
: Lemma
(cbor_map_sort l == map_sort cbor_compare l) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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: Prims.list (CBOR.Spec.Type.raw_data_item * CBOR.Spec.Type.raw_data_item)
-> FStar.Pervasives.Lemma
(ensures
(let _ = CBOR.Spec.cbor_map_sort l in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ res l' = _ in
(forall (x: (CBOR.Spec.Type.raw_data_item * CBOR.Spec.Type.raw_data_item)).
FStar.List.Tot.Base.memP x l' <==> FStar.List.Tot.Base.memP x l) /\
(FStar.List.Tot.Base.no_repeats_p (FStar.List.Tot.Base.map FStar.Pervasives.Native.fst l') <==>
FStar.List.Tot.Base.no_repeats_p (FStar.List.Tot.Base.map FStar.Pervasives.Native.fst l)
) /\
(res == true <==>
FStar.List.Tot.Base.no_repeats_p (FStar.List.Tot.Base.map FStar.Pervasives.Native.fst l)
) /\
(res == true ==>
FStar.List.Tot.Properties.sorted (CBOR.Spec.Type.map_entry_order (FStar.Ghost.reveal CBOR.Spec.deterministically_encoded_cbor_map_key_order
)
CBOR.Spec.Type.raw_data_item)
l' /\
(forall (k: CBOR.Spec.Type.raw_data_item).
CBOR.Spec.Map.list_ghost_assoc k l' == CBOR.Spec.Map.list_ghost_assoc k l)))
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"CBOR.Spec.Type.raw_data_item",
"CBOR.Spec.Map.map_sort_correct",
"FStar.Ghost.reveal",
"Prims.bool",
"CBOR.Spec.deterministically_encoded_cbor_map_key_order",
"CBOR.Spec.cbor_compare",
"Prims.unit",
"FStar.Classical.forall_intro_2",
"FStar.Seq.Base.seq",
"FStar.UInt8.t",
"Prims.eq2",
"Prims.int",
"CBOR.Spec.bytes_lex_compare",
"Prims.op_Minus",
"CBOR.Spec.bytes_lex_compare_opp",
"Prims.l_iff",
"CBOR.Spec.cbor_compare_equal",
"CBOR.Spec.serialize_cbor",
"CBOR.Spec.cbor_compare_correct",
"Prims.op_LessThan",
"CBOR.Spec.deterministically_encoded_cbor_map_key_order_spec",
"CBOR.Spec.cbor_map_sort_eq",
"Prims.l_True",
"Prims.squash",
"Prims.l_and",
"Prims.l_Forall",
"FStar.List.Tot.Base.memP",
"FStar.List.Tot.Base.no_repeats_p",
"FStar.List.Tot.Base.map",
"FStar.Pervasives.Native.fst",
"Prims.l_imp",
"Prims.b2t",
"FStar.List.Tot.Properties.sorted",
"CBOR.Spec.Type.map_entry_order",
"FStar.Pervasives.Native.option",
"CBOR.Spec.Map.list_ghost_assoc",
"CBOR.Spec.cbor_map_sort",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let cbor_map_sort_correct (l: list (raw_data_item & raw_data_item))
: Lemma
(ensures
(let res, l' = cbor_map_sort l in
(forall x. List.Tot.memP x l' <==> List.Tot.memP x l) /\
(List.Tot.no_repeats_p (List.Tot.map fst l') <==> List.Tot.no_repeats_p (List.Tot.map fst l)
) /\ (res == true <==> List.Tot.no_repeats_p (List.Tot.map fst l)) /\
(res == true ==>
(List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l' /\
(forall k. list_ghost_assoc k l' == list_ghost_assoc k l))))) =
| cbor_map_sort_eq l;
Classical.forall_intro_2 deterministically_encoded_cbor_map_key_order_spec;
Classical.forall_intro_2 cbor_compare_correct;
Classical.forall_intro_2 cbor_compare_equal;
Classical.forall_intro_2 bytes_lex_compare_opp;
map_sort_correct deterministically_encoded_cbor_map_key_order cbor_compare l | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.parse_ifthenelse_synth_injective | val parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t)
: Lemma (synth_injective (p.parse_ifthenelse_synth t))
[SMTPat (synth_injective (p.parse_ifthenelse_synth t))] | val parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t)
: Lemma (synth_injective (p.parse_ifthenelse_synth t))
[SMTPat (synth_injective (p.parse_ifthenelse_synth t))] | let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2) | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 112,
"end_line": 42,
"start_col": 0,
"start_line": 41
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: LowParse.Spec.IfThenElse.parse_ifthenelse_param ->
t: Mkparse_ifthenelse_param?.parse_ifthenelse_tag_t p
-> FStar.Pervasives.Lemma
(ensures
LowParse.Spec.Combinators.synth_injective (Mkparse_ifthenelse_param?.parse_ifthenelse_synth p
t))
[
SMTPat (LowParse.Spec.Combinators.synth_injective (Mkparse_ifthenelse_param?.parse_ifthenelse_synth
p
t))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"FStar.Classical.forall_intro_2",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"Prims.l_imp",
"Prims.eq2",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_synth",
"Prims.l_and",
"FStar.Classical.move_requires",
"LowParse.Spec.Base.coerce",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_synth_injective",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"LowParse.Spec.Combinators.synth_injective",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | false | false | true | false | false | let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t)
: Lemma (synth_injective (p.parse_ifthenelse_synth t))
[SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
| Classical.forall_intro_2 (fun x1 x2 ->
Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2) | false |
LListReverse.fst | LListReverse.list_rev_done | val list_rev_done (l1 l2: list U64.t)
: Lemma (requires (l1 == List.Tot.append (List.Tot.rev l2) []))
(ensures (l2 == List.Tot.rev l1)) | val list_rev_done (l1 l2: list U64.t)
: Lemma (requires (l1 == List.Tot.append (List.Tot.rev l2) []))
(ensures (l2 == List.Tot.rev l1)) | let list_rev_done
(l1 l2: list U64.t)
: Lemma
(requires (
l1 == List.Tot.append (List.Tot.rev l2) []
))
(ensures (l2 == List.Tot.rev l1))
= List.Tot.append_l_nil (List.Tot.rev l2);
List.Tot.rev_involutive l2 | {
"file_name": "share/steel/tests/krml/LListReverse.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 28,
"end_line": 201,
"start_col": 0,
"start_line": 193
} | module LListReverse
open Steel.ST.GenElim
open Steel.ST.Reference
open Steel.ST.Loops
module U64 = FStar.UInt64
let main () = C.EXIT_SUCCESS // dummy for compilation
noeq
type llist_cell = {
value: U64.t;
next: ref llist_cell;
}
[@@__reduce__]
let llist_nil
(p: ref llist_cell)
: Tot vprop
= pure (p == null)
[@@__reduce__]
let llist_cons
(a: U64.t)
(llist: (ref llist_cell -> Tot vprop))
(p: ref llist_cell)
: Tot vprop
= exists_ (fun c ->
pts_to p full_perm c `star`
pure (c.value == a) `star`
llist c.next
)
let rec llist
(l: Ghost.erased (list U64.t))
: Tot (ref llist_cell -> vprop)
(decreases Ghost.reveal l)
= match Ghost.reveal l with
| [] -> llist_nil
| a :: q -> llist_cons a (llist q)
let llist_nil_is_null
(#opened: _)
(l: Ghost.erased (list U64.t))
(p: ref llist_cell)
: STGhost unit opened
(llist l p)
(fun _ -> llist l p)
True
(fun _ -> (p == null <==> Nil? l))
= if Nil? l
then begin
rewrite (llist l p) (llist_nil p);
let _ = gen_elim () in
rewrite (llist_nil p) (llist l p)
end else begin
let a :: q = Ghost.reveal l in
rewrite (llist l p) (llist_cons a (llist q) p);
let _ = gen_elim () in
pts_to_not_null p;
rewrite (llist_cons a (llist q) p) (llist l p)
end
let pop
(#l: Ghost.erased (list U64.t))
(p: ref llist_cell { Cons? l })
: STT (ref llist_cell)
(llist l p)
(fun p' -> exists_ (fun x -> pts_to p full_perm x `star` llist (List.Tot.tl l) p' `star` pure (x.value == List.Tot.hd l)))
= rewrite (llist l p) (llist_cons (List.Tot.hd l) (llist (List.Tot.tl l)) p);
let _ = gen_elim () in
// let p' = (read p).next in // FIXME: "Effects STBase and Tot cannot be composed"
let x = read p in
let p' = x.next in
vpattern_rewrite (llist _) p';
return p'
let push
(#l': Ghost.erased (list U64.t))
(#x: Ghost.erased llist_cell)
(p: ref llist_cell)
(p': ref llist_cell)
: STT unit
(llist l' p' `star` pts_to p full_perm x)
(fun p' -> llist (x.value :: l') p)
=
// write p ({ read p with next = p' }); // weird Steel error
let x_ = read p in
write p ({ x_ with next = p' });
let x' = vpattern_replace (pts_to p full_perm) in
vpattern_rewrite (llist _) x'.next;
rewrite (llist_cons x.value (llist l') p) (llist (x.value :: l') p)
noextract
let llist_reverse_invariant_prop
(l: list U64.t)
(done todo: list U64.t)
(cont: bool)
: GTot prop
=
l == List.Tot.append (List.Tot.rev done) todo /\
cont == Cons? todo
[@@erasable]
noeq
type llist_reverse_invariant_t (l: list U64.t) (cont: bool) = {
pdone: ref llist_cell;
done: list U64.t;
ptodo: ref llist_cell;
todo: list U64.t;
prf: squash (llist_reverse_invariant_prop l done todo cont);
}
[@@__reduce__]
let llist_reverse_invariant_body
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: Tot vprop
= pts_to ppdone full_perm pdone `star` llist done pdone `star`
pts_to pptodo full_perm ptodo `star` llist todo ptodo
[@@__reduce__]
let llist_reverse_invariant0
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop
= exists_ (fun (x: llist_reverse_invariant_t l cont) -> llist_reverse_invariant_body ppdone pptodo x.pdone x.done x.ptodo x.todo)
let llist_reverse_invariant
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
: Tot vprop
= llist_reverse_invariant0 l ppdone pptodo cont
let intro_llist_reverse_invariant
(#opened: _)
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
(pdone: ref llist_cell)
(done: Ghost.erased (list U64.t))
(ptodo: ref llist_cell)
(todo: Ghost.erased (list U64.t))
: STGhost unit opened
(llist_reverse_invariant_body ppdone pptodo pdone done ptodo todo)
(fun _ -> llist_reverse_invariant l ppdone pptodo cont)
(llist_reverse_invariant_prop l done todo cont)
(fun _ -> True)
= let x : llist_reverse_invariant_t l cont = {
pdone = pdone;
done = done;
ptodo = ptodo;
todo = todo;
prf = ();
}
in
rewrite
(llist_reverse_invariant_body ppdone pptodo pdone done ptodo todo)
(llist_reverse_invariant_body ppdone pptodo x.pdone x.done x.ptodo x.todo);
rewrite
(llist_reverse_invariant0 l ppdone pptodo cont)
(llist_reverse_invariant l ppdone pptodo cont)
let elim_llist_reverse_invariant
(#opened: _)
(l: Ghost.erased (list U64.t))
(ppdone: ref (ref llist_cell))
(pptodo: ref (ref llist_cell))
(cont: bool)
: STGhostT (llist_reverse_invariant_t l cont) opened
(llist_reverse_invariant l ppdone pptodo cont)
(fun x -> llist_reverse_invariant_body ppdone pptodo x.pdone x.done x.ptodo x.todo)
= let x = elim_exists () in
x
let list_rev_transfer
(ll: list U64.t) (x: U64.t) (lr: list U64.t)
: Lemma
(List.Tot.append (List.Tot.rev ll) (x :: lr) == List.Tot.append (List.Tot.rev (x :: ll)) lr)
= List.Tot.rev_rev' (x :: ll);
List.Tot.rev_rev' ll;
List.Tot.append_assoc (List.Tot.rev ll) [x] lr | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Reference.fsti.checked",
"Steel.ST.Loops.fsti.checked",
"Steel.ST.GenElim.fsti.checked",
"prims.fst.checked",
"FStar.UInt64.fsti.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"C.fst.checked"
],
"interface_file": false,
"source_file": "LListReverse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": false,
"full_module": "Steel.ST.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.GenElim",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | l1: Prims.list FStar.UInt64.t -> l2: Prims.list FStar.UInt64.t
-> FStar.Pervasives.Lemma (requires l1 == FStar.List.Tot.Base.rev l2 @ [])
(ensures l2 == FStar.List.Tot.Base.rev l1) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"Prims.list",
"FStar.UInt64.t",
"FStar.List.Tot.Properties.rev_involutive",
"Prims.unit",
"FStar.List.Tot.Properties.append_l_nil",
"FStar.List.Tot.Base.rev",
"Prims.eq2",
"FStar.List.Tot.Base.append",
"Prims.Nil",
"Prims.squash",
"FStar.Pervasives.pattern"
] | [] | true | false | true | false | false | let list_rev_done (l1 l2: list U64.t)
: Lemma (requires (l1 == List.Tot.append (List.Tot.rev l2) []))
(ensures (l2 == List.Tot.rev l1)) =
| List.Tot.append_l_nil (List.Tot.rev l2);
List.Tot.rev_involutive l2 | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.parse_ifthenelse | val parse_ifthenelse (p: parse_ifthenelse_param)
: Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) | val parse_ifthenelse (p: parse_ifthenelse_param)
: Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) | let parse_ifthenelse (p: parse_ifthenelse_param) : Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) =
and_then p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 69,
"end_line": 61,
"start_col": 0,
"start_line": 60
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p)
let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2)
let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
weaken (parse_ifthenelse_payload_kind p) (parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) (p.parse_ifthenelse_synth t))
let parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param) : Lemma
(and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))]
= and_then_cases_injective_intro
(parse_ifthenelse_payload p)
(fun t1 t2 b1 b2 ->
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) (p.parse_ifthenelse_synth t1) b1;
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) (p.parse_ifthenelse_synth t2) b2;
let Some (x1, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) b1 in
let Some (x2, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) b2 in
p.parse_ifthenelse_synth_injective t1 x1 t2 x2
) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: LowParse.Spec.IfThenElse.parse_ifthenelse_param
-> LowParse.Spec.Base.parser (LowParse.Spec.IfThenElse.parse_ifthenelse_kind p)
(Mkparse_ifthenelse_param?.parse_ifthenelse_t p) | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.Combinators.and_then",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_kind",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_parser",
"LowParse.Spec.IfThenElse.parse_ifthenelse_payload_kind",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.IfThenElse.parse_ifthenelse_payload",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.parse_ifthenelse_kind"
] | [] | false | false | false | false | false | let parse_ifthenelse (p: parse_ifthenelse_param)
: Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) =
| and_then p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) | false |
CBOR.Spec.fsti | CBOR.Spec.cbor_compare | val cbor_compare (x1 x2: raw_data_item) : Tot int (decreases x1) | val cbor_compare (x1 x2: raw_data_item) : Tot int (decreases x1) | let rec cbor_compare
(x1 x2: raw_data_item)
: Tot int
(decreases x1)
= let ty1 = get_major_type x1 in
let ty2 = get_major_type x2 in
let c = int_compare (U8.v ty1) (U8.v ty2) in
if c <> 0
then c
else if ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64
then int_compare (U64.v (Int64?.v x1)) (U64.v (Int64?.v x2))
else if ty1 = cbor_major_type_simple_value
then int_compare (U8.v (Simple?.v x1)) (U8.v (Simple?.v x2))
else if ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string
then
let c = int_compare (Seq.length (String?.v x1)) (Seq.length (String?.v x2)) in
if c <> 0
then c
else bytes_lex_compare (String?.v x1) (String?.v x2)
else if ty1 = cbor_major_type_tagged
then
let c = int_compare (U64.v (Tagged?.tag x1)) (U64.v (Tagged?.tag x2)) in
if c <> 0
then c
else cbor_compare (Tagged?.v x1) (Tagged?.v x2)
else if ty1 = cbor_major_type_array
then
let c = int_compare (List.Tot.length (Array?.v x1)) (List.Tot.length (Array?.v x2)) in
if c <> 0
then c
else cbor_compare_array (Array?.v x1) (Array?.v x2)
else if ty1 = cbor_major_type_map
then
let c = int_compare (List.Tot.length (Map?.v x1)) (List.Tot.length (Map?.v x2)) in
if c <> 0
then c
else cbor_compare_map (Map?.v x1) (Map?.v x2)
else false_elim ()
and cbor_compare_array
(x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare a1 a2 in
if c <> 0
then c
else cbor_compare_array q1 q2
and cbor_compare_map
(x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare (fst a1) (fst a2) in
if c <> 0
then c
else
let c = cbor_compare (snd a1) (snd a2) in
if c <> 0
then c
else cbor_compare_map q1 q2 | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 33,
"end_line": 227,
"start_col": 0,
"start_line": 158
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1
noextract [@@noextract_to "krml"]
let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c
let rec bytes_lex_compare_opp
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2)
let rec bytes_lex_compare_values
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (let c = bytes_lex_compare s1 s2 in
c == -1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)]
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_values (Seq.tail s1) (Seq.tail s2)
val bytes_lex_compare_equal
(s1 s2: Seq.seq U8.t)
: Lemma
(bytes_lex_compare s1 s2 == 0 <==> s1 == s2)
val deterministically_encoded_cbor_map_key_order_spec
(x1 x2: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x1 x2 == (bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2) < 0)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | x1: CBOR.Spec.Type.raw_data_item -> x2: CBOR.Spec.Type.raw_data_item -> Prims.Tot Prims.int | Prims.Tot | [
"total",
""
] | [
"cbor_compare",
"cbor_compare_array",
"cbor_compare_map"
] | [
"CBOR.Spec.Type.raw_data_item",
"Prims.op_disEquality",
"Prims.int",
"Prims.bool",
"Prims.op_BarBar",
"Prims.op_Equality",
"CBOR.Spec.Constants.major_type_t",
"CBOR.Spec.Constants.cbor_major_type_uint64",
"CBOR.Spec.Constants.cbor_major_type_neg_int64",
"CBOR.Spec.int_compare",
"FStar.UInt64.v",
"CBOR.Spec.Type.__proj__Int64__item__v",
"CBOR.Spec.Constants.cbor_major_type_simple_value",
"FStar.UInt8.v",
"CBOR.Spec.Type.__proj__Simple__item__v",
"CBOR.Spec.Constants.cbor_major_type_byte_string",
"CBOR.Spec.Constants.cbor_major_type_text_string",
"CBOR.Spec.bytes_lex_compare",
"CBOR.Spec.Type.__proj__String__item__v",
"FStar.Seq.Base.length",
"FStar.UInt8.t",
"CBOR.Spec.Constants.cbor_major_type_tagged",
"CBOR.Spec.cbor_compare",
"CBOR.Spec.Type.__proj__Tagged__item__v",
"CBOR.Spec.Type.__proj__Tagged__item__tag",
"CBOR.Spec.Constants.cbor_major_type_array",
"CBOR.Spec.cbor_compare_array",
"CBOR.Spec.Type.__proj__Array__item__v",
"FStar.List.Tot.Base.length",
"CBOR.Spec.Constants.cbor_major_type_map",
"CBOR.Spec.cbor_compare_map",
"CBOR.Spec.Type.__proj__Map__item__v",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.false_elim",
"CBOR.Spec.Type.get_major_type"
] | [
"mutual recursion"
] | false | false | false | true | false | let rec cbor_compare (x1 x2: raw_data_item) : Tot int (decreases x1) =
| let ty1 = get_major_type x1 in
let ty2 = get_major_type x2 in
let c = int_compare (U8.v ty1) (U8.v ty2) in
if c <> 0
then c
else
if ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64
then int_compare (U64.v (Int64?.v x1)) (U64.v (Int64?.v x2))
else
if ty1 = cbor_major_type_simple_value
then int_compare (U8.v (Simple?.v x1)) (U8.v (Simple?.v x2))
else
if ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string
then
let c = int_compare (Seq.length (String?.v x1)) (Seq.length (String?.v x2)) in
if c <> 0 then c else bytes_lex_compare (String?.v x1) (String?.v x2)
else
if ty1 = cbor_major_type_tagged
then
let c = int_compare (U64.v (Tagged?.tag x1)) (U64.v (Tagged?.tag x2)) in
if c <> 0 then c else cbor_compare (Tagged?.v x1) (Tagged?.v x2)
else
if ty1 = cbor_major_type_array
then
let c = int_compare (List.Tot.length (Array?.v x1)) (List.Tot.length (Array?.v x2)) in
if c <> 0 then c else cbor_compare_array (Array?.v x1) (Array?.v x2)
else
if ty1 = cbor_major_type_map
then
let c = int_compare (List.Tot.length (Map?.v x1)) (List.Tot.length (Map?.v x2)) in
if c <> 0 then c else cbor_compare_map (Map?.v x1) (Map?.v x2)
else false_elim () | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.parse_ifthenelse_payload_and_then_cases_injective | val parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param)
: Lemma (and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))] | val parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param)
: Lemma (and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))] | let parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param) : Lemma
(and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))]
= and_then_cases_injective_intro
(parse_ifthenelse_payload p)
(fun t1 t2 b1 b2 ->
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) (p.parse_ifthenelse_synth t1) b1;
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) (p.parse_ifthenelse_synth t2) b2;
let Some (x1, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) b1 in
let Some (x2, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) b2 in
p.parse_ifthenelse_synth_injective t1 x1 t2 x2
) | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 5,
"end_line": 58,
"start_col": 0,
"start_line": 47
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p)
let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2)
let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
weaken (parse_ifthenelse_payload_kind p) (parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) (p.parse_ifthenelse_synth t)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: LowParse.Spec.IfThenElse.parse_ifthenelse_param
-> FStar.Pervasives.Lemma
(ensures
LowParse.Spec.Combinators.and_then_cases_injective (LowParse.Spec.IfThenElse.parse_ifthenelse_payload
p))
[
SMTPat (LowParse.Spec.Combinators.and_then_cases_injective (LowParse.Spec.IfThenElse.parse_ifthenelse_payload
p))
] | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.Combinators.and_then_cases_injective_intro",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.IfThenElse.parse_ifthenelse_payload",
"LowParse.Bytes.bytes",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_synth_injective",
"Prims.unit",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.parse",
"FStar.Pervasives.dsnd",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser",
"LowParse.Spec.Combinators.parse_synth_eq",
"Prims.__proj__Mkdtuple2__item___1",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_synth",
"Prims.l_True",
"Prims.squash",
"LowParse.Spec.Combinators.and_then_cases_injective",
"Prims.Cons",
"FStar.Pervasives.pattern",
"FStar.Pervasives.smt_pat",
"Prims.Nil"
] | [] | false | false | true | false | false | let parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param)
: Lemma (and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))] =
| and_then_cases_injective_intro (parse_ifthenelse_payload p)
(fun t1 t2 b1 b2 ->
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1)))
(p.parse_ifthenelse_synth t1)
b1;
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2)))
(p.parse_ifthenelse_synth t2)
b2;
let Some (x1, _) =
parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) b1
in
let Some (x2, _) =
parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) b2
in
p.parse_ifthenelse_synth_injective t1 x1 t2 x2) | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.serialize_ifthenelse_synth_inverse' | val serialize_ifthenelse_synth_inverse'
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
(tg: p.parse_ifthenelse_tag_t)
(pl: p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond tg))
: Lemma (s.serialize_ifthenelse_synth_recip (p.parse_ifthenelse_synth tg pl) == (| tg, pl |)) | val serialize_ifthenelse_synth_inverse'
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
(tg: p.parse_ifthenelse_tag_t)
(pl: p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond tg))
: Lemma (s.serialize_ifthenelse_synth_recip (p.parse_ifthenelse_synth tg pl) == (| tg, pl |)) | let serialize_ifthenelse_synth_inverse'
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
(tg: p.parse_ifthenelse_tag_t)
(pl: p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond tg))
: Lemma
(s.serialize_ifthenelse_synth_recip (p.parse_ifthenelse_synth tg pl) == (| tg, pl |))
= let (| tg', pl' |) = s.serialize_ifthenelse_synth_recip (p.parse_ifthenelse_synth tg pl) in
s.serialize_ifthenelse_synth_inverse (p.parse_ifthenelse_synth tg pl);
p.parse_ifthenelse_synth_injective tg pl tg' pl' | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 50,
"end_line": 152,
"start_col": 0,
"start_line": 143
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p)
let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2)
let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
weaken (parse_ifthenelse_payload_kind p) (parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) (p.parse_ifthenelse_synth t))
let parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param) : Lemma
(and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))]
= and_then_cases_injective_intro
(parse_ifthenelse_payload p)
(fun t1 t2 b1 b2 ->
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) (p.parse_ifthenelse_synth t1) b1;
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) (p.parse_ifthenelse_synth t2) b2;
let Some (x1, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) b1 in
let Some (x2, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) b2 in
p.parse_ifthenelse_synth_injective t1 x1 t2 x2
)
let parse_ifthenelse (p: parse_ifthenelse_param) : Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) =
and_then p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p)
let parse_ifthenelse_eq
(p: parse_ifthenelse_param)
(input: bytes)
: Lemma
(parse (parse_ifthenelse p) input == (
match parse p.parse_ifthenelse_tag_parser input with
| None -> None
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
match parse (dsnd (p.parse_ifthenelse_payload_parser b)) input' with
| None -> None
| Some (x, consumed_x) -> Some (p.parse_ifthenelse_synth t x, consumed_t + consumed_x)
))
= and_then_eq p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) input;
match parse p.parse_ifthenelse_tag_parser input with
| None -> ()
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
let f : (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t) -> GTot p.parse_ifthenelse_t) = (p.parse_ifthenelse_synth) t in
let f' = coerce (p.parse_ifthenelse_payload_t b -> GTot p.parse_ifthenelse_t) f in
parse_synth_eq
#(dfst (p.parse_ifthenelse_payload_parser b))
#(p.parse_ifthenelse_payload_t b)
#(p.parse_ifthenelse_t)
(dsnd (p.parse_ifthenelse_payload_parser b)) f' input'
noextract
inline_for_extraction
noeq
type serialize_ifthenelse_param (p: parse_ifthenelse_param) = {
serialize_ifthenelse_tag_serializer: serializer p.parse_ifthenelse_tag_parser;
serialize_ifthenelse_payload_serializer: ((b: bool) -> Tot (serializer (dsnd (p.parse_ifthenelse_payload_parser b))));
serialize_ifthenelse_synth_recip: (p.parse_ifthenelse_t -> GTot ( t: p.parse_ifthenelse_tag_t & (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t))));
serialize_ifthenelse_synth_inverse: (
(x: p.parse_ifthenelse_t) ->
Lemma
(let (| t, y |) = serialize_ifthenelse_synth_recip x in
p.parse_ifthenelse_synth t y == x)
);
}
let bare_serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
: Tot (bare_serializer p.parse_ifthenelse_t)
= fun (d: p.parse_ifthenelse_t) ->
let (| t, y |) = s.serialize_ifthenelse_synth_recip d in
Seq.append (serialize s.serialize_ifthenelse_tag_serializer t) (serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y)
let bare_serialize_ifthenelse_correct
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
: Lemma
(requires (p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong))
(ensures (serializer_correct (parse_ifthenelse p) (bare_serialize_ifthenelse s)))
= let prf
(x: p.parse_ifthenelse_t)
: Lemma
(let sq = bare_serialize_ifthenelse s x in
parse (parse_ifthenelse p) sq == Some (x, Seq.length sq))
= let sq = bare_serialize_ifthenelse s x in
parse_ifthenelse_eq p sq;
let (| t, y |) = s.serialize_ifthenelse_synth_recip x in
let sqt = serialize s.serialize_ifthenelse_tag_serializer t in
let sqp = serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y in
parse_strong_prefix p.parse_ifthenelse_tag_parser sqt sq;
assert (Seq.slice sq (Seq.length sqt) (Seq.length sq) `Seq.equal` sqp);
s.serialize_ifthenelse_synth_inverse x
in
Classical.forall_intro prf
let serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p { p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong } )
: Tot (serializer (parse_ifthenelse p))
= bare_serialize_ifthenelse_correct s;
bare_serialize_ifthenelse s | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
s: LowParse.Spec.IfThenElse.serialize_ifthenelse_param p ->
tg: Mkparse_ifthenelse_param?.parse_ifthenelse_tag_t p ->
pl:
Mkparse_ifthenelse_param?.parse_ifthenelse_payload_t p
(Mkparse_ifthenelse_param?.parse_ifthenelse_tag_cond p tg)
-> FStar.Pervasives.Lemma
(ensures
Mkserialize_ifthenelse_param?.serialize_ifthenelse_synth_recip s
(Mkparse_ifthenelse_param?.parse_ifthenelse_synth p tg pl) ==
(| tg, pl |)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.IfThenElse.serialize_ifthenelse_param",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_synth_injective",
"Prims.unit",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_synth_inverse",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_synth",
"Prims.dtuple2",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_synth_recip",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"Prims.Mkdtuple2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let serialize_ifthenelse_synth_inverse'
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
(tg: p.parse_ifthenelse_tag_t)
(pl: p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond tg))
: Lemma (s.serialize_ifthenelse_synth_recip (p.parse_ifthenelse_synth tg pl) == (| tg, pl |)) =
| let (| tg' , pl' |) = s.serialize_ifthenelse_synth_recip (p.parse_ifthenelse_synth tg pl) in
s.serialize_ifthenelse_synth_inverse (p.parse_ifthenelse_synth tg pl);
p.parse_ifthenelse_synth_injective tg pl tg' pl' | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.serialize_ifthenelse | val serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong})
: Tot (serializer (parse_ifthenelse p)) | val serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong})
: Tot (serializer (parse_ifthenelse p)) | let serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p { p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong } )
: Tot (serializer (parse_ifthenelse p))
= bare_serialize_ifthenelse_correct s;
bare_serialize_ifthenelse s | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 29,
"end_line": 141,
"start_col": 0,
"start_line": 136
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p)
let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2)
let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
weaken (parse_ifthenelse_payload_kind p) (parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) (p.parse_ifthenelse_synth t))
let parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param) : Lemma
(and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))]
= and_then_cases_injective_intro
(parse_ifthenelse_payload p)
(fun t1 t2 b1 b2 ->
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) (p.parse_ifthenelse_synth t1) b1;
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) (p.parse_ifthenelse_synth t2) b2;
let Some (x1, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) b1 in
let Some (x2, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) b2 in
p.parse_ifthenelse_synth_injective t1 x1 t2 x2
)
let parse_ifthenelse (p: parse_ifthenelse_param) : Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) =
and_then p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p)
let parse_ifthenelse_eq
(p: parse_ifthenelse_param)
(input: bytes)
: Lemma
(parse (parse_ifthenelse p) input == (
match parse p.parse_ifthenelse_tag_parser input with
| None -> None
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
match parse (dsnd (p.parse_ifthenelse_payload_parser b)) input' with
| None -> None
| Some (x, consumed_x) -> Some (p.parse_ifthenelse_synth t x, consumed_t + consumed_x)
))
= and_then_eq p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) input;
match parse p.parse_ifthenelse_tag_parser input with
| None -> ()
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
let f : (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t) -> GTot p.parse_ifthenelse_t) = (p.parse_ifthenelse_synth) t in
let f' = coerce (p.parse_ifthenelse_payload_t b -> GTot p.parse_ifthenelse_t) f in
parse_synth_eq
#(dfst (p.parse_ifthenelse_payload_parser b))
#(p.parse_ifthenelse_payload_t b)
#(p.parse_ifthenelse_t)
(dsnd (p.parse_ifthenelse_payload_parser b)) f' input'
noextract
inline_for_extraction
noeq
type serialize_ifthenelse_param (p: parse_ifthenelse_param) = {
serialize_ifthenelse_tag_serializer: serializer p.parse_ifthenelse_tag_parser;
serialize_ifthenelse_payload_serializer: ((b: bool) -> Tot (serializer (dsnd (p.parse_ifthenelse_payload_parser b))));
serialize_ifthenelse_synth_recip: (p.parse_ifthenelse_t -> GTot ( t: p.parse_ifthenelse_tag_t & (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t))));
serialize_ifthenelse_synth_inverse: (
(x: p.parse_ifthenelse_t) ->
Lemma
(let (| t, y |) = serialize_ifthenelse_synth_recip x in
p.parse_ifthenelse_synth t y == x)
);
}
let bare_serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
: Tot (bare_serializer p.parse_ifthenelse_t)
= fun (d: p.parse_ifthenelse_t) ->
let (| t, y |) = s.serialize_ifthenelse_synth_recip d in
Seq.append (serialize s.serialize_ifthenelse_tag_serializer t) (serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y)
let bare_serialize_ifthenelse_correct
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
: Lemma
(requires (p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong))
(ensures (serializer_correct (parse_ifthenelse p) (bare_serialize_ifthenelse s)))
= let prf
(x: p.parse_ifthenelse_t)
: Lemma
(let sq = bare_serialize_ifthenelse s x in
parse (parse_ifthenelse p) sq == Some (x, Seq.length sq))
= let sq = bare_serialize_ifthenelse s x in
parse_ifthenelse_eq p sq;
let (| t, y |) = s.serialize_ifthenelse_synth_recip x in
let sqt = serialize s.serialize_ifthenelse_tag_serializer t in
let sqp = serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y in
parse_strong_prefix p.parse_ifthenelse_tag_parser sqt sq;
assert (Seq.slice sq (Seq.length sqt) (Seq.length sq) `Seq.equal` sqp);
s.serialize_ifthenelse_synth_inverse x
in
Classical.forall_intro prf | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
s:
LowParse.Spec.IfThenElse.serialize_ifthenelse_param p
{ Mkparser_kind'?.parser_kind_subkind (Mkparse_ifthenelse_param?.parse_ifthenelse_tag_kind p
) ==
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong }
-> LowParse.Spec.Base.serializer (LowParse.Spec.IfThenElse.parse_ifthenelse p) | Prims.Tot | [
"total"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.IfThenElse.serialize_ifthenelse_param",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_kind",
"FStar.Pervasives.Native.Some",
"LowParse.Spec.Base.ParserStrong",
"LowParse.Spec.IfThenElse.bare_serialize_ifthenelse",
"Prims.unit",
"LowParse.Spec.IfThenElse.bare_serialize_ifthenelse_correct",
"LowParse.Spec.Base.serializer",
"LowParse.Spec.IfThenElse.parse_ifthenelse_kind",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.IfThenElse.parse_ifthenelse"
] | [] | false | false | false | false | false | let serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s:
serialize_ifthenelse_param p
{p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong})
: Tot (serializer (parse_ifthenelse p)) =
| bare_serialize_ifthenelse_correct s;
bare_serialize_ifthenelse s | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.is_valid_blake2_config | val is_valid_blake2_config : a: Spec.Blake2.Definitions.alg -> m: Hacl.Impl.Blake2.Core.m_spec -> Prims.bool | let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 14,
"end_line": 27,
"start_col": 0,
"start_line": 23
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0" | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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: Spec.Blake2.Definitions.alg -> m: Hacl.Impl.Blake2.Core.m_spec -> Prims.bool | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.m_spec",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Pervasives.Native.tuple2",
"Prims.bool"
] | [] | false | false | false | true | false | let is_valid_blake2_config (a: Spec.alg) (m: m_spec) =
| match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128 | Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false | false |
|
CBOR.Spec.fsti | CBOR.Spec.cbor_compare_array | val cbor_compare_array (x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1) | val cbor_compare_array (x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1) | let rec cbor_compare
(x1 x2: raw_data_item)
: Tot int
(decreases x1)
= let ty1 = get_major_type x1 in
let ty2 = get_major_type x2 in
let c = int_compare (U8.v ty1) (U8.v ty2) in
if c <> 0
then c
else if ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64
then int_compare (U64.v (Int64?.v x1)) (U64.v (Int64?.v x2))
else if ty1 = cbor_major_type_simple_value
then int_compare (U8.v (Simple?.v x1)) (U8.v (Simple?.v x2))
else if ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string
then
let c = int_compare (Seq.length (String?.v x1)) (Seq.length (String?.v x2)) in
if c <> 0
then c
else bytes_lex_compare (String?.v x1) (String?.v x2)
else if ty1 = cbor_major_type_tagged
then
let c = int_compare (U64.v (Tagged?.tag x1)) (U64.v (Tagged?.tag x2)) in
if c <> 0
then c
else cbor_compare (Tagged?.v x1) (Tagged?.v x2)
else if ty1 = cbor_major_type_array
then
let c = int_compare (List.Tot.length (Array?.v x1)) (List.Tot.length (Array?.v x2)) in
if c <> 0
then c
else cbor_compare_array (Array?.v x1) (Array?.v x2)
else if ty1 = cbor_major_type_map
then
let c = int_compare (List.Tot.length (Map?.v x1)) (List.Tot.length (Map?.v x2)) in
if c <> 0
then c
else cbor_compare_map (Map?.v x1) (Map?.v x2)
else false_elim ()
and cbor_compare_array
(x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare a1 a2 in
if c <> 0
then c
else cbor_compare_array q1 q2
and cbor_compare_map
(x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare (fst a1) (fst a2) in
if c <> 0
then c
else
let c = cbor_compare (snd a1) (snd a2) in
if c <> 0
then c
else cbor_compare_map q1 q2 | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 33,
"end_line": 227,
"start_col": 0,
"start_line": 158
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1
noextract [@@noextract_to "krml"]
let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c
let rec bytes_lex_compare_opp
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2)
let rec bytes_lex_compare_values
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (let c = bytes_lex_compare s1 s2 in
c == -1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)]
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_values (Seq.tail s1) (Seq.tail s2)
val bytes_lex_compare_equal
(s1 s2: Seq.seq U8.t)
: Lemma
(bytes_lex_compare s1 s2 == 0 <==> s1 == s2)
val deterministically_encoded_cbor_map_key_order_spec
(x1 x2: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x1 x2 == (bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2) < 0)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 | x1: Prims.list CBOR.Spec.Type.raw_data_item -> x2: Prims.list CBOR.Spec.Type.raw_data_item
-> Prims.Pure Prims.int | Prims.Pure | [
""
] | [
"cbor_compare",
"cbor_compare_array",
"cbor_compare_map"
] | [
"Prims.list",
"CBOR.Spec.Type.raw_data_item",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_disEquality",
"Prims.int",
"Prims.bool",
"CBOR.Spec.cbor_compare_array",
"CBOR.Spec.cbor_compare",
"Prims.eq2",
"Prims.nat",
"FStar.List.Tot.Base.length",
"Prims.l_True"
] | [
"mutual recursion"
] | false | false | false | false | false | let rec cbor_compare_array (x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1) =
| match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare a1 a2 in
if c <> 0 then c else cbor_compare_array q1 q2 | false |
CBOR.Spec.fsti | CBOR.Spec.cbor_compare_map | val cbor_compare_map (x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1) | val cbor_compare_map (x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1) | let rec cbor_compare
(x1 x2: raw_data_item)
: Tot int
(decreases x1)
= let ty1 = get_major_type x1 in
let ty2 = get_major_type x2 in
let c = int_compare (U8.v ty1) (U8.v ty2) in
if c <> 0
then c
else if ty1 = cbor_major_type_uint64 || ty1 = cbor_major_type_neg_int64
then int_compare (U64.v (Int64?.v x1)) (U64.v (Int64?.v x2))
else if ty1 = cbor_major_type_simple_value
then int_compare (U8.v (Simple?.v x1)) (U8.v (Simple?.v x2))
else if ty1 = cbor_major_type_byte_string || ty1 = cbor_major_type_text_string
then
let c = int_compare (Seq.length (String?.v x1)) (Seq.length (String?.v x2)) in
if c <> 0
then c
else bytes_lex_compare (String?.v x1) (String?.v x2)
else if ty1 = cbor_major_type_tagged
then
let c = int_compare (U64.v (Tagged?.tag x1)) (U64.v (Tagged?.tag x2)) in
if c <> 0
then c
else cbor_compare (Tagged?.v x1) (Tagged?.v x2)
else if ty1 = cbor_major_type_array
then
let c = int_compare (List.Tot.length (Array?.v x1)) (List.Tot.length (Array?.v x2)) in
if c <> 0
then c
else cbor_compare_array (Array?.v x1) (Array?.v x2)
else if ty1 = cbor_major_type_map
then
let c = int_compare (List.Tot.length (Map?.v x1)) (List.Tot.length (Map?.v x2)) in
if c <> 0
then c
else cbor_compare_map (Map?.v x1) (Map?.v x2)
else false_elim ()
and cbor_compare_array
(x1 x2: list raw_data_item)
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare a1 a2 in
if c <> 0
then c
else cbor_compare_array q1 q2
and cbor_compare_map
(x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1)
= match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare (fst a1) (fst a2) in
if c <> 0
then c
else
let c = cbor_compare (snd a1) (snd a2) in
if c <> 0
then c
else cbor_compare_map q1 q2 | {
"file_name": "share/steel/examples/pulse/dice/cbor/CBOR.Spec.fsti",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 33,
"end_line": 227,
"start_col": 0,
"start_line": 158
} | (*
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 CBOR.Spec
include CBOR.Spec.Map
module U8 = FStar.UInt8
(* Data format specification *)
val serialize_cbor
(c: raw_data_item)
: GTot (Seq.seq U8.t)
val serialize_cbor_inj
(c1 c2: raw_data_item)
(s1 s2: Seq.seq U8.t)
: Lemma
(requires (serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2))
(ensures (c1 == c2 /\ s1 == s2))
let serialize_cbor_inj'
(c1: raw_data_item)
(s1: Seq.seq U8.t)
: Lemma
(forall c2 s2 . serialize_cbor c1 `Seq.append` s1 == serialize_cbor c2 `Seq.append` s2 ==> (c1 == c2 /\ s1 == s2))
= Classical.forall_intro_2 (fun c2 s2 ->
Classical.move_requires (serialize_cbor_inj c1 c2 s1) s2
)
let serialize_cbor_with_test_correct
(c: raw_data_item)
(suff: Seq.seq U8.t)
(p: (raw_data_item -> Seq.seq U8.t -> prop))
: Lemma
(requires (
~ (p c suff)
))
(ensures (
forall (c': raw_data_item) (suff': Seq.seq U8.t) .
serialize_cbor c `Seq.append` suff == serialize_cbor c' `Seq.append` suff' ==> ~ (p c' suff'))
)
= Classical.forall_intro_2 (fun c' suff' ->
Classical.move_requires (serialize_cbor_inj c c' suff) suff'
)
val serialize_cbor_nonempty
(c: raw_data_item)
: Lemma
(Seq.length (serialize_cbor c) > 0)
(* 4.2.1 Deterministically encoded CBOR: The keys in every map MUST be sorted in the bytewise lexicographic order of their deterministic encodings. *)
val deterministically_encoded_cbor_map_key_order : Ghost.erased (raw_data_item -> raw_data_item -> bool)
val deterministically_encoded_cbor_map_key_order_irrefl
(x: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x x == false)
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x x)]
val deterministically_encoded_cbor_map_key_order_trans
(x y z: raw_data_item)
: Lemma
(requires (Ghost.reveal deterministically_encoded_cbor_map_key_order x y == true /\ Ghost.reveal deterministically_encoded_cbor_map_key_order y z == true))
(ensures (Ghost.reveal deterministically_encoded_cbor_map_key_order x z == true))
[SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order x y); SMTPat (Ghost.reveal deterministically_encoded_cbor_map_key_order y z)]
val deterministically_encoded_cbor_map_key_order_assoc_ext :
(m1: list (raw_data_item & raw_data_item)) ->
(m2: list (raw_data_item & raw_data_item)) ->
(ext: (
(k: raw_data_item) ->
Lemma
(list_ghost_assoc k m1 == list_ghost_assoc k m2)
)) ->
Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m1 /\ List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) m2))
(ensures (m1 == m2))
let list_sorted_map_entry_order_deterministically_encoded_cbor_map_key_order_no_repeats
(#t: Type)
(l: list (raw_data_item & t))
: Lemma
(requires (List.Tot.sorted (map_entry_order deterministically_encoded_cbor_map_key_order _) l))
(ensures (List.Tot.no_repeats_p (List.Tot.map fst l)))
= list_sorted_map_entry_order_no_repeats deterministically_encoded_cbor_map_key_order l
(* Comparisons with unserialized values *)
module U64 = FStar.UInt64
noextract [@@noextract_to "krml"]
let int_compare (x1 x2: int) : Tot int =
if x1 < x2
then -1
else if x1 = x2
then 0
else 1
noextract [@@noextract_to "krml"]
let rec bytes_lex_compare
(s1 s2: Seq.seq U8.t)
: Tot int
(decreases (Seq.length s1))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then int_compare (Seq.length s1) (Seq.length s2)
else
let c = int_compare (U8.v (Seq.index s1 0)) (U8.v (Seq.index s2 0)) in
if c = 0
then bytes_lex_compare (Seq.tail s1) (Seq.tail s2)
else c
let rec bytes_lex_compare_opp
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (bytes_lex_compare s1 s2 == - bytes_lex_compare s2 s1))
(decreases (Seq.length s1 + Seq.length s2))
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_opp (Seq.tail s1) (Seq.tail s2)
let rec bytes_lex_compare_values
(s1 s2: Seq.seq U8.t)
: Lemma
(ensures (let c = bytes_lex_compare s1 s2 in
c == -1 \/ c == 0 \/ c == 1))
(decreases (Seq.length s1))
[SMTPat (bytes_lex_compare s1 s2)]
= if Seq.length s1 = 0 || Seq.length s2 = 0
then ()
else bytes_lex_compare_values (Seq.tail s1) (Seq.tail s2)
val bytes_lex_compare_equal
(s1 s2: Seq.seq U8.t)
: Lemma
(bytes_lex_compare s1 s2 == 0 <==> s1 == s2)
val deterministically_encoded_cbor_map_key_order_spec
(x1 x2: raw_data_item)
: Lemma
(Ghost.reveal deterministically_encoded_cbor_map_key_order x1 x2 == (bytes_lex_compare (serialize_cbor x1) (serialize_cbor x2) < 0)) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.UInt8.fsti.checked",
"FStar.UInt64.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.List.Tot.fst.checked",
"FStar.Ghost.fsti.checked",
"FStar.Classical.fsti.checked",
"CBOR.Spec.Map.fst.checked"
],
"interface_file": false,
"source_file": "CBOR.Spec.fsti"
} | [
{
"abbrev": true,
"full_module": "FStar.UInt64",
"short_module": "U64"
},
{
"abbrev": true,
"full_module": "FStar.UInt8",
"short_module": "U8"
},
{
"abbrev": false,
"full_module": "CBOR.Spec.Map",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": false,
"full_module": "CBOR",
"short_module": null
},
{
"abbrev": 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 |
x1: Prims.list (CBOR.Spec.Type.raw_data_item * CBOR.Spec.Type.raw_data_item) ->
x2: Prims.list (CBOR.Spec.Type.raw_data_item * CBOR.Spec.Type.raw_data_item)
-> Prims.Pure Prims.int | Prims.Pure | [
""
] | [
"cbor_compare",
"cbor_compare_array",
"cbor_compare_map"
] | [
"Prims.list",
"FStar.Pervasives.Native.tuple2",
"CBOR.Spec.Type.raw_data_item",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_disEquality",
"Prims.int",
"Prims.bool",
"CBOR.Spec.cbor_compare_map",
"CBOR.Spec.cbor_compare",
"FStar.Pervasives.Native.snd",
"FStar.Pervasives.Native.fst",
"Prims.eq2",
"Prims.nat",
"FStar.List.Tot.Base.length",
"Prims.l_True"
] | [
"mutual recursion"
] | false | false | false | false | false | let rec cbor_compare_map (x1 x2: list (raw_data_item & raw_data_item))
: Pure int
(requires (List.Tot.length x1 == List.Tot.length x2))
(ensures (fun _ -> True))
(decreases x1) =
| match x1, x2 with
| [], [] -> 0
| a1 :: q1, a2 :: q2 ->
let c = cbor_compare (fst a1) (fst a2) in
if c <> 0
then c
else
let c = cbor_compare (snd a1) (snd a2) in
if c <> 0 then c else cbor_compare_map q1 q2 | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.parse_ifthenelse_eq | val parse_ifthenelse_eq (p: parse_ifthenelse_param) (input: bytes)
: Lemma
(parse (parse_ifthenelse p) input ==
(match parse p.parse_ifthenelse_tag_parser input with
| None -> None
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
match parse (dsnd (p.parse_ifthenelse_payload_parser b)) input' with
| None -> None
| Some (x, consumed_x) -> Some (p.parse_ifthenelse_synth t x, consumed_t + consumed_x))) | val parse_ifthenelse_eq (p: parse_ifthenelse_param) (input: bytes)
: Lemma
(parse (parse_ifthenelse p) input ==
(match parse p.parse_ifthenelse_tag_parser input with
| None -> None
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
match parse (dsnd (p.parse_ifthenelse_payload_parser b)) input' with
| None -> None
| Some (x, consumed_x) -> Some (p.parse_ifthenelse_synth t x, consumed_t + consumed_x))) | let parse_ifthenelse_eq
(p: parse_ifthenelse_param)
(input: bytes)
: Lemma
(parse (parse_ifthenelse p) input == (
match parse p.parse_ifthenelse_tag_parser input with
| None -> None
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
match parse (dsnd (p.parse_ifthenelse_payload_parser b)) input' with
| None -> None
| Some (x, consumed_x) -> Some (p.parse_ifthenelse_synth t x, consumed_t + consumed_x)
))
= and_then_eq p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) input;
match parse p.parse_ifthenelse_tag_parser input with
| None -> ()
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
let f : (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t) -> GTot p.parse_ifthenelse_t) = (p.parse_ifthenelse_synth) t in
let f' = coerce (p.parse_ifthenelse_payload_t b -> GTot p.parse_ifthenelse_t) f in
parse_synth_eq
#(dfst (p.parse_ifthenelse_payload_parser b))
#(p.parse_ifthenelse_payload_t b)
#(p.parse_ifthenelse_t)
(dsnd (p.parse_ifthenelse_payload_parser b)) f' input' | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 62,
"end_line": 89,
"start_col": 0,
"start_line": 63
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p)
let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2)
let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
weaken (parse_ifthenelse_payload_kind p) (parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) (p.parse_ifthenelse_synth t))
let parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param) : Lemma
(and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))]
= and_then_cases_injective_intro
(parse_ifthenelse_payload p)
(fun t1 t2 b1 b2 ->
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) (p.parse_ifthenelse_synth t1) b1;
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) (p.parse_ifthenelse_synth t2) b2;
let Some (x1, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) b1 in
let Some (x2, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) b2 in
p.parse_ifthenelse_synth_injective t1 x1 t2 x2
)
let parse_ifthenelse (p: parse_ifthenelse_param) : Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) =
and_then p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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: LowParse.Spec.IfThenElse.parse_ifthenelse_param -> input: LowParse.Bytes.bytes
-> FStar.Pervasives.Lemma
(ensures
LowParse.Spec.Base.parse (LowParse.Spec.IfThenElse.parse_ifthenelse p) input ==
(match
LowParse.Spec.Base.parse (Mkparse_ifthenelse_param?.parse_ifthenelse_tag_parser p) input
with
| FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None
| FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ t consumed_t) ->
let b = Mkparse_ifthenelse_param?.parse_ifthenelse_tag_cond p t in
let input' = FStar.Seq.Base.slice input consumed_t (FStar.Seq.Base.length input) in
(match
LowParse.Spec.Base.parse (FStar.Pervasives.dsnd (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
b))
input'
with
| FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None
| FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x consumed_x) ->
FStar.Pervasives.Native.Some
(Mkparse_ifthenelse_param?.parse_ifthenelse_synth p t x,
consumed_t + consumed_x))
<:
FStar.Pervasives.Native.option (Mkparse_ifthenelse_param?.parse_ifthenelse_t p *
LowParse.Spec.Base.consumed_length input))) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Bytes.bytes",
"LowParse.Spec.Base.parse",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_parser",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.Combinators.parse_synth_eq",
"FStar.Pervasives.dfst",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"FStar.Pervasives.dsnd",
"LowParse.Spec.Base.coerce",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_synth",
"FStar.Seq.Base.seq",
"LowParse.Bytes.byte",
"FStar.Seq.Base.slice",
"FStar.Seq.Base.length",
"Prims.bool",
"Prims.unit",
"LowParse.Spec.Combinators.and_then_eq",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_kind",
"LowParse.Spec.IfThenElse.parse_ifthenelse_payload_kind",
"LowParse.Spec.IfThenElse.parse_ifthenelse_payload",
"Prims.l_True",
"Prims.squash",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.IfThenElse.parse_ifthenelse",
"FStar.Pervasives.Native.None",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_Addition",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let parse_ifthenelse_eq (p: parse_ifthenelse_param) (input: bytes)
: Lemma
(parse (parse_ifthenelse p) input ==
(match parse p.parse_ifthenelse_tag_parser input with
| None -> None
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
match parse (dsnd (p.parse_ifthenelse_payload_parser b)) input' with
| None -> None
| Some (x, consumed_x) -> Some (p.parse_ifthenelse_synth t x, consumed_t + consumed_x))) =
| and_then_eq p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) input;
match parse p.parse_ifthenelse_tag_parser input with
| None -> ()
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
let f:(p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t) -> GTot p.parse_ifthenelse_t)
=
(p.parse_ifthenelse_synth) t
in
let f' = coerce (p.parse_ifthenelse_payload_t b -> GTot p.parse_ifthenelse_t) f in
parse_synth_eq #(dfst (p.parse_ifthenelse_payload_parser b))
#(p.parse_ifthenelse_payload_t b)
#(p.parse_ifthenelse_t)
(dsnd (p.parse_ifthenelse_payload_parser b))
f'
input' | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.parse_ifthenelse_parse_tag_payload | val parse_ifthenelse_parse_tag_payload
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
(input: bytes)
: Lemma (requires (Some? (parse (parse_ifthenelse p) input)))
(ensures
(let Some (x, _) = parse (parse_ifthenelse p) input in
match parse p.parse_ifthenelse_tag_parser input with
| None -> False
| Some (tg, consumed) ->
let input' = Seq.slice input consumed (Seq.length input) in
match
parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond tg)))
input'
with
| None -> False
| Some (pl, consumed') -> s.serialize_ifthenelse_synth_recip x == (| tg, pl |))) | val parse_ifthenelse_parse_tag_payload
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
(input: bytes)
: Lemma (requires (Some? (parse (parse_ifthenelse p) input)))
(ensures
(let Some (x, _) = parse (parse_ifthenelse p) input in
match parse p.parse_ifthenelse_tag_parser input with
| None -> False
| Some (tg, consumed) ->
let input' = Seq.slice input consumed (Seq.length input) in
match
parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond tg)))
input'
with
| None -> False
| Some (pl, consumed') -> s.serialize_ifthenelse_synth_recip x == (| tg, pl |))) | let parse_ifthenelse_parse_tag_payload
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
(input: bytes)
: Lemma
(requires (Some? (parse (parse_ifthenelse p) input)))
(ensures (
let Some (x, _) = parse (parse_ifthenelse p) input in
match parse p.parse_ifthenelse_tag_parser input with
| None -> False
| Some (tg, consumed) ->
let input' = Seq.slice input consumed (Seq.length input) in
begin match parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond tg))) input' with
| None -> False
| Some (pl, consumed') ->
s.serialize_ifthenelse_synth_recip x == (| tg, pl |)
end
))
= parse_ifthenelse_eq p input;
let Some (t, consumed) = parse p.parse_ifthenelse_tag_parser input in
let input' = Seq.slice input consumed (Seq.length input) in
let Some (t1, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) input' in
serialize_ifthenelse_synth_inverse' s t t1 | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 44,
"end_line": 176,
"start_col": 0,
"start_line": 154
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p)
let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2)
let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
weaken (parse_ifthenelse_payload_kind p) (parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) (p.parse_ifthenelse_synth t))
let parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param) : Lemma
(and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))]
= and_then_cases_injective_intro
(parse_ifthenelse_payload p)
(fun t1 t2 b1 b2 ->
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) (p.parse_ifthenelse_synth t1) b1;
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) (p.parse_ifthenelse_synth t2) b2;
let Some (x1, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) b1 in
let Some (x2, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) b2 in
p.parse_ifthenelse_synth_injective t1 x1 t2 x2
)
let parse_ifthenelse (p: parse_ifthenelse_param) : Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) =
and_then p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p)
let parse_ifthenelse_eq
(p: parse_ifthenelse_param)
(input: bytes)
: Lemma
(parse (parse_ifthenelse p) input == (
match parse p.parse_ifthenelse_tag_parser input with
| None -> None
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
match parse (dsnd (p.parse_ifthenelse_payload_parser b)) input' with
| None -> None
| Some (x, consumed_x) -> Some (p.parse_ifthenelse_synth t x, consumed_t + consumed_x)
))
= and_then_eq p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) input;
match parse p.parse_ifthenelse_tag_parser input with
| None -> ()
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
let f : (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t) -> GTot p.parse_ifthenelse_t) = (p.parse_ifthenelse_synth) t in
let f' = coerce (p.parse_ifthenelse_payload_t b -> GTot p.parse_ifthenelse_t) f in
parse_synth_eq
#(dfst (p.parse_ifthenelse_payload_parser b))
#(p.parse_ifthenelse_payload_t b)
#(p.parse_ifthenelse_t)
(dsnd (p.parse_ifthenelse_payload_parser b)) f' input'
noextract
inline_for_extraction
noeq
type serialize_ifthenelse_param (p: parse_ifthenelse_param) = {
serialize_ifthenelse_tag_serializer: serializer p.parse_ifthenelse_tag_parser;
serialize_ifthenelse_payload_serializer: ((b: bool) -> Tot (serializer (dsnd (p.parse_ifthenelse_payload_parser b))));
serialize_ifthenelse_synth_recip: (p.parse_ifthenelse_t -> GTot ( t: p.parse_ifthenelse_tag_t & (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t))));
serialize_ifthenelse_synth_inverse: (
(x: p.parse_ifthenelse_t) ->
Lemma
(let (| t, y |) = serialize_ifthenelse_synth_recip x in
p.parse_ifthenelse_synth t y == x)
);
}
let bare_serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
: Tot (bare_serializer p.parse_ifthenelse_t)
= fun (d: p.parse_ifthenelse_t) ->
let (| t, y |) = s.serialize_ifthenelse_synth_recip d in
Seq.append (serialize s.serialize_ifthenelse_tag_serializer t) (serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y)
let bare_serialize_ifthenelse_correct
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
: Lemma
(requires (p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong))
(ensures (serializer_correct (parse_ifthenelse p) (bare_serialize_ifthenelse s)))
= let prf
(x: p.parse_ifthenelse_t)
: Lemma
(let sq = bare_serialize_ifthenelse s x in
parse (parse_ifthenelse p) sq == Some (x, Seq.length sq))
= let sq = bare_serialize_ifthenelse s x in
parse_ifthenelse_eq p sq;
let (| t, y |) = s.serialize_ifthenelse_synth_recip x in
let sqt = serialize s.serialize_ifthenelse_tag_serializer t in
let sqp = serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y in
parse_strong_prefix p.parse_ifthenelse_tag_parser sqt sq;
assert (Seq.slice sq (Seq.length sqt) (Seq.length sq) `Seq.equal` sqp);
s.serialize_ifthenelse_synth_inverse x
in
Classical.forall_intro prf
let serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p { p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong } )
: Tot (serializer (parse_ifthenelse p))
= bare_serialize_ifthenelse_correct s;
bare_serialize_ifthenelse s
let serialize_ifthenelse_synth_inverse'
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
(tg: p.parse_ifthenelse_tag_t)
(pl: p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond tg))
: Lemma
(s.serialize_ifthenelse_synth_recip (p.parse_ifthenelse_synth tg pl) == (| tg, pl |))
= let (| tg', pl' |) = s.serialize_ifthenelse_synth_recip (p.parse_ifthenelse_synth tg pl) in
s.serialize_ifthenelse_synth_inverse (p.parse_ifthenelse_synth tg pl);
p.parse_ifthenelse_synth_injective tg pl tg' pl' | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: LowParse.Spec.IfThenElse.serialize_ifthenelse_param p -> input: LowParse.Bytes.bytes
-> FStar.Pervasives.Lemma
(requires Some? (LowParse.Spec.Base.parse (LowParse.Spec.IfThenElse.parse_ifthenelse p) input)
)
(ensures
(let _ = LowParse.Spec.Base.parse (LowParse.Spec.IfThenElse.parse_ifthenelse p) input in
(let FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ x _) = _ in
(match
LowParse.Spec.Base.parse (Mkparse_ifthenelse_param?.parse_ifthenelse_tag_parser p)
input
with
| FStar.Pervasives.Native.None #_ -> Prims.l_False
| FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ tg consumed) ->
let input' = FStar.Seq.Base.slice input consumed (FStar.Seq.Base.length input) in
(match
LowParse.Spec.Base.parse (FStar.Pervasives.dsnd (Mkparse_ifthenelse_param?.parse_ifthenelse_payload_parser
p
(Mkparse_ifthenelse_param?.parse_ifthenelse_tag_cond p tg)))
input'
with
| FStar.Pervasives.Native.None #_ -> Prims.l_False
| FStar.Pervasives.Native.Some #_ (FStar.Pervasives.Native.Mktuple2 #_ #_ pl _) ->
Mkserialize_ifthenelse_param?.serialize_ifthenelse_synth_recip s x ==
(| tg, pl |))
<:
Type0)
<:
Type0)
<:
Type0)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.IfThenElse.serialize_ifthenelse_param",
"LowParse.Bytes.bytes",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"LowParse.Spec.IfThenElse.serialize_ifthenelse_synth_inverse'",
"Prims.unit",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.parse",
"FStar.Pervasives.dsnd",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser",
"FStar.Seq.Base.seq",
"LowParse.Bytes.byte",
"FStar.Seq.Base.slice",
"FStar.Seq.Base.length",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_parser",
"LowParse.Spec.IfThenElse.parse_ifthenelse_eq",
"Prims.b2t",
"FStar.Pervasives.Native.uu___is_Some",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"LowParse.Spec.IfThenElse.parse_ifthenelse",
"Prims.squash",
"Prims.l_False",
"Prims.eq2",
"Prims.dtuple2",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_synth_recip",
"Prims.Mkdtuple2",
"Prims.Nil",
"FStar.Pervasives.pattern"
] | [] | false | false | true | false | false | let parse_ifthenelse_parse_tag_payload
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
(input: bytes)
: Lemma (requires (Some? (parse (parse_ifthenelse p) input)))
(ensures
(let Some (x, _) = parse (parse_ifthenelse p) input in
match parse p.parse_ifthenelse_tag_parser input with
| None -> False
| Some (tg, consumed) ->
let input' = Seq.slice input consumed (Seq.length input) in
match
parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond tg)))
input'
with
| None -> False
| Some (pl, consumed') -> s.serialize_ifthenelse_synth_recip x == (| tg, pl |))) =
| parse_ifthenelse_eq p input;
let Some (t, consumed) = parse p.parse_ifthenelse_tag_parser input in
let input' = Seq.slice input consumed (Seq.length input) in
let Some (t1, _) =
parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) input'
in
serialize_ifthenelse_synth_inverse' s t t1 | false |
LowParse.Spec.IfThenElse.fst | LowParse.Spec.IfThenElse.bare_serialize_ifthenelse_correct | val bare_serialize_ifthenelse_correct (#p: parse_ifthenelse_param) (s: serialize_ifthenelse_param p)
: Lemma (requires (p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong))
(ensures (serializer_correct (parse_ifthenelse p) (bare_serialize_ifthenelse s))) | val bare_serialize_ifthenelse_correct (#p: parse_ifthenelse_param) (s: serialize_ifthenelse_param p)
: Lemma (requires (p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong))
(ensures (serializer_correct (parse_ifthenelse p) (bare_serialize_ifthenelse s))) | let bare_serialize_ifthenelse_correct
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
: Lemma
(requires (p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong))
(ensures (serializer_correct (parse_ifthenelse p) (bare_serialize_ifthenelse s)))
= let prf
(x: p.parse_ifthenelse_t)
: Lemma
(let sq = bare_serialize_ifthenelse s x in
parse (parse_ifthenelse p) sq == Some (x, Seq.length sq))
= let sq = bare_serialize_ifthenelse s x in
parse_ifthenelse_eq p sq;
let (| t, y |) = s.serialize_ifthenelse_synth_recip x in
let sqt = serialize s.serialize_ifthenelse_tag_serializer t in
let sqp = serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y in
parse_strong_prefix p.parse_ifthenelse_tag_parser sqt sq;
assert (Seq.slice sq (Seq.length sqt) (Seq.length sq) `Seq.equal` sqp);
s.serialize_ifthenelse_synth_inverse x
in
Classical.forall_intro prf | {
"file_name": "src/lowparse/LowParse.Spec.IfThenElse.fst",
"git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa",
"git_url": "https://github.com/project-everest/everparse.git",
"project_name": "everparse"
} | {
"end_col": 28,
"end_line": 134,
"start_col": 0,
"start_line": 114
} | module LowParse.Spec.IfThenElse
include LowParse.Spec.Combinators
module Seq = FStar.Seq
[@@(noextract_to "krml")]
inline_for_extraction
noeq
type parse_ifthenelse_param = {
parse_ifthenelse_tag_kind: parser_kind;
parse_ifthenelse_tag_t: Type;
parse_ifthenelse_tag_parser: parser parse_ifthenelse_tag_kind parse_ifthenelse_tag_t;
parse_ifthenelse_tag_cond: (parse_ifthenelse_tag_t -> Tot bool);
parse_ifthenelse_payload_t: (bool -> Tot Type);
parse_ifthenelse_payload_parser: ((b: bool) -> Tot (k: parser_kind & parser k (parse_ifthenelse_payload_t b)));
parse_ifthenelse_t: Type;
parse_ifthenelse_synth: ((t: parse_ifthenelse_tag_t) -> (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t)) -> GTot parse_ifthenelse_t);
parse_ifthenelse_synth_injective: (
(t1: parse_ifthenelse_tag_t) ->
(x1: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t1)) ->
(t2: parse_ifthenelse_tag_t) ->
(x2: parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) ->
Lemma
(requires (parse_ifthenelse_synth t1 x1 == parse_ifthenelse_synth t2 x2))
(ensures (t1 == t2 /\ coerce (parse_ifthenelse_payload_t (parse_ifthenelse_tag_cond t2)) x1 == x2))
);
}
inline_for_extraction
let parse_ifthenelse_payload_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= glb (dfst (p.parse_ifthenelse_payload_parser true)) (dfst (p.parse_ifthenelse_payload_parser false))
inline_for_extraction
let parse_ifthenelse_kind
(p: parse_ifthenelse_param)
: Tot parser_kind
= and_then_kind p.parse_ifthenelse_tag_kind (parse_ifthenelse_payload_kind p)
let parse_ifthenelse_synth_injective (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Lemma (synth_injective (p.parse_ifthenelse_synth t)) [SMTPat (synth_injective (p.parse_ifthenelse_synth t))] =
Classical.forall_intro_2 (fun x1 x2 -> Classical.move_requires (p.parse_ifthenelse_synth_injective t x1 t) x2)
let parse_ifthenelse_payload (p: parse_ifthenelse_param) (t: p.parse_ifthenelse_tag_t) : Tot (parser (parse_ifthenelse_payload_kind p) p.parse_ifthenelse_t) =
weaken (parse_ifthenelse_payload_kind p) (parse_synth (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t))) (p.parse_ifthenelse_synth t))
let parse_ifthenelse_payload_and_then_cases_injective (p: parse_ifthenelse_param) : Lemma
(and_then_cases_injective (parse_ifthenelse_payload p))
[SMTPat (and_then_cases_injective (parse_ifthenelse_payload p))]
= and_then_cases_injective_intro
(parse_ifthenelse_payload p)
(fun t1 t2 b1 b2 ->
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) (p.parse_ifthenelse_synth t1) b1;
parse_synth_eq (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) (p.parse_ifthenelse_synth t2) b2;
let Some (x1, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t1))) b1 in
let Some (x2, _) = parse (dsnd (p.parse_ifthenelse_payload_parser (p.parse_ifthenelse_tag_cond t2))) b2 in
p.parse_ifthenelse_synth_injective t1 x1 t2 x2
)
let parse_ifthenelse (p: parse_ifthenelse_param) : Tot (parser (parse_ifthenelse_kind p) p.parse_ifthenelse_t) =
and_then p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p)
let parse_ifthenelse_eq
(p: parse_ifthenelse_param)
(input: bytes)
: Lemma
(parse (parse_ifthenelse p) input == (
match parse p.parse_ifthenelse_tag_parser input with
| None -> None
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
match parse (dsnd (p.parse_ifthenelse_payload_parser b)) input' with
| None -> None
| Some (x, consumed_x) -> Some (p.parse_ifthenelse_synth t x, consumed_t + consumed_x)
))
= and_then_eq p.parse_ifthenelse_tag_parser (parse_ifthenelse_payload p) input;
match parse p.parse_ifthenelse_tag_parser input with
| None -> ()
| Some (t, consumed_t) ->
let b = p.parse_ifthenelse_tag_cond t in
let input' = Seq.slice input consumed_t (Seq.length input) in
let f : (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t) -> GTot p.parse_ifthenelse_t) = (p.parse_ifthenelse_synth) t in
let f' = coerce (p.parse_ifthenelse_payload_t b -> GTot p.parse_ifthenelse_t) f in
parse_synth_eq
#(dfst (p.parse_ifthenelse_payload_parser b))
#(p.parse_ifthenelse_payload_t b)
#(p.parse_ifthenelse_t)
(dsnd (p.parse_ifthenelse_payload_parser b)) f' input'
noextract
inline_for_extraction
noeq
type serialize_ifthenelse_param (p: parse_ifthenelse_param) = {
serialize_ifthenelse_tag_serializer: serializer p.parse_ifthenelse_tag_parser;
serialize_ifthenelse_payload_serializer: ((b: bool) -> Tot (serializer (dsnd (p.parse_ifthenelse_payload_parser b))));
serialize_ifthenelse_synth_recip: (p.parse_ifthenelse_t -> GTot ( t: p.parse_ifthenelse_tag_t & (p.parse_ifthenelse_payload_t (p.parse_ifthenelse_tag_cond t))));
serialize_ifthenelse_synth_inverse: (
(x: p.parse_ifthenelse_t) ->
Lemma
(let (| t, y |) = serialize_ifthenelse_synth_recip x in
p.parse_ifthenelse_synth t y == x)
);
}
let bare_serialize_ifthenelse
(#p: parse_ifthenelse_param)
(s: serialize_ifthenelse_param p)
: Tot (bare_serializer p.parse_ifthenelse_t)
= fun (d: p.parse_ifthenelse_t) ->
let (| t, y |) = s.serialize_ifthenelse_synth_recip d in
Seq.append (serialize s.serialize_ifthenelse_tag_serializer t) (serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"LowParse.Spec.Combinators.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Classical.fsti.checked"
],
"interface_file": false,
"source_file": "LowParse.Spec.IfThenElse.fst"
} | [
{
"abbrev": true,
"full_module": "FStar.Seq",
"short_module": "Seq"
},
{
"abbrev": false,
"full_module": "LowParse.Spec.Combinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "LowParse.Spec",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 8,
"max_ifuel": 2,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": true,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 5,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | s: LowParse.Spec.IfThenElse.serialize_ifthenelse_param p
-> FStar.Pervasives.Lemma
(requires
Mkparser_kind'?.parser_kind_subkind (Mkparse_ifthenelse_param?.parse_ifthenelse_tag_kind p) ==
FStar.Pervasives.Native.Some LowParse.Spec.Base.ParserStrong)
(ensures
LowParse.Spec.Base.serializer_correct (LowParse.Spec.IfThenElse.parse_ifthenelse p)
(LowParse.Spec.IfThenElse.bare_serialize_ifthenelse s)) | FStar.Pervasives.Lemma | [
"lemma"
] | [] | [
"LowParse.Spec.IfThenElse.parse_ifthenelse_param",
"LowParse.Spec.IfThenElse.serialize_ifthenelse_param",
"FStar.Classical.forall_intro",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_t",
"Prims.eq2",
"FStar.Pervasives.Native.option",
"FStar.Pervasives.Native.tuple2",
"LowParse.Spec.Base.consumed_length",
"LowParse.Spec.IfThenElse.bare_serialize_ifthenelse",
"LowParse.Spec.Base.parse",
"LowParse.Spec.IfThenElse.parse_ifthenelse",
"FStar.Pervasives.Native.Some",
"FStar.Pervasives.Native.Mktuple2",
"FStar.Seq.Base.length",
"LowParse.Bytes.byte",
"Prims.unit",
"Prims.l_True",
"Prims.squash",
"Prims.Nil",
"FStar.Pervasives.pattern",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_t",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_cond",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_synth_inverse",
"Prims._assert",
"FStar.Seq.Base.equal",
"FStar.Seq.Base.slice",
"LowParse.Spec.Base.parse_strong_prefix",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_kind",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_tag_parser",
"LowParse.Bytes.bytes",
"LowParse.Spec.Base.serialize",
"Prims.__proj__Mkdtuple2__item___1",
"LowParse.Spec.Base.parser_kind",
"LowParse.Spec.Base.parser",
"LowParse.Spec.IfThenElse.__proj__Mkparse_ifthenelse_param__item__parse_ifthenelse_payload_parser",
"FStar.Pervasives.dsnd",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_payload_serializer",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_tag_serializer",
"Prims.dtuple2",
"LowParse.Spec.IfThenElse.__proj__Mkserialize_ifthenelse_param__item__serialize_ifthenelse_synth_recip",
"LowParse.Spec.IfThenElse.parse_ifthenelse_eq",
"LowParse.Spec.Base.parser_subkind",
"LowParse.Spec.Base.__proj__Mkparser_kind'__item__parser_kind_subkind",
"LowParse.Spec.Base.ParserStrong",
"LowParse.Spec.Base.serializer_correct",
"LowParse.Spec.IfThenElse.parse_ifthenelse_kind"
] | [] | false | false | true | false | false | let bare_serialize_ifthenelse_correct (#p: parse_ifthenelse_param) (s: serialize_ifthenelse_param p)
: Lemma (requires (p.parse_ifthenelse_tag_kind.parser_kind_subkind == Some ParserStrong))
(ensures (serializer_correct (parse_ifthenelse p) (bare_serialize_ifthenelse s))) =
| let prf (x: p.parse_ifthenelse_t)
: Lemma
(let sq = bare_serialize_ifthenelse s x in
parse (parse_ifthenelse p) sq == Some (x, Seq.length sq)) =
let sq = bare_serialize_ifthenelse s x in
parse_ifthenelse_eq p sq;
let (| t , y |) = s.serialize_ifthenelse_synth_recip x in
let sqt = serialize s.serialize_ifthenelse_tag_serializer t in
let sqp =
serialize (s.serialize_ifthenelse_payload_serializer (p.parse_ifthenelse_tag_cond t)) y
in
parse_strong_prefix p.parse_ifthenelse_tag_parser sqt sq;
assert ((Seq.slice sq (Seq.length sqt) (Seq.length sq)) `Seq.equal` sqp);
s.serialize_ifthenelse_synth_inverse x
in
Classical.forall_intro prf | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.valid_m_spec | val valid_m_spec : a: Spec.Blake2.Definitions.alg -> Type0 | let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m} | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 70,
"end_line": 30,
"start_col": 0,
"start_line": 30
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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: Spec.Blake2.Definitions.alg -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.m_spec",
"Prims.b2t",
"Hacl.Impl.Blake2.Generic.is_valid_blake2_config"
] | [] | false | false | false | true | true | let valid_m_spec (a: Spec.alg) =
| m: m_spec{is_valid_blake2_config a m} | false |
|
Vale.SHA.PPC64LE.Rounds.fst | Vale.SHA.PPC64LE.Rounds.va_lemma_Loop_rounds_48_63 | val va_lemma_Loop_rounds_48_63 : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 -> block:block_w
-> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_48_63 ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 6 va_s0 + 48 < pow2_64 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 48 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 48))) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 48)
((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 33)) ((va_get_vec 2
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 34)) ((va_get_vec 3 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 35)) ((va_get_vec 4 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 36)) ((va_get_vec 5 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 37)) ((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 38)) ((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 39)) ((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 40)) ((va_get_vec 9 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 41)) ((va_get_vec 10 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 42)) ((va_get_vec 11 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 43)) ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 44)) ((va_get_vec 13 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45)) ((va_get_vec 14 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46)) ((va_get_vec 15 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 49) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 50)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 51)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 48 /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig) /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM
(va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM
(va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM
(va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0))))))))))))))))))))))))))))))) | val va_lemma_Loop_rounds_48_63 : va_b0:va_code -> va_s0:va_state -> k_b:buffer128 -> block:block_w
-> hash_orig:hash256
-> Ghost (va_state & va_fuel)
(requires (va_require_total va_b0 (va_code_Loop_rounds_48_63 ()) va_s0 /\ va_get_ok va_s0 /\
(Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 16
(va_get_mem_layout va_s0) Secret /\ Vale.PPC64LE.Decls.validSrcAddrsOffset128
(va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b in
Vale.SHA.PPC64LE.SHA_helpers.k_reqs ks /\ va_get_reg 6 va_s0 + 48 < pow2_64 /\ (let hash =
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 48 block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32
(FStar.Seq.Base.index #Vale.SHA.PPC64LE.SHA_helpers.word hash 0)) ((va_get_vec 17 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 1))) ((va_get_vec 18 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 2))) ((va_get_vec 19 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 3))) ((va_get_vec 20 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 4))) ((va_get_vec 21 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 5))) ((va_get_vec 22 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 6))) ((va_get_vec 23 va_s0).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 48))) /\
l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 48)
((va_get_vec 1 va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 33)) ((va_get_vec 2
va_s0).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 34)) ((va_get_vec 3 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 35)) ((va_get_vec 4 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 36)) ((va_get_vec 5 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 37)) ((va_get_vec 6 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 38)) ((va_get_vec 7 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 39)) ((va_get_vec 8 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 40)) ((va_get_vec 9 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 41)) ((va_get_vec 10 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 42)) ((va_get_vec 11 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 43)) ((va_get_vec 12 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 44)) ((va_get_vec 13 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 45)) ((va_get_vec 14 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 46)) ((va_get_vec 15 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 47) /\ l_and (l_and ((va_get_vec 24 va_s0).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 49) ((va_get_vec 24 va_s0).hi2 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 50)) ((va_get_vec 24 va_s0).lo1 ==
Vale.SHA.PPC64LE.SHA_helpers.k_index ks 51)))))
(ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\ va_get_ok va_sM /\
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 48 /\
Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig) /\ va_state_eq va_sM
(va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM
(va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM
(va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM
(va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM
(va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM
(va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM
(va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_reg 6 va_sM
(va_update_ok va_sM va_s0))))))))))))))))))))))))))))))) | let va_lemma_Loop_rounds_48_63 va_b0 va_s0 k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_48_63 va_mods k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_48_63 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 211 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 249 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 250 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17
va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)
(va_get_vec 22 va_sM) (va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM) | {
"file_name": "obj/Vale.SHA.PPC64LE.Rounds.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 391,
"start_col": 0,
"start_line": 367
} | module Vale.SHA.PPC64LE.Rounds
open Vale.Def.Opaque_s
open Vale.Def.Types_s
open Vale.Def.Words_s
open Vale.Def.Words.Seq_s
open FStar.Seq
open Vale.Arch.Types
open Vale.Arch.HeapImpl
open Vale.PPC64LE.Machine_s
open Vale.PPC64LE.Memory
open Vale.PPC64LE.Stack_i
open Vale.PPC64LE.State
open Vale.PPC64LE.Decls
open Vale.PPC64LE.QuickCode
open Vale.PPC64LE.QuickCodes
open Vale.PPC64LE.InsBasic
open Vale.PPC64LE.InsMem
open Vale.PPC64LE.InsStack
open Vale.PPC64LE.InsVector
open Vale.SHA.PPC64LE.SHA_helpers
open Spec.SHA2
open Spec.Agile.Hash
open Spec.Hash.Definitions
open Spec.Loops
open Vale.SHA.PPC64LE.Rounds.Core
open Vale.SHA2.Wrapper
#reset-options "--z3rlimit 2000"
//-- Loop_rounds_0_15
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_0_15 () =
(va_Block (va_CCons (va_code_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_CCons
(va_code_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_CCons (va_Block (va_CNil ()))
(va_CCons (va_Block (va_CNil ())) (va_CCons (va_Block (va_CNil ())) (va_CCons
(va_code_Loop_rounds_1_3 ()) (va_CCons (va_code_Loop_rounds_0_59_a 0) (va_CCons
(va_code_Loop_rounds_5_7 ()) (va_CCons (va_code_Loop_rounds_0_59_b 4) (va_CCons
(va_code_Loop_rounds_9_11 ()) (va_CCons (va_code_Loop_rounds_0_59_c 8) (va_CCons
(va_code_Loop_rounds_13_15 ()) (va_CCons (va_code_Loop_rounds_0_59_d 12) (va_CCons
(va_code_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_CNil ())))))))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_0_15 () =
(va_pbool_and (va_codegen_success_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8)) (va_pbool_and
(va_codegen_success_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12)) (va_pbool_and
(va_codegen_success_Loop_rounds_1_3 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_a 0)
(va_pbool_and (va_codegen_success_Loop_rounds_5_7 ()) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 4) (va_pbool_and (va_codegen_success_Loop_rounds_9_11
()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_c 8) (va_pbool_and
(va_codegen_success_Loop_rounds_13_15 ()) (va_pbool_and (va_codegen_success_Loop_rounds_0_59_d
12) (va_pbool_and (va_codegen_success_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0)
(va_op_vec_opr_vec 1) (va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14)) (va_ttrue ())))))))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_0_15 (va_mods:va_mods_t) (in_b:buffer128) (offset:nat) (k_b:buffer128)
(block:block_w) (hash_orig:hash256) (input_BE:(seq quad32)) : (va_quickCode unit
(va_code_Loop_rounds_0_15 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let
(va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = input_BE in va_qPURE va_range1
"***** PRECONDITION NOT MET AT line 115 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_quads_to_block_be va_arg34) (va_QSeq
va_range1
"***** PRECONDITION NOT MET AT line 117 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 3 (va_op_vec_opr_vec 4) in_b (offset + 1)) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 118 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 7 (va_op_vec_opr_vec 8) in_b (offset + 2)) (va_QBind
va_range1
"***** PRECONDITION NOT MET AT line 119 column 28 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_3_7_11_body 11 (va_op_vec_opr_vec 12) in_b (offset + 3)) (fun
(va_s:va_state) _ -> va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 1) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 120 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 4 va_s == FStar.Seq.Base.index #quad32 input_BE 1) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 2) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 121 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 8 va_s == FStar.Seq.Base.index #quad32 input_BE 2) (va_qAssertSquash va_range1
"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
((fun a_539 (s_540:(FStar.Seq.Base.seq a_539)) (i_541:Prims.nat) -> let (i_515:Prims.nat) =
i_541 in Prims.b2t (Prims.op_LessThan i_515 (FStar.Seq.Base.length #a_539 s_540))) quad32
input_BE 3) (fun _ -> va_qAssert va_range1
"***** PRECONDITION NOT MET AT line 122 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_vec 12 va_s == FStar.Seq.Base.index #quad32 input_BE 3) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 124 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_1_3 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 125 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 0 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 127 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_5_7 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 128 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 4 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 130 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_9_11 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 131 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 8 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 133 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_13_15 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 134 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d 12 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 136 column 27 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_63_body 16 (va_op_vec_opr_vec 0) (va_op_vec_opr_vec 1)
(va_op_vec_opr_vec 9) (va_op_vec_opr_vec 14) block) (va_QEmpty (()))))))))))))))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_0_15 va_b0 va_s0 in_b offset k_b block hash_orig input_BE =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_0_15 va_mods in_b offset k_b block hash_orig input_BE in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_0_15 ()) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 95 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 96 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 48) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 97 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label
va_range1
"***** POSTCONDITION NOT MET AT line 106 column 85 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale 16 block hash_orig in l_and
(l_and (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 0)) ((va_get_vec 17 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 2))) ((va_get_vec 19 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 3))) ((va_get_vec 20 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 4))) ((va_get_vec 21 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 6))) ((va_get_vec 23 va_sM).hi3 ==
Vale.Arch.Types.add_wrap32 (Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32 (FStar.Seq.Base.index
#Vale.SHA.PPC64LE.SHA_helpers.word next_hash 7)) (Vale.SHA.PPC64LE.SHA_helpers.k_index ks 16)))
/\ label va_range1
"***** POSTCONDITION NOT MET AT line 112 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 16)
((va_get_vec 1 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 1)) ((va_get_vec 2
va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 2)) ((va_get_vec 3 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 3)) ((va_get_vec 4 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 4)) ((va_get_vec 5 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 5)) ((va_get_vec 6 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 6)) ((va_get_vec 7 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 7)) ((va_get_vec 8 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 8)) ((va_get_vec 9 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 9)) ((va_get_vec 10 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 10)) ((va_get_vec 11 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 11)) ((va_get_vec 12 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 12)) ((va_get_vec 13 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 13)) ((va_get_vec 14 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 14)) ((va_get_vec 15 va_sM).hi3 ==
Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block 15)) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 113 column 92 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 17)
((va_get_vec 24 va_sM).hi2 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 18)) ((va_get_vec 24
va_sM).lo1 == Vale.SHA.PPC64LE.SHA_helpers.k_index ks 19))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4; va_Mod_ok]) va_sM
va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_0_15 in_b offset k_b block hash_orig input_BE va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_0_15 (va_code_Loop_rounds_0_15 ()) va_s0 in_b offset
k_b block hash_orig input_BE in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_reg 4 va_sM (va_update_ok va_sM
va_s0)))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_reg 4]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_16_47
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_16_47 i =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a i) (va_CCons (va_code_Loop_rounds_0_59_a i)
(va_CCons (va_code_Loop_rounds_16_59_b (i + 4)) (va_CCons (va_code_Loop_rounds_0_59_b (i + 4))
(va_CCons (va_code_Loop_rounds_16_59_c (i + 8)) (va_CCons (va_code_Loop_rounds_0_59_c (i + 8))
(va_CCons (va_code_Loop_rounds_16_59_d (i + 12)) (va_CCons (va_code_Loop_rounds_0_59_d (i +
12)) (va_CNil ()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_16_47 i =
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_a i)
(va_codegen_success_Loop_rounds_16_59_a i)) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a i) (va_codegen_success_Loop_rounds_0_59_a i))
(va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_b (i + 4))
(va_codegen_success_Loop_rounds_16_59_b (i + 4))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b (i + 4)) (va_codegen_success_Loop_rounds_0_59_b (i +
4))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_c (i + 8))
(va_codegen_success_Loop_rounds_16_59_c (i + 8))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c (i + 8)) (va_codegen_success_Loop_rounds_0_59_c (i +
8))) (va_pbool_and (va_pbool_and (va_codegen_success_Loop_rounds_16_59_d (i + 12))
(va_codegen_success_Loop_rounds_16_59_d (i + 12))) (va_pbool_and (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_d (i + 12)) (va_codegen_success_Loop_rounds_0_59_d (i +
12))) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_16_47 (va_mods:va_mods_t) (i:nat) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_16_47 i)) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 198 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a i block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 199 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a i k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 201 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b (i + 4) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 202 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b (i + 4) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 204 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c (i + 8) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 205 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c (i + 8) k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 207 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_d (i + 12) block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 208 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_d (i + 12) k_b block hash_orig) (va_QEmpty (())))))))))))
[@"opaque_to_smt"]
let va_lemma_Loop_rounds_16_47 va_b0 va_s0 i k_b block hash_orig =
let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec
22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok] in
let va_qc = va_qcode_Loop_rounds_16_47 va_mods i k_b block hash_orig in
let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_47 i) va_qc va_s0 (fun
va_s0 va_sM va_g -> let () = va_g in label va_range1
"***** POSTCONDITION NOT MET AT line 139 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\ (label va_range1
"***** POSTCONDITION NOT MET AT line 179 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 64) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let ks = buffer128_as_seq (va_get_mem_heaplet 0 va_sM) k_b in label va_range1
"***** POSTCONDITION NOT MET AT line 189 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(let next_hash = repeat_range_vale (i + 16) block hash_orig in l_and (l_and (l_and (l_and
(l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 == word_to_nat32 (index next_hash 0))
((va_get_vec 17 va_sM).hi3 == word_to_nat32 (index next_hash 1))) ((va_get_vec 18 va_sM).hi3 ==
word_to_nat32 (index next_hash 2))) ((va_get_vec 19 va_sM).hi3 == word_to_nat32 (index
next_hash 3))) ((va_get_vec 20 va_sM).hi3 == word_to_nat32 (index next_hash 4))) ((va_get_vec
21 va_sM).hi3 == word_to_nat32 (index next_hash 5))) ((va_get_vec 22 va_sM).hi3 ==
word_to_nat32 (index next_hash 6))) ((va_get_vec 23 va_sM).hi3 == add_wrap32 (word_to_nat32
(index next_hash 7)) (k_index ks (i + 16)))) /\ label va_range1
"***** POSTCONDITION NOT MET AT line 195 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and
(l_and (l_and ((va_get_vec 0 va_sM).hi3 == ws_opaque block (i + 16)) ((va_get_vec 1 va_sM).hi3
== ws_opaque block (i + 1))) ((va_get_vec 2 va_sM).hi3 == ws_opaque block (i + 2)))
((va_get_vec 3 va_sM).hi3 == ws_opaque block (i + 3))) ((va_get_vec 4 va_sM).hi3 == ws_opaque
block (i + 4))) ((va_get_vec 5 va_sM).hi3 == ws_opaque block (i + 5))) ((va_get_vec 6
va_sM).hi3 == ws_opaque block (i + 6))) ((va_get_vec 7 va_sM).hi3 == ws_opaque block (i + 7)))
((va_get_vec 8 va_sM).hi3 == ws_opaque block (i + 8))) ((va_get_vec 9 va_sM).hi3 == ws_opaque
block (i + 9))) ((va_get_vec 10 va_sM).hi3 == ws_opaque block (i + 10))) ((va_get_vec 11
va_sM).hi3 == ws_opaque block (i + 11))) ((va_get_vec 12 va_sM).hi3 == ws_opaque block (i +
12))) ((va_get_vec 13 va_sM).hi3 == ws_opaque block (i + 13))) ((va_get_vec 14 va_sM).hi3 ==
ws_opaque block (i + 14))) ((va_get_vec 15 va_sM).hi3 == ws_opaque block (i + 15))) /\ label
va_range1
"***** POSTCONDITION NOT MET AT line 196 column 98 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(l_and (l_and ((va_get_vec 24 va_sM).hi3 == k_index ks (i + 17)) ((va_get_vec 24 va_sM).hi2 ==
k_index ks (i + 18))) ((va_get_vec 24 va_sM).lo1 == k_index ks (i + 19)))))) in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok]) va_sM va_s0;
(va_sM, va_fM)
[@"opaque_to_smt"]
let va_wpProof_Loop_rounds_16_47 i k_b block hash_orig va_s0 va_k =
let (va_sM, va_f0) = va_lemma_Loop_rounds_16_47 (va_code_Loop_rounds_16_47 i) va_s0 i k_b block
hash_orig in
va_lemma_upd_update va_sM;
assert (va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM
(va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM
(va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM
(va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM
(va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM
(va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM
(va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM
(va_update_reg 6 va_sM (va_update_ok va_sM va_s0))))))))))))))))))))))))))))));
va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;
va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;
va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;
va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec
3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6]) va_sM va_s0;
let va_g = () in
(va_sM, va_f0, va_g)
//--
//-- Loop_rounds_48_63
[@ "opaque_to_smt" va_qattr]
let va_code_Loop_rounds_48_63 () =
(va_Block (va_CCons (va_code_Loop_rounds_16_59_a 48) (va_CCons (va_code_Loop_rounds_0_59_a 48)
(va_CCons (va_code_Loop_rounds_16_59_b 52) (va_CCons (va_code_Loop_rounds_0_59_b 52) (va_CCons
(va_code_Loop_rounds_16_59_c 56) (va_CCons (va_code_Loop_rounds_0_59_c 56) (va_CCons
(va_code_Loop_rounds_60_63_a ()) (va_CCons (va_code_Loop_rounds_60_63_b ()) (va_CNil
()))))))))))
[@ "opaque_to_smt" va_qattr]
let va_codegen_success_Loop_rounds_48_63 () =
(va_pbool_and (va_codegen_success_Loop_rounds_16_59_a 48) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_a 48) (va_pbool_and
(va_codegen_success_Loop_rounds_16_59_b 52) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_b 52) (va_pbool_and
(va_codegen_success_Loop_rounds_16_59_c 56) (va_pbool_and
(va_codegen_success_Loop_rounds_0_59_c 56) (va_pbool_and
(va_codegen_success_Loop_rounds_60_63_a ()) (va_pbool_and
(va_codegen_success_Loop_rounds_60_63_b ()) (va_ttrue ())))))))))
[@ "opaque_to_smt" va_qattr]
let va_qcode_Loop_rounds_48_63 (va_mods:va_mods_t) (k_b:buffer128) (block:block_w)
(hash_orig:hash256) : (va_quickCode unit (va_code_Loop_rounds_48_63 ())) =
(qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 252 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_a 48 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 253 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_a 48 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 255 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_b 52 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 256 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_b 52 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 258 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_16_59_c 56 block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 259 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_0_59_c 56 k_b block hash_orig) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 261 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_60_63_a block) (va_QSeq va_range1
"***** PRECONDITION NOT MET AT line 262 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_quick_Loop_rounds_60_63_b k_b block hash_orig) (va_QEmpty (()))))))))))) | {
"checked_file": "/",
"dependencies": [
"Vale.SHA2.Wrapper.fsti.checked",
"Vale.SHA.PPC64LE.SHA_helpers.fsti.checked",
"Vale.SHA.PPC64LE.Rounds.Core.fsti.checked",
"Vale.PPC64LE.State.fsti.checked",
"Vale.PPC64LE.Stack_i.fsti.checked",
"Vale.PPC64LE.QuickCodes.fsti.checked",
"Vale.PPC64LE.QuickCode.fst.checked",
"Vale.PPC64LE.Memory.fsti.checked",
"Vale.PPC64LE.Machine_s.fst.checked",
"Vale.PPC64LE.InsVector.fsti.checked",
"Vale.PPC64LE.InsStack.fsti.checked",
"Vale.PPC64LE.InsMem.fsti.checked",
"Vale.PPC64LE.InsBasic.fsti.checked",
"Vale.PPC64LE.Decls.fsti.checked",
"Vale.Def.Words_s.fsti.checked",
"Vale.Def.Words.Seq_s.fsti.checked",
"Vale.Def.Types_s.fst.checked",
"Vale.Def.Opaque_s.fsti.checked",
"Vale.Arch.Types.fsti.checked",
"Vale.Arch.HeapImpl.fsti.checked",
"Spec.SHA2.fsti.checked",
"Spec.Loops.fst.checked",
"Spec.Hash.Definitions.fst.checked",
"Spec.Agile.Hash.fsti.checked",
"prims.fst.checked",
"FStar.Seq.Base.fsti.checked",
"FStar.Seq.fst.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked"
],
"interface_file": true,
"source_file": "Vale.SHA.PPC64LE.Rounds.fst"
} | [
{
"abbrev": false,
"full_module": "Vale.SHA2.Wrapper",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.Rounds.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Loops",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Hash.Definitions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.Agile.Hash",
"short_module": null
},
{
"abbrev": false,
"full_module": "Spec.SHA2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE.SHA_helpers",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsVector",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsMem",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.InsBasic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCodes",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.QuickCode",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Decls",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.State",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Stack_i",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.PPC64LE.Machine_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.HeapImpl",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Arch.Types",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Seq",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words.Seq_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Words_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Types_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.Def.Opaque_s",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "Vale.SHA.PPC64LE",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 0,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": true,
"smtencoding_l_arith_repr": "native",
"smtencoding_nl_arith_repr": "wrapped",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [
"smt.arith.nl=false",
"smt.QI.EAGER_THRESHOLD=100",
"smt.CASE_SPLIT=3"
],
"z3refresh": false,
"z3rlimit": 2000,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
va_b0: Vale.PPC64LE.Decls.va_code ->
va_s0: Vale.PPC64LE.Decls.va_state ->
k_b: Vale.PPC64LE.Memory.buffer128 ->
block: Vale.SHA.PPC64LE.SHA_helpers.block_w ->
hash_orig: Vale.SHA.PPC64LE.SHA_helpers.hash256
-> Prims.Ghost (Vale.PPC64LE.Decls.va_state * Vale.PPC64LE.Decls.va_fuel) | Prims.Ghost | [] | [] | [
"Vale.PPC64LE.Decls.va_code",
"Vale.PPC64LE.Decls.va_state",
"Vale.PPC64LE.Memory.buffer128",
"Vale.SHA.PPC64LE.SHA_helpers.block_w",
"Vale.SHA.PPC64LE.SHA_helpers.hash256",
"Vale.PPC64LE.QuickCodes.fuel",
"Prims.unit",
"FStar.Pervasives.Native.Mktuple2",
"Vale.PPC64LE.Decls.va_fuel",
"Vale.PPC64LE.QuickCode.va_lemma_norm_mods",
"Prims.Cons",
"Vale.PPC64LE.QuickCode.mod_t",
"Vale.PPC64LE.QuickCode.va_Mod_vec",
"Vale.PPC64LE.QuickCode.va_Mod_reg",
"Vale.PPC64LE.QuickCode.va_Mod_ok",
"Prims.Nil",
"FStar.Pervasives.assert_norm",
"Prims.eq2",
"Prims.list",
"Vale.PPC64LE.QuickCode.__proj__QProc__item__mods",
"Vale.SHA.PPC64LE.Rounds.va_code_Loop_rounds_48_63",
"FStar.Pervasives.Native.tuple2",
"FStar.Pervasives.Native.tuple3",
"Vale.PPC64LE.Machine_s.state",
"Vale.PPC64LE.QuickCodes.va_wp_sound_code_norm",
"Prims.l_and",
"Vale.PPC64LE.QuickCodes.label",
"Vale.PPC64LE.QuickCodes.va_range1",
"Prims.b2t",
"Vale.PPC64LE.Decls.va_get_ok",
"Prims.int",
"Vale.PPC64LE.Decls.va_get_reg",
"Prims.op_Addition",
"Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32",
"Vale.PPC64LE.Decls.va_get_vec",
"Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64",
"Vale.PPC64LE.QuickCode.quickCode",
"Vale.SHA.PPC64LE.Rounds.va_qcode_Loop_rounds_48_63"
] | [] | false | false | false | false | false | let va_lemma_Loop_rounds_48_63 va_b0 va_s0 k_b block hash_orig =
| let va_mods:va_mods_t =
[
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2;
va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok
]
in
let va_qc = va_qcode_Loop_rounds_48_63 va_mods k_b block hash_orig in
let va_sM, va_fM, va_g =
va_wp_sound_code_norm (va_code_Loop_rounds_48_63 ())
va_qc
va_s0
(fun va_s0 va_sM va_g ->
let () = va_g in
label va_range1
"***** POSTCONDITION NOT MET AT line 211 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_ok va_sM) /\
(label va_range1
"***** POSTCONDITION NOT MET AT line 249 column 29 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(va_get_reg 6 va_sM == va_get_reg 6 va_s0 + 48) /\
label va_range1
"***** POSTCONDITION NOT MET AT line 250 column 133 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.vaf *****"
(Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM)
(va_get_vec 17 va_sM)
(va_get_vec 18 va_sM)
(va_get_vec 19 va_sM)
(va_get_vec 20 va_sM)
(va_get_vec 21 va_sM)
(va_get_vec 22 va_sM)
(va_get_vec 23 va_sM) ==
Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64 block hash_orig)))
in
assert_norm (va_qc.mods == va_mods);
va_lemma_norm_mods ([
va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21;
va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15;
va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9;
va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3;
va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_reg 6; va_Mod_ok
])
va_sM
va_s0;
(va_sM, va_fM) | false |
Steel.ST.HigherReference.fst | Steel.ST.HigherReference._alloca | val _alloca (#a: Type) (x: a)
: ST (ref a)
emp
(fun r -> pts_to r full_perm x)
(requires True)
(ensures fun r -> not (is_null r)) | val _alloca (#a: Type) (x: a)
: ST (ref a)
emp
(fun r -> pts_to r full_perm x)
(requires True)
(ensures fun r -> not (is_null r)) | let _alloca (#a:Type) (x:a)
: ST (ref a)
emp
(fun r -> pts_to r full_perm x)
(requires True)
(ensures fun r -> not (is_null r))
= alloc x | {
"file_name": "lib/steel/Steel.ST.HigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 9,
"end_line": 114,
"start_col": 0,
"start_line": 108
} | (*
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.HigherReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.HigherReference
let ref (a:Type u#1)
: Type0
= R.ref a
let null (#a:Type)
: ref a
= R.null #a
let is_null (#a:Type) (r:ref a)
: b:bool{b <==> r == null}
= R.is_null r
let pts_to (#a:Type)
(r:ref a)
([@@@smt_fallback] p:perm)
([@@@smt_fallback] v:a)
: vprop
= R.pts_to r p v
let pts_to_injective_eq
(#a: Type)
(#opened:inames)
(#p0 #p1:perm)
(#v0 #v1:a)
(r: ref a)
: STGhost unit opened
(pts_to r p0 v0 `star` pts_to r p1 v1)
(fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)
(requires True)
(ensures fun _ -> v0 == v1)
= coerce_ghost
(fun _ -> R.higher_ref_pts_to_injective_eq #a #opened #p0 #p1 #(hide v0) #(hide v1) r)
let pts_to_not_null #a #opened #p #v r
= extract_fact #opened (pts_to r p v) (r =!= null) (R.pts_to_not_null r p v);
()
let alloc (#a:Type) (x:a)
: ST (ref a)
emp
(fun r -> pts_to r full_perm x)
(requires True)
(ensures fun r -> not (is_null r))
= let r = coerce_steel (fun _ -> R.alloc x) in
r
let read (#a:Type)
(#p:perm)
(#v:erased a)
(r:ref a)
: ST a
(pts_to r p v)
(fun _ -> pts_to r p v)
(requires True)
(ensures fun x -> x == Ghost.reveal v)
= let u = coerce_steel (fun _ -> R.read r) in
return u
let write (#a:Type)
(#v:erased a)
(r:ref a)
(x:a)
: STT unit
(pts_to r full_perm v)
(fun _ -> pts_to r full_perm x)
= coerce_steel (fun _ -> R.write r x);
return ()
let free (#a:Type)
(#v:erased a)
(r:ref a)
: STT unit
(pts_to r full_perm v)
(fun _ -> emp)
= coerce_steel(fun _ -> R.free r);
return ()
/// Local primitive, to be extracted to Low* EPushFrame. To remember
/// that we need to call some pop_frame later, we insert some dummy
/// vprop into the context.
let _stack_frame : vprop = pure True
let _push_frame () : STT unit emp (fun _ -> _stack_frame) =
rewrite (pure True) _stack_frame | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.HigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 -> Steel.ST.Effect.ST (Steel.ST.HigherReference.ref a) | Steel.ST.Effect.ST | [] | [] | [
"Steel.ST.HigherReference.alloc",
"Steel.ST.HigherReference.ref",
"Steel.Effect.Common.emp",
"Steel.ST.HigherReference.pts_to",
"Steel.FractionalPermission.full_perm",
"Steel.Effect.Common.vprop",
"Prims.l_True",
"Prims.b2t",
"Prims.op_Negation",
"Steel.ST.HigherReference.is_null"
] | [] | false | true | false | false | false | let _alloca (#a: Type) (x: a)
: ST (ref a)
emp
(fun r -> pts_to r full_perm x)
(requires True)
(ensures fun r -> not (is_null r)) =
| alloc x | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.rounds_t | val rounds_t (a: Spec.alg) : size_t | val rounds_t (a: Spec.alg) : size_t | let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 56,
"end_line": 79,
"start_col": 0,
"start_line": 79
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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: Spec.Blake2.Definitions.alg -> Lib.IntTypes.size_t | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Lib.IntTypes.size",
"Spec.Blake2.Definitions.rounds",
"Lib.IntTypes.size_t"
] | [] | false | false | false | true | false | let rounds_t (a: Spec.alg) : size_t =
| size (Spec.rounds a) | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.size_to_word | val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)} | val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)} | let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 36,
"end_line": 85,
"start_col": 0,
"start_line": 83
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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 | al: Spec.Blake2.Definitions.alg -> s: Lib.IntTypes.size_t
-> u31:
Hacl.Impl.Blake2.Core.word_t al
{u31 == Spec.Blake2.Definitions.nat_to_word al (Lib.IntTypes.v s)} | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Lib.IntTypes.size_t",
"Lib.IntTypes.size_to_uint32",
"Lib.IntTypes.size_to_uint64",
"Hacl.Impl.Blake2.Core.word_t",
"Prims.eq2",
"Spec.Blake2.Definitions.word_t",
"Spec.Blake2.Definitions.nat_to_word",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB"
] | [] | false | false | false | false | false | let size_to_word al s =
| match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.get_sigma | val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s]))) | val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s]))) | let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 20,
"end_line": 65,
"start_col": 0,
"start_line": 63
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s]))) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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 | s: Lib.IntTypes.size_t{Lib.IntTypes.v s < 160}
-> FStar.HyperStack.ST.Stack Spec.Blake2.Definitions.sigma_elt_t | FStar.HyperStack.ST.Stack | [] | [] | [
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Lib.Buffer.index",
"Lib.Buffer.CONST",
"Spec.Blake2.Definitions.sigma_elt_t",
"FStar.UInt32.uint_to_t",
"Hacl.Impl.Blake2.Constants.sigmaTable",
"Prims.unit",
"Lib.Buffer.recall_contents",
"Spec.Blake2.sigmaTable"
] | [] | false | true | false | false | false | let get_sigma s =
| recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.compress_t | val compress_t : al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | let compress_t (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> s: state_p al ms
-> m: block_p al
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s /\ live h m /\ disjoint s m /\ disjoint wv s /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc s |+| loc wv) h0 h1
/\ state_v h1 s == Spec.blake2_compress al (state_v h0 s) h0.[|m|] offset flag)) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 105,
"end_line": 447,
"start_col": 0,
"start_line": 438
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract
val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)}
let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s)
/// Constants
/// Define algorithm functions
inline_for_extraction noextract
val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r))
let g1 #al #m wv a b r =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get() in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r)
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> x:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ disjoint wv x /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x)))
let g2 #al #m wv a b x =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
add_row wv_a x;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x))
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b)))
let g2z #al #m wv a b =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b))
inline_for_extraction noextract
val blake2_mixing : #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> x:row_p al m -> y:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ live h y /\ disjoint wv x /\ disjoint wv y))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_mixing al (state_v h0 wv) (row_v h0 x) (row_v h0 y)))
let blake2_mixing #al #m wv x y =
let h0 = ST.get() in
push_frame ();
let a = 0ul in
let b = 1ul in
let c = 2ul in
let d = 3ul in
[@inline_let]
let r0 = normalize_term (Lib.Sequence.index (Spec.rTable al) 0) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 0);
[@inline_let]
let r1 = normalize_term (Lib.Sequence.index (Spec.rTable al) 1) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 1);
[@inline_let]
let r2 = normalize_term (Lib.Sequence.index (Spec.rTable al) 2) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 2);
[@inline_let]
let r3 = normalize_term (Lib.Sequence.index (Spec.rTable al) 3) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 3);
let h1 = ST.get() in
g2 wv a b x;
g1 wv d a r0;
g2z wv c d;
g1 wv b c r1;
g2 wv a b y;
g1 wv d a r2;
g2z wv c d;
g1 wv b c r3;
let h2 = ST.get() in
pop_frame ();
let h3 = ST.get() in
assert(modifies (loc wv) h0 h3);
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.blake2_mixing al (state_v h1 wv) (row_v h1 x) (row_v h1 y))
#pop-options
inline_for_extraction noextract
val diag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.diag (state_v h0 wv)))
let diag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 1ul;
permr_row r2 2ul;
permr_row r3 3ul
inline_for_extraction noextract
val undiag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.undiag (state_v h0 wv)))
let undiag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 3ul;
permr_row r2 2ul;
permr_row r3 1ul
inline_for_extraction noextract
val gather_state: #a:Spec.alg -> #ms:m_spec -> st:state_p a ms -> m:block_w a -> start:size_t{v start <= 144} -> Stack unit
(requires (fun h -> live h st /\ live h m /\ disjoint st m))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
state_v h1 st == Spec.gather_state a (as_seq h0 m) (v start)))
inline_for_extraction noextract
let get_sigma' (start: size_t { v start <= 144 }) (i: size_t { normalize (i <=. 15ul) }):
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 ->
h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v start + v i])))
=
get_sigma (start +! i)
#push-options "--z3rlimit 500"
let gather_state #a #ms st m start =
let h0 = ST.get() in
let r0 = rowi st 0ul in
let r1 = rowi st 1ul in
let r2 = rowi st 2ul in
let r3 = rowi st 3ul in
let s0 = get_sigma' start 0ul in
let s1 = get_sigma' start 1ul in
let s2 = get_sigma' start 2ul in
let s3 = get_sigma' start 3ul in
let s4 = get_sigma' start 4ul in
let s5 = get_sigma' start 5ul in
let s6 = get_sigma' start 6ul in
let s7 = get_sigma' start 7ul in
let s8 = get_sigma' start 8ul in
let s9 = get_sigma' start 9ul in
let s10 = get_sigma' start 10ul in
let s11 = get_sigma' start 11ul in
let s12 = get_sigma' start 12ul in
let s13 = get_sigma' start 13ul in
let s14 = get_sigma' start 14ul in
let s15 = get_sigma' start 15ul in
let h1 = ST.get() in
gather_row r0 m s0 s2 s4 s6;
let h2 = ST.get() in
gather_row r1 m s1 s3 s5 s7;
let h3 = ST.get() in
gather_row r2 m s8 s10 s12 s14;
let h4 = ST.get() in
gather_row r3 m s9 s11 s13 s15;
let h5 = ST.get() in
assert(modifies (loc st) h0 h5);
Lib.Sequence.eq_intro (state_v h5 st) (Spec.gather_state a (as_seq h0 m) (v start))
inline_for_extraction noextract
val blake2_round : #al:Spec.alg -> #ms:m_spec -> wv:state_p al ms -> m:block_w al -> i:size_t ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_round al (as_seq h0 m) (v i) (state_v h0 wv)))
let blake2_round #al #ms wv m i =
push_frame();
let start_idx = (i %. size 10) *. size 16 in
assert (v start_idx == (v i % 10) * 16);
assert (v start_idx <= 144);
let m_st = alloc_state al ms in
gather_state m_st m start_idx;
let x = rowi m_st 0ul in
let y = rowi m_st 1ul in
let z = rowi m_st 2ul in
let w = rowi m_st 3ul in
let h1 = ST.get() in
assert (disjoint wv m_st);
assert (disjoint m_st wv);
assert (disjoint x wv);
assert (disjoint wv x);
assert (disjoint y wv);
assert (disjoint wv y);
assert (disjoint z wv);
assert (disjoint wv z);
assert (disjoint w wv);
assert (disjoint wv w);
blake2_mixing wv x y;
diag wv;
blake2_mixing wv z w;
undiag wv;
pop_frame ()
inline_for_extraction noextract
val blake2_compress0:
#al:Spec.alg
-> m_s: block_p al
-> m_w: block_w al
-> Stack unit
(requires (fun h -> live h m_s /\ live h m_w /\ disjoint m_s m_w))
(ensures (fun h0 _ h1 -> modifies (loc m_w) h0 h1
/\ as_seq h1 m_w == Spec.blake2_compress0 al (as_seq h0 m_s)))
let blake2_compress0 #al m_s m_w =
uints_from_bytes_le m_w m_s
inline_for_extraction noextract
val blake2_compress1:
#al:Spec.alg
-> #m:m_spec
-> wv: state_p al m
-> s_iv: state_p al m
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s_iv /\ disjoint wv s_iv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_compress1 al (state_v h0 s_iv) offset flag))
let blake2_compress1 #al #m wv s_iv offset flag =
let h0 = ST.get() in
push_frame();
let mask = alloc_row al m in
[@inline_let]
let wv_12 = Spec.limb_to_word al offset in
[@inline_let]
let wv_13 = Spec.limb_to_word al (offset >>. (size (bits (Spec.wt al)))) in
// SH: TODO: for some reason, ``ones`` below doesn't get inlined by KaRaMeL,
// causing an extraction problem. The 3 lines below are a hack to fix
// extraction for the time being:
// [> let wv_14 = if flag then (ones (Spec.wt al) SEC) else (Spec.zero al) in
// After investigation, it is because ones is [@(strict_on_arguments [0])],
// and so isn't unfolded if its first argument is not normalized to a constant.
// However, the first argument should always be normalized (I checked the
// output generated by KaRaMeL and the definitions).
(**) normalize_term_spec (Spec.wt al);
[@inline_let] let wt_al = normalize_term (Spec.wt al) in
let wv_14 = if flag then ones wt_al SEC else (Spec.zero al) in
// end of the TODO
let wv_15 = Spec.zero al in
create_row mask wv_12 wv_13 wv_14 wv_15;
copy_state wv s_iv;
let wv3 = rowi wv 3ul in
xor_row wv3 mask;
pop_frame();
let h1 = ST.get() in
assert(modifies (loc wv) h0 h1);
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.blake2_compress1 al (state_v h0 s_iv) offset flag)
inline_for_extraction noextract
val blake2_compress2 :
#al:Spec.alg
-> #ms:m_spec
-> wv: state_p al ms
-> m: block_w al ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies1 wv h0 h1
/\ state_v h1 wv == Spec.blake2_compress2 al (state_v h0 wv) (as_seq h0 m)))
#push-options "--z3rlimit 400"
let blake2_compress2 #al #ms wv m =
let h0 = ST.get () in
[@inline_let]
let a_spec = Spec.state al in
[@inline_let]
let refl h = state_v h wv in
[@inline_let]
let footprint = Ghost.hide(loc wv) in
[@inline_let]
let spec h = Spec.blake2_round al h.[|m|] in
loop_refl h0 (rounds_t al) a_spec refl footprint spec
(fun i ->
Loops.unfold_repeati (Spec.rounds al) (spec h0) (state_v h0 wv) (v i);
blake2_round wv m i)
#pop-options
inline_for_extraction noextract
val blake2_compress3 :
#al:Spec.alg
-> #ms:m_spec
-> s_iv:state_p al ms
-> wv:state_p al ms ->
Stack unit
(requires (fun h -> live h s_iv /\ live h wv /\ disjoint s_iv wv))
(ensures (fun h0 _ h1 -> modifies (loc s_iv) h0 h1
/\ state_v h1 s_iv == Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv)))
let blake2_compress3 #al #ms s_iv wv =
let h0 = ST.get() in
let s0 = rowi s_iv 0ul in
let s1 = rowi s_iv 1ul in
let r0 = rowi wv 0ul in
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
assert (disjoint s0 wv);
assert (disjoint wv s0);
assert (disjoint s1 wv);
assert (disjoint wv s1);
assert (disjoint r0 s0);
assert (disjoint r2 s0);
assert (disjoint r1 s1);
assert (disjoint r3 s1);
xor_row s0 r0;
let h1 = ST.get() in
xor_row s0 r2;
let h2 = ST.get() in
xor_row s1 r1;
let h3 = ST.get() in
xor_row s1 r3;
let h4 = ST.get() in
assert (modifies (loc s_iv) h0 h4);
let open Lib.Sequence in
assert (row_v h0 r0 == (state_v h0 wv).[0]);
assert (row_v h1 r2 == (state_v h0 wv).[2]);
assert (row_v h4 s0 == Spec.(((state_v h0 s_iv).[0] ^| (state_v h0 wv).[0]) ^| (state_v h0 wv).[2]));
assert (row_v h4 s1 == Spec.(((state_v h0 s_iv).[1] ^| (state_v h0 wv).[1]) ^| (state_v h0 wv).[3]));
eq_intro (state_v h2 s_iv) ((state_v h0 s_iv).[0] <- row_v h4 s0);
eq_intro (state_v h4 s_iv) ((state_v h2 s_iv).[1] <- row_v h4 s1);
eq_intro (state_v h4 s_iv) (Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv)) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 500,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.m_spec",
"Hacl.Impl.Blake2.Core.state_p",
"Hacl.Impl.Blake2.Core.block_p",
"Spec.Blake2.Definitions.limb_t",
"Prims.bool",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Impl.Blake2.Core.element_t",
"Lib.IntTypes.uint8",
"Lib.Buffer.disjoint",
"Lib.Buffer.modifies",
"Lib.Buffer.op_Bar_Plus_Bar",
"Lib.Buffer.loc",
"Prims.eq2",
"Spec.Blake2.Definitions.state",
"Hacl.Impl.Blake2.Core.state_v",
"Spec.Blake2.blake2_compress",
"Lib.Buffer.op_Brack_Lens_Access",
"Hacl.Impl.Blake2.Core.size_block"
] | [] | false | false | false | true | true | let compress_t (al: Spec.alg) (ms: m_spec) =
| wv: state_p al ms -> s: state_p al ms -> m: block_p al -> offset: Spec.limb_t al -> flag: bool
-> Stack unit
(requires
(fun h ->
live h wv /\ live h s /\ live h m /\ disjoint s m /\ disjoint wv s /\ disjoint wv m))
(ensures
(fun h0 _ h1 ->
modifies (loc s |+| loc wv) h0 h1 /\
state_v h1 s == Spec.blake2_compress al (state_v h0 s) h0.[| m |] offset flag)) | false |
|
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.blake2_update_last_st | val blake2_update_last_st : al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | let blake2_update_last_st (al:Spec.alg) (ms:m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> rem: size_t {v rem <= v len /\ v rem <= Spec.size_block al}
-> d: lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_last al (v prev) (v rem) h0.[|d|] (state_v h0 hash))) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 119,
"end_line": 515,
"start_col": 0,
"start_line": 505
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract
val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)}
let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s)
/// Constants
/// Define algorithm functions
inline_for_extraction noextract
val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r))
let g1 #al #m wv a b r =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get() in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r)
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> x:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ disjoint wv x /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x)))
let g2 #al #m wv a b x =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
add_row wv_a x;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x))
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b)))
let g2z #al #m wv a b =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b))
inline_for_extraction noextract
val blake2_mixing : #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> x:row_p al m -> y:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ live h y /\ disjoint wv x /\ disjoint wv y))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_mixing al (state_v h0 wv) (row_v h0 x) (row_v h0 y)))
let blake2_mixing #al #m wv x y =
let h0 = ST.get() in
push_frame ();
let a = 0ul in
let b = 1ul in
let c = 2ul in
let d = 3ul in
[@inline_let]
let r0 = normalize_term (Lib.Sequence.index (Spec.rTable al) 0) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 0);
[@inline_let]
let r1 = normalize_term (Lib.Sequence.index (Spec.rTable al) 1) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 1);
[@inline_let]
let r2 = normalize_term (Lib.Sequence.index (Spec.rTable al) 2) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 2);
[@inline_let]
let r3 = normalize_term (Lib.Sequence.index (Spec.rTable al) 3) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 3);
let h1 = ST.get() in
g2 wv a b x;
g1 wv d a r0;
g2z wv c d;
g1 wv b c r1;
g2 wv a b y;
g1 wv d a r2;
g2z wv c d;
g1 wv b c r3;
let h2 = ST.get() in
pop_frame ();
let h3 = ST.get() in
assert(modifies (loc wv) h0 h3);
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.blake2_mixing al (state_v h1 wv) (row_v h1 x) (row_v h1 y))
#pop-options
inline_for_extraction noextract
val diag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.diag (state_v h0 wv)))
let diag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 1ul;
permr_row r2 2ul;
permr_row r3 3ul
inline_for_extraction noextract
val undiag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.undiag (state_v h0 wv)))
let undiag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 3ul;
permr_row r2 2ul;
permr_row r3 1ul
inline_for_extraction noextract
val gather_state: #a:Spec.alg -> #ms:m_spec -> st:state_p a ms -> m:block_w a -> start:size_t{v start <= 144} -> Stack unit
(requires (fun h -> live h st /\ live h m /\ disjoint st m))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
state_v h1 st == Spec.gather_state a (as_seq h0 m) (v start)))
inline_for_extraction noextract
let get_sigma' (start: size_t { v start <= 144 }) (i: size_t { normalize (i <=. 15ul) }):
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 ->
h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v start + v i])))
=
get_sigma (start +! i)
#push-options "--z3rlimit 500"
let gather_state #a #ms st m start =
let h0 = ST.get() in
let r0 = rowi st 0ul in
let r1 = rowi st 1ul in
let r2 = rowi st 2ul in
let r3 = rowi st 3ul in
let s0 = get_sigma' start 0ul in
let s1 = get_sigma' start 1ul in
let s2 = get_sigma' start 2ul in
let s3 = get_sigma' start 3ul in
let s4 = get_sigma' start 4ul in
let s5 = get_sigma' start 5ul in
let s6 = get_sigma' start 6ul in
let s7 = get_sigma' start 7ul in
let s8 = get_sigma' start 8ul in
let s9 = get_sigma' start 9ul in
let s10 = get_sigma' start 10ul in
let s11 = get_sigma' start 11ul in
let s12 = get_sigma' start 12ul in
let s13 = get_sigma' start 13ul in
let s14 = get_sigma' start 14ul in
let s15 = get_sigma' start 15ul in
let h1 = ST.get() in
gather_row r0 m s0 s2 s4 s6;
let h2 = ST.get() in
gather_row r1 m s1 s3 s5 s7;
let h3 = ST.get() in
gather_row r2 m s8 s10 s12 s14;
let h4 = ST.get() in
gather_row r3 m s9 s11 s13 s15;
let h5 = ST.get() in
assert(modifies (loc st) h0 h5);
Lib.Sequence.eq_intro (state_v h5 st) (Spec.gather_state a (as_seq h0 m) (v start))
inline_for_extraction noextract
val blake2_round : #al:Spec.alg -> #ms:m_spec -> wv:state_p al ms -> m:block_w al -> i:size_t ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_round al (as_seq h0 m) (v i) (state_v h0 wv)))
let blake2_round #al #ms wv m i =
push_frame();
let start_idx = (i %. size 10) *. size 16 in
assert (v start_idx == (v i % 10) * 16);
assert (v start_idx <= 144);
let m_st = alloc_state al ms in
gather_state m_st m start_idx;
let x = rowi m_st 0ul in
let y = rowi m_st 1ul in
let z = rowi m_st 2ul in
let w = rowi m_st 3ul in
let h1 = ST.get() in
assert (disjoint wv m_st);
assert (disjoint m_st wv);
assert (disjoint x wv);
assert (disjoint wv x);
assert (disjoint y wv);
assert (disjoint wv y);
assert (disjoint z wv);
assert (disjoint wv z);
assert (disjoint w wv);
assert (disjoint wv w);
blake2_mixing wv x y;
diag wv;
blake2_mixing wv z w;
undiag wv;
pop_frame ()
inline_for_extraction noextract
val blake2_compress0:
#al:Spec.alg
-> m_s: block_p al
-> m_w: block_w al
-> Stack unit
(requires (fun h -> live h m_s /\ live h m_w /\ disjoint m_s m_w))
(ensures (fun h0 _ h1 -> modifies (loc m_w) h0 h1
/\ as_seq h1 m_w == Spec.blake2_compress0 al (as_seq h0 m_s)))
let blake2_compress0 #al m_s m_w =
uints_from_bytes_le m_w m_s
inline_for_extraction noextract
val blake2_compress1:
#al:Spec.alg
-> #m:m_spec
-> wv: state_p al m
-> s_iv: state_p al m
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s_iv /\ disjoint wv s_iv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_compress1 al (state_v h0 s_iv) offset flag))
let blake2_compress1 #al #m wv s_iv offset flag =
let h0 = ST.get() in
push_frame();
let mask = alloc_row al m in
[@inline_let]
let wv_12 = Spec.limb_to_word al offset in
[@inline_let]
let wv_13 = Spec.limb_to_word al (offset >>. (size (bits (Spec.wt al)))) in
// SH: TODO: for some reason, ``ones`` below doesn't get inlined by KaRaMeL,
// causing an extraction problem. The 3 lines below are a hack to fix
// extraction for the time being:
// [> let wv_14 = if flag then (ones (Spec.wt al) SEC) else (Spec.zero al) in
// After investigation, it is because ones is [@(strict_on_arguments [0])],
// and so isn't unfolded if its first argument is not normalized to a constant.
// However, the first argument should always be normalized (I checked the
// output generated by KaRaMeL and the definitions).
(**) normalize_term_spec (Spec.wt al);
[@inline_let] let wt_al = normalize_term (Spec.wt al) in
let wv_14 = if flag then ones wt_al SEC else (Spec.zero al) in
// end of the TODO
let wv_15 = Spec.zero al in
create_row mask wv_12 wv_13 wv_14 wv_15;
copy_state wv s_iv;
let wv3 = rowi wv 3ul in
xor_row wv3 mask;
pop_frame();
let h1 = ST.get() in
assert(modifies (loc wv) h0 h1);
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.blake2_compress1 al (state_v h0 s_iv) offset flag)
inline_for_extraction noextract
val blake2_compress2 :
#al:Spec.alg
-> #ms:m_spec
-> wv: state_p al ms
-> m: block_w al ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies1 wv h0 h1
/\ state_v h1 wv == Spec.blake2_compress2 al (state_v h0 wv) (as_seq h0 m)))
#push-options "--z3rlimit 400"
let blake2_compress2 #al #ms wv m =
let h0 = ST.get () in
[@inline_let]
let a_spec = Spec.state al in
[@inline_let]
let refl h = state_v h wv in
[@inline_let]
let footprint = Ghost.hide(loc wv) in
[@inline_let]
let spec h = Spec.blake2_round al h.[|m|] in
loop_refl h0 (rounds_t al) a_spec refl footprint spec
(fun i ->
Loops.unfold_repeati (Spec.rounds al) (spec h0) (state_v h0 wv) (v i);
blake2_round wv m i)
#pop-options
inline_for_extraction noextract
val blake2_compress3 :
#al:Spec.alg
-> #ms:m_spec
-> s_iv:state_p al ms
-> wv:state_p al ms ->
Stack unit
(requires (fun h -> live h s_iv /\ live h wv /\ disjoint s_iv wv))
(ensures (fun h0 _ h1 -> modifies (loc s_iv) h0 h1
/\ state_v h1 s_iv == Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv)))
let blake2_compress3 #al #ms s_iv wv =
let h0 = ST.get() in
let s0 = rowi s_iv 0ul in
let s1 = rowi s_iv 1ul in
let r0 = rowi wv 0ul in
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
assert (disjoint s0 wv);
assert (disjoint wv s0);
assert (disjoint s1 wv);
assert (disjoint wv s1);
assert (disjoint r0 s0);
assert (disjoint r2 s0);
assert (disjoint r1 s1);
assert (disjoint r3 s1);
xor_row s0 r0;
let h1 = ST.get() in
xor_row s0 r2;
let h2 = ST.get() in
xor_row s1 r1;
let h3 = ST.get() in
xor_row s1 r3;
let h4 = ST.get() in
assert (modifies (loc s_iv) h0 h4);
let open Lib.Sequence in
assert (row_v h0 r0 == (state_v h0 wv).[0]);
assert (row_v h1 r2 == (state_v h0 wv).[2]);
assert (row_v h4 s0 == Spec.(((state_v h0 s_iv).[0] ^| (state_v h0 wv).[0]) ^| (state_v h0 wv).[2]));
assert (row_v h4 s1 == Spec.(((state_v h0 s_iv).[1] ^| (state_v h0 wv).[1]) ^| (state_v h0 wv).[3]));
eq_intro (state_v h2 s_iv) ((state_v h0 s_iv).[0] <- row_v h4 s0);
eq_intro (state_v h4 s_iv) ((state_v h2 s_iv).[1] <- row_v h4 s1);
eq_intro (state_v h4 s_iv) (Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv))
inline_for_extraction noextract
let compress_t (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> s: state_p al ms
-> m: block_p al
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s /\ live h m /\ disjoint s m /\ disjoint wv s /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc s |+| loc wv) h0 h1
/\ state_v h1 s == Spec.blake2_compress al (state_v h0 s) h0.[|m|] offset flag))
inline_for_extraction noextract
val blake2_compress: #al:Spec.alg -> #ms:m_spec -> compress_t al ms
let blake2_compress #al #ms wv s m offset flag =
push_frame();
let m_w = create 16ul (Spec.zero al) in
blake2_compress0 #al m m_w;
blake2_compress1 wv s offset flag;
blake2_compress2 wv m_w;
blake2_compress3 s wv;
pop_frame()
inline_for_extraction noextract
let blake2_update_block_st (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> hash: state_p al ms
-> flag: bool
-> totlen: Spec.limb_t al{v totlen <= Spec.max_limb al}
-> d: block_p al ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_block al flag (v totlen) h0.[|d|] (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_block: #al:Spec.alg -> #ms:m_spec -> blake2_update_block_st al ms
let blake2_update_block #al #ms wv hash flag totlen d =
blake2_compress wv hash d totlen flag
inline_for_extraction noextract
let blake2_update1_st (al:Spec.alg) (ms:m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> d: lbuffer uint8 len
-> i: size_t{v i < length d / Spec.size_block al} ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update1 al (v prev) h0.[|d|] (v i) (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update1: #al:Spec.alg -> #ms:m_spec -> blake2_update_block: blake2_update_block_st al ms -> blake2_update1_st al ms
let blake2_update1 #al #ms blake2_update_block #len wv hash prev d i =
let totlen = prev +. size_to_limb al ((i+!1ul) *! size_block al) in
assert (v totlen == v prev + (v i + 1) * Spec.size_block al);
let b = sub d (i *. size_block al) (size_block al) in
let h = ST.get() in
assert (as_seq h b == Spec.get_blocki al (as_seq h d) (v i));
blake2_update_block wv hash false totlen b | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 500,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.m_spec",
"Lib.IntTypes.size_t",
"Hacl.Impl.Blake2.Core.state_p",
"Spec.Blake2.Definitions.limb_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Prims.op_Addition",
"Lib.IntTypes.v",
"Spec.Blake2.Definitions.limb_inttype",
"Lib.IntTypes.SEC",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Spec.Blake2.Definitions.max_limb",
"Prims.l_and",
"Spec.Blake2.Definitions.size_block",
"Lib.Buffer.lbuffer",
"Lib.IntTypes.uint8",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Impl.Blake2.Core.element_t",
"Lib.Buffer.disjoint",
"Lib.Buffer.modifies",
"Lib.Buffer.op_Bar_Plus_Bar",
"Lib.Buffer.loc",
"Prims.eq2",
"Spec.Blake2.Definitions.state",
"Hacl.Impl.Blake2.Core.state_v",
"Spec.Blake2.blake2_update_last",
"Lib.Buffer.op_Brack_Lens_Access"
] | [] | false | false | false | true | true | let blake2_update_last_st (al: Spec.alg) (ms: m_spec) =
|
#len: size_t ->
wv: state_p al ms ->
hash: state_p al ms ->
prev: Spec.limb_t al {v prev + v len <= Spec.max_limb al} ->
rem: size_t{v rem <= v len /\ v rem <= Spec.size_block al} ->
d: lbuffer uint8 len
-> Stack unit
(requires
(fun h ->
live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\
disjoint wv d))
(ensures
(fun h0 _ h1 ->
modifies (loc hash |+| loc wv) h0 h1 /\
state_v h1 hash ==
Spec.blake2_update_last al (v prev) (v rem) h0.[| d |] (state_v h0 hash))) | false |
|
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.get_sigma_sub | val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i)))) | val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i)))) | let get_sigma_sub start i = get_sigma (start +. i) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 50,
"end_line": 76,
"start_col": 0,
"start_line": 76
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i)))) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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 |
start: Lib.IntTypes.size_t ->
i: Lib.IntTypes.size_t{Lib.IntTypes.v i < 16 /\ Lib.IntTypes.v start + Lib.IntTypes.v i < 160}
-> FStar.HyperStack.ST.Stack Spec.Blake2.Definitions.sigma_elt_t | FStar.HyperStack.ST.Stack | [] | [] | [
"Lib.IntTypes.size_t",
"Prims.l_and",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims.op_Addition",
"Hacl.Impl.Blake2.Generic.get_sigma",
"Lib.IntTypes.op_Plus_Dot",
"Spec.Blake2.Definitions.sigma_elt_t"
] | [] | false | true | false | false | false | let get_sigma_sub start i =
| get_sigma (start +. i) | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.blake2_update_block_st | val blake2_update_block_st : al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | let blake2_update_block_st (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> hash: state_p al ms
-> flag: bool
-> totlen: Spec.limb_t al{v totlen <= Spec.max_limb al}
-> d: block_p al ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_block al flag (v totlen) h0.[|d|] (state_v h0 hash))) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 119,
"end_line": 472,
"start_col": 0,
"start_line": 463
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract
val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)}
let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s)
/// Constants
/// Define algorithm functions
inline_for_extraction noextract
val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r))
let g1 #al #m wv a b r =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get() in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r)
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> x:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ disjoint wv x /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x)))
let g2 #al #m wv a b x =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
add_row wv_a x;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x))
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b)))
let g2z #al #m wv a b =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b))
inline_for_extraction noextract
val blake2_mixing : #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> x:row_p al m -> y:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ live h y /\ disjoint wv x /\ disjoint wv y))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_mixing al (state_v h0 wv) (row_v h0 x) (row_v h0 y)))
let blake2_mixing #al #m wv x y =
let h0 = ST.get() in
push_frame ();
let a = 0ul in
let b = 1ul in
let c = 2ul in
let d = 3ul in
[@inline_let]
let r0 = normalize_term (Lib.Sequence.index (Spec.rTable al) 0) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 0);
[@inline_let]
let r1 = normalize_term (Lib.Sequence.index (Spec.rTable al) 1) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 1);
[@inline_let]
let r2 = normalize_term (Lib.Sequence.index (Spec.rTable al) 2) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 2);
[@inline_let]
let r3 = normalize_term (Lib.Sequence.index (Spec.rTable al) 3) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 3);
let h1 = ST.get() in
g2 wv a b x;
g1 wv d a r0;
g2z wv c d;
g1 wv b c r1;
g2 wv a b y;
g1 wv d a r2;
g2z wv c d;
g1 wv b c r3;
let h2 = ST.get() in
pop_frame ();
let h3 = ST.get() in
assert(modifies (loc wv) h0 h3);
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.blake2_mixing al (state_v h1 wv) (row_v h1 x) (row_v h1 y))
#pop-options
inline_for_extraction noextract
val diag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.diag (state_v h0 wv)))
let diag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 1ul;
permr_row r2 2ul;
permr_row r3 3ul
inline_for_extraction noextract
val undiag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.undiag (state_v h0 wv)))
let undiag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 3ul;
permr_row r2 2ul;
permr_row r3 1ul
inline_for_extraction noextract
val gather_state: #a:Spec.alg -> #ms:m_spec -> st:state_p a ms -> m:block_w a -> start:size_t{v start <= 144} -> Stack unit
(requires (fun h -> live h st /\ live h m /\ disjoint st m))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
state_v h1 st == Spec.gather_state a (as_seq h0 m) (v start)))
inline_for_extraction noextract
let get_sigma' (start: size_t { v start <= 144 }) (i: size_t { normalize (i <=. 15ul) }):
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 ->
h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v start + v i])))
=
get_sigma (start +! i)
#push-options "--z3rlimit 500"
let gather_state #a #ms st m start =
let h0 = ST.get() in
let r0 = rowi st 0ul in
let r1 = rowi st 1ul in
let r2 = rowi st 2ul in
let r3 = rowi st 3ul in
let s0 = get_sigma' start 0ul in
let s1 = get_sigma' start 1ul in
let s2 = get_sigma' start 2ul in
let s3 = get_sigma' start 3ul in
let s4 = get_sigma' start 4ul in
let s5 = get_sigma' start 5ul in
let s6 = get_sigma' start 6ul in
let s7 = get_sigma' start 7ul in
let s8 = get_sigma' start 8ul in
let s9 = get_sigma' start 9ul in
let s10 = get_sigma' start 10ul in
let s11 = get_sigma' start 11ul in
let s12 = get_sigma' start 12ul in
let s13 = get_sigma' start 13ul in
let s14 = get_sigma' start 14ul in
let s15 = get_sigma' start 15ul in
let h1 = ST.get() in
gather_row r0 m s0 s2 s4 s6;
let h2 = ST.get() in
gather_row r1 m s1 s3 s5 s7;
let h3 = ST.get() in
gather_row r2 m s8 s10 s12 s14;
let h4 = ST.get() in
gather_row r3 m s9 s11 s13 s15;
let h5 = ST.get() in
assert(modifies (loc st) h0 h5);
Lib.Sequence.eq_intro (state_v h5 st) (Spec.gather_state a (as_seq h0 m) (v start))
inline_for_extraction noextract
val blake2_round : #al:Spec.alg -> #ms:m_spec -> wv:state_p al ms -> m:block_w al -> i:size_t ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_round al (as_seq h0 m) (v i) (state_v h0 wv)))
let blake2_round #al #ms wv m i =
push_frame();
let start_idx = (i %. size 10) *. size 16 in
assert (v start_idx == (v i % 10) * 16);
assert (v start_idx <= 144);
let m_st = alloc_state al ms in
gather_state m_st m start_idx;
let x = rowi m_st 0ul in
let y = rowi m_st 1ul in
let z = rowi m_st 2ul in
let w = rowi m_st 3ul in
let h1 = ST.get() in
assert (disjoint wv m_st);
assert (disjoint m_st wv);
assert (disjoint x wv);
assert (disjoint wv x);
assert (disjoint y wv);
assert (disjoint wv y);
assert (disjoint z wv);
assert (disjoint wv z);
assert (disjoint w wv);
assert (disjoint wv w);
blake2_mixing wv x y;
diag wv;
blake2_mixing wv z w;
undiag wv;
pop_frame ()
inline_for_extraction noextract
val blake2_compress0:
#al:Spec.alg
-> m_s: block_p al
-> m_w: block_w al
-> Stack unit
(requires (fun h -> live h m_s /\ live h m_w /\ disjoint m_s m_w))
(ensures (fun h0 _ h1 -> modifies (loc m_w) h0 h1
/\ as_seq h1 m_w == Spec.blake2_compress0 al (as_seq h0 m_s)))
let blake2_compress0 #al m_s m_w =
uints_from_bytes_le m_w m_s
inline_for_extraction noextract
val blake2_compress1:
#al:Spec.alg
-> #m:m_spec
-> wv: state_p al m
-> s_iv: state_p al m
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s_iv /\ disjoint wv s_iv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_compress1 al (state_v h0 s_iv) offset flag))
let blake2_compress1 #al #m wv s_iv offset flag =
let h0 = ST.get() in
push_frame();
let mask = alloc_row al m in
[@inline_let]
let wv_12 = Spec.limb_to_word al offset in
[@inline_let]
let wv_13 = Spec.limb_to_word al (offset >>. (size (bits (Spec.wt al)))) in
// SH: TODO: for some reason, ``ones`` below doesn't get inlined by KaRaMeL,
// causing an extraction problem. The 3 lines below are a hack to fix
// extraction for the time being:
// [> let wv_14 = if flag then (ones (Spec.wt al) SEC) else (Spec.zero al) in
// After investigation, it is because ones is [@(strict_on_arguments [0])],
// and so isn't unfolded if its first argument is not normalized to a constant.
// However, the first argument should always be normalized (I checked the
// output generated by KaRaMeL and the definitions).
(**) normalize_term_spec (Spec.wt al);
[@inline_let] let wt_al = normalize_term (Spec.wt al) in
let wv_14 = if flag then ones wt_al SEC else (Spec.zero al) in
// end of the TODO
let wv_15 = Spec.zero al in
create_row mask wv_12 wv_13 wv_14 wv_15;
copy_state wv s_iv;
let wv3 = rowi wv 3ul in
xor_row wv3 mask;
pop_frame();
let h1 = ST.get() in
assert(modifies (loc wv) h0 h1);
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.blake2_compress1 al (state_v h0 s_iv) offset flag)
inline_for_extraction noextract
val blake2_compress2 :
#al:Spec.alg
-> #ms:m_spec
-> wv: state_p al ms
-> m: block_w al ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies1 wv h0 h1
/\ state_v h1 wv == Spec.blake2_compress2 al (state_v h0 wv) (as_seq h0 m)))
#push-options "--z3rlimit 400"
let blake2_compress2 #al #ms wv m =
let h0 = ST.get () in
[@inline_let]
let a_spec = Spec.state al in
[@inline_let]
let refl h = state_v h wv in
[@inline_let]
let footprint = Ghost.hide(loc wv) in
[@inline_let]
let spec h = Spec.blake2_round al h.[|m|] in
loop_refl h0 (rounds_t al) a_spec refl footprint spec
(fun i ->
Loops.unfold_repeati (Spec.rounds al) (spec h0) (state_v h0 wv) (v i);
blake2_round wv m i)
#pop-options
inline_for_extraction noextract
val blake2_compress3 :
#al:Spec.alg
-> #ms:m_spec
-> s_iv:state_p al ms
-> wv:state_p al ms ->
Stack unit
(requires (fun h -> live h s_iv /\ live h wv /\ disjoint s_iv wv))
(ensures (fun h0 _ h1 -> modifies (loc s_iv) h0 h1
/\ state_v h1 s_iv == Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv)))
let blake2_compress3 #al #ms s_iv wv =
let h0 = ST.get() in
let s0 = rowi s_iv 0ul in
let s1 = rowi s_iv 1ul in
let r0 = rowi wv 0ul in
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
assert (disjoint s0 wv);
assert (disjoint wv s0);
assert (disjoint s1 wv);
assert (disjoint wv s1);
assert (disjoint r0 s0);
assert (disjoint r2 s0);
assert (disjoint r1 s1);
assert (disjoint r3 s1);
xor_row s0 r0;
let h1 = ST.get() in
xor_row s0 r2;
let h2 = ST.get() in
xor_row s1 r1;
let h3 = ST.get() in
xor_row s1 r3;
let h4 = ST.get() in
assert (modifies (loc s_iv) h0 h4);
let open Lib.Sequence in
assert (row_v h0 r0 == (state_v h0 wv).[0]);
assert (row_v h1 r2 == (state_v h0 wv).[2]);
assert (row_v h4 s0 == Spec.(((state_v h0 s_iv).[0] ^| (state_v h0 wv).[0]) ^| (state_v h0 wv).[2]));
assert (row_v h4 s1 == Spec.(((state_v h0 s_iv).[1] ^| (state_v h0 wv).[1]) ^| (state_v h0 wv).[3]));
eq_intro (state_v h2 s_iv) ((state_v h0 s_iv).[0] <- row_v h4 s0);
eq_intro (state_v h4 s_iv) ((state_v h2 s_iv).[1] <- row_v h4 s1);
eq_intro (state_v h4 s_iv) (Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv))
inline_for_extraction noextract
let compress_t (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> s: state_p al ms
-> m: block_p al
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s /\ live h m /\ disjoint s m /\ disjoint wv s /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc s |+| loc wv) h0 h1
/\ state_v h1 s == Spec.blake2_compress al (state_v h0 s) h0.[|m|] offset flag))
inline_for_extraction noextract
val blake2_compress: #al:Spec.alg -> #ms:m_spec -> compress_t al ms
let blake2_compress #al #ms wv s m offset flag =
push_frame();
let m_w = create 16ul (Spec.zero al) in
blake2_compress0 #al m m_w;
blake2_compress1 wv s offset flag;
blake2_compress2 wv m_w;
blake2_compress3 s wv;
pop_frame() | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 500,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.m_spec",
"Hacl.Impl.Blake2.Core.state_p",
"Prims.bool",
"Spec.Blake2.Definitions.limb_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.v",
"Spec.Blake2.Definitions.limb_inttype",
"Lib.IntTypes.SEC",
"Spec.Blake2.Definitions.max_limb",
"Hacl.Impl.Blake2.Core.block_p",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Impl.Blake2.Core.element_t",
"Lib.IntTypes.uint8",
"Lib.Buffer.disjoint",
"Lib.Buffer.modifies",
"Lib.Buffer.op_Bar_Plus_Bar",
"Lib.Buffer.loc",
"Prims.eq2",
"Spec.Blake2.Definitions.state",
"Hacl.Impl.Blake2.Core.state_v",
"Spec.Blake2.blake2_update_block",
"Lib.Buffer.op_Brack_Lens_Access",
"Hacl.Impl.Blake2.Core.size_block"
] | [] | false | false | false | true | true | let blake2_update_block_st (al: Spec.alg) (ms: m_spec) =
|
wv: state_p al ms ->
hash: state_p al ms ->
flag: bool ->
totlen: Spec.limb_t al {v totlen <= Spec.max_limb al} ->
d: block_p al
-> Stack unit
(requires
(fun h ->
live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\
disjoint wv d))
(ensures
(fun h0 _ h1 ->
modifies (loc hash |+| loc wv) h0 h1 /\
state_v h1 hash ==
Spec.blake2_update_block al flag (v totlen) h0.[| d |] (state_v h0 hash))) | false |
|
Steel.ST.HigherReference.fst | Steel.ST.HigherReference._push_frame | val _push_frame: Prims.unit -> STT unit emp (fun _ -> _stack_frame) | val _push_frame: Prims.unit -> STT unit emp (fun _ -> _stack_frame) | let _push_frame () : STT unit emp (fun _ -> _stack_frame) =
rewrite (pure True) _stack_frame | {
"file_name": "lib/steel/Steel.ST.HigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 34,
"end_line": 105,
"start_col": 0,
"start_line": 104
} | (*
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.HigherReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.HigherReference
let ref (a:Type u#1)
: Type0
= R.ref a
let null (#a:Type)
: ref a
= R.null #a
let is_null (#a:Type) (r:ref a)
: b:bool{b <==> r == null}
= R.is_null r
let pts_to (#a:Type)
(r:ref a)
([@@@smt_fallback] p:perm)
([@@@smt_fallback] v:a)
: vprop
= R.pts_to r p v
let pts_to_injective_eq
(#a: Type)
(#opened:inames)
(#p0 #p1:perm)
(#v0 #v1:a)
(r: ref a)
: STGhost unit opened
(pts_to r p0 v0 `star` pts_to r p1 v1)
(fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)
(requires True)
(ensures fun _ -> v0 == v1)
= coerce_ghost
(fun _ -> R.higher_ref_pts_to_injective_eq #a #opened #p0 #p1 #(hide v0) #(hide v1) r)
let pts_to_not_null #a #opened #p #v r
= extract_fact #opened (pts_to r p v) (r =!= null) (R.pts_to_not_null r p v);
()
let alloc (#a:Type) (x:a)
: ST (ref a)
emp
(fun r -> pts_to r full_perm x)
(requires True)
(ensures fun r -> not (is_null r))
= let r = coerce_steel (fun _ -> R.alloc x) in
r
let read (#a:Type)
(#p:perm)
(#v:erased a)
(r:ref a)
: ST a
(pts_to r p v)
(fun _ -> pts_to r p v)
(requires True)
(ensures fun x -> x == Ghost.reveal v)
= let u = coerce_steel (fun _ -> R.read r) in
return u
let write (#a:Type)
(#v:erased a)
(r:ref a)
(x:a)
: STT unit
(pts_to r full_perm v)
(fun _ -> pts_to r full_perm x)
= coerce_steel (fun _ -> R.write r x);
return ()
let free (#a:Type)
(#v:erased a)
(r:ref a)
: STT unit
(pts_to r full_perm v)
(fun _ -> emp)
= coerce_steel(fun _ -> R.free r);
return ()
/// Local primitive, to be extracted to Low* EPushFrame. To remember
/// that we need to call some pop_frame later, we insert some dummy
/// vprop into the context. | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.HigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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.STT Prims.unit | Steel.ST.Effect.STT | [] | [] | [
"Prims.unit",
"Steel.ST.Util.rewrite",
"FStar.Ghost.hide",
"FStar.Set.set",
"Steel.Memory.iname",
"FStar.Set.empty",
"Steel.ST.Util.pure",
"Prims.l_True",
"Steel.ST.HigherReference._stack_frame",
"Steel.Effect.Common.emp",
"Steel.Effect.Common.vprop"
] | [] | false | true | false | false | false | let _push_frame () : STT unit emp (fun _ -> _stack_frame) =
| rewrite (pure True) _stack_frame | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.blake2_init_st | val blake2_init_st : al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | let blake2_init_st (al:Spec.alg) (ms:m_spec) =
hash: state_p al ms
-> kk: size_t{v kk <= Spec.max_key al}
-> nn: size_t{1 <= v nn /\ v nn <= Spec.max_output al} ->
Stack unit
(requires (fun h -> live h hash))
(ensures (fun h0 _ h1 -> modifies (loc hash) h0 h1 /\
state_v h1 hash == Spec.blake2_init_hash al (Spec.blake2_default_params al) (v kk) (v nn))) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 97,
"end_line": 552,
"start_col": 0,
"start_line": 545
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract
val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)}
let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s)
/// Constants
/// Define algorithm functions
inline_for_extraction noextract
val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r))
let g1 #al #m wv a b r =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get() in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r)
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> x:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ disjoint wv x /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x)))
let g2 #al #m wv a b x =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
add_row wv_a x;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x))
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b)))
let g2z #al #m wv a b =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b))
inline_for_extraction noextract
val blake2_mixing : #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> x:row_p al m -> y:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ live h y /\ disjoint wv x /\ disjoint wv y))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_mixing al (state_v h0 wv) (row_v h0 x) (row_v h0 y)))
let blake2_mixing #al #m wv x y =
let h0 = ST.get() in
push_frame ();
let a = 0ul in
let b = 1ul in
let c = 2ul in
let d = 3ul in
[@inline_let]
let r0 = normalize_term (Lib.Sequence.index (Spec.rTable al) 0) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 0);
[@inline_let]
let r1 = normalize_term (Lib.Sequence.index (Spec.rTable al) 1) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 1);
[@inline_let]
let r2 = normalize_term (Lib.Sequence.index (Spec.rTable al) 2) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 2);
[@inline_let]
let r3 = normalize_term (Lib.Sequence.index (Spec.rTable al) 3) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 3);
let h1 = ST.get() in
g2 wv a b x;
g1 wv d a r0;
g2z wv c d;
g1 wv b c r1;
g2 wv a b y;
g1 wv d a r2;
g2z wv c d;
g1 wv b c r3;
let h2 = ST.get() in
pop_frame ();
let h3 = ST.get() in
assert(modifies (loc wv) h0 h3);
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.blake2_mixing al (state_v h1 wv) (row_v h1 x) (row_v h1 y))
#pop-options
inline_for_extraction noextract
val diag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.diag (state_v h0 wv)))
let diag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 1ul;
permr_row r2 2ul;
permr_row r3 3ul
inline_for_extraction noextract
val undiag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.undiag (state_v h0 wv)))
let undiag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 3ul;
permr_row r2 2ul;
permr_row r3 1ul
inline_for_extraction noextract
val gather_state: #a:Spec.alg -> #ms:m_spec -> st:state_p a ms -> m:block_w a -> start:size_t{v start <= 144} -> Stack unit
(requires (fun h -> live h st /\ live h m /\ disjoint st m))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
state_v h1 st == Spec.gather_state a (as_seq h0 m) (v start)))
inline_for_extraction noextract
let get_sigma' (start: size_t { v start <= 144 }) (i: size_t { normalize (i <=. 15ul) }):
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 ->
h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v start + v i])))
=
get_sigma (start +! i)
#push-options "--z3rlimit 500"
let gather_state #a #ms st m start =
let h0 = ST.get() in
let r0 = rowi st 0ul in
let r1 = rowi st 1ul in
let r2 = rowi st 2ul in
let r3 = rowi st 3ul in
let s0 = get_sigma' start 0ul in
let s1 = get_sigma' start 1ul in
let s2 = get_sigma' start 2ul in
let s3 = get_sigma' start 3ul in
let s4 = get_sigma' start 4ul in
let s5 = get_sigma' start 5ul in
let s6 = get_sigma' start 6ul in
let s7 = get_sigma' start 7ul in
let s8 = get_sigma' start 8ul in
let s9 = get_sigma' start 9ul in
let s10 = get_sigma' start 10ul in
let s11 = get_sigma' start 11ul in
let s12 = get_sigma' start 12ul in
let s13 = get_sigma' start 13ul in
let s14 = get_sigma' start 14ul in
let s15 = get_sigma' start 15ul in
let h1 = ST.get() in
gather_row r0 m s0 s2 s4 s6;
let h2 = ST.get() in
gather_row r1 m s1 s3 s5 s7;
let h3 = ST.get() in
gather_row r2 m s8 s10 s12 s14;
let h4 = ST.get() in
gather_row r3 m s9 s11 s13 s15;
let h5 = ST.get() in
assert(modifies (loc st) h0 h5);
Lib.Sequence.eq_intro (state_v h5 st) (Spec.gather_state a (as_seq h0 m) (v start))
inline_for_extraction noextract
val blake2_round : #al:Spec.alg -> #ms:m_spec -> wv:state_p al ms -> m:block_w al -> i:size_t ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_round al (as_seq h0 m) (v i) (state_v h0 wv)))
let blake2_round #al #ms wv m i =
push_frame();
let start_idx = (i %. size 10) *. size 16 in
assert (v start_idx == (v i % 10) * 16);
assert (v start_idx <= 144);
let m_st = alloc_state al ms in
gather_state m_st m start_idx;
let x = rowi m_st 0ul in
let y = rowi m_st 1ul in
let z = rowi m_st 2ul in
let w = rowi m_st 3ul in
let h1 = ST.get() in
assert (disjoint wv m_st);
assert (disjoint m_st wv);
assert (disjoint x wv);
assert (disjoint wv x);
assert (disjoint y wv);
assert (disjoint wv y);
assert (disjoint z wv);
assert (disjoint wv z);
assert (disjoint w wv);
assert (disjoint wv w);
blake2_mixing wv x y;
diag wv;
blake2_mixing wv z w;
undiag wv;
pop_frame ()
inline_for_extraction noextract
val blake2_compress0:
#al:Spec.alg
-> m_s: block_p al
-> m_w: block_w al
-> Stack unit
(requires (fun h -> live h m_s /\ live h m_w /\ disjoint m_s m_w))
(ensures (fun h0 _ h1 -> modifies (loc m_w) h0 h1
/\ as_seq h1 m_w == Spec.blake2_compress0 al (as_seq h0 m_s)))
let blake2_compress0 #al m_s m_w =
uints_from_bytes_le m_w m_s
inline_for_extraction noextract
val blake2_compress1:
#al:Spec.alg
-> #m:m_spec
-> wv: state_p al m
-> s_iv: state_p al m
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s_iv /\ disjoint wv s_iv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_compress1 al (state_v h0 s_iv) offset flag))
let blake2_compress1 #al #m wv s_iv offset flag =
let h0 = ST.get() in
push_frame();
let mask = alloc_row al m in
[@inline_let]
let wv_12 = Spec.limb_to_word al offset in
[@inline_let]
let wv_13 = Spec.limb_to_word al (offset >>. (size (bits (Spec.wt al)))) in
// SH: TODO: for some reason, ``ones`` below doesn't get inlined by KaRaMeL,
// causing an extraction problem. The 3 lines below are a hack to fix
// extraction for the time being:
// [> let wv_14 = if flag then (ones (Spec.wt al) SEC) else (Spec.zero al) in
// After investigation, it is because ones is [@(strict_on_arguments [0])],
// and so isn't unfolded if its first argument is not normalized to a constant.
// However, the first argument should always be normalized (I checked the
// output generated by KaRaMeL and the definitions).
(**) normalize_term_spec (Spec.wt al);
[@inline_let] let wt_al = normalize_term (Spec.wt al) in
let wv_14 = if flag then ones wt_al SEC else (Spec.zero al) in
// end of the TODO
let wv_15 = Spec.zero al in
create_row mask wv_12 wv_13 wv_14 wv_15;
copy_state wv s_iv;
let wv3 = rowi wv 3ul in
xor_row wv3 mask;
pop_frame();
let h1 = ST.get() in
assert(modifies (loc wv) h0 h1);
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.blake2_compress1 al (state_v h0 s_iv) offset flag)
inline_for_extraction noextract
val blake2_compress2 :
#al:Spec.alg
-> #ms:m_spec
-> wv: state_p al ms
-> m: block_w al ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies1 wv h0 h1
/\ state_v h1 wv == Spec.blake2_compress2 al (state_v h0 wv) (as_seq h0 m)))
#push-options "--z3rlimit 400"
let blake2_compress2 #al #ms wv m =
let h0 = ST.get () in
[@inline_let]
let a_spec = Spec.state al in
[@inline_let]
let refl h = state_v h wv in
[@inline_let]
let footprint = Ghost.hide(loc wv) in
[@inline_let]
let spec h = Spec.blake2_round al h.[|m|] in
loop_refl h0 (rounds_t al) a_spec refl footprint spec
(fun i ->
Loops.unfold_repeati (Spec.rounds al) (spec h0) (state_v h0 wv) (v i);
blake2_round wv m i)
#pop-options
inline_for_extraction noextract
val blake2_compress3 :
#al:Spec.alg
-> #ms:m_spec
-> s_iv:state_p al ms
-> wv:state_p al ms ->
Stack unit
(requires (fun h -> live h s_iv /\ live h wv /\ disjoint s_iv wv))
(ensures (fun h0 _ h1 -> modifies (loc s_iv) h0 h1
/\ state_v h1 s_iv == Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv)))
let blake2_compress3 #al #ms s_iv wv =
let h0 = ST.get() in
let s0 = rowi s_iv 0ul in
let s1 = rowi s_iv 1ul in
let r0 = rowi wv 0ul in
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
assert (disjoint s0 wv);
assert (disjoint wv s0);
assert (disjoint s1 wv);
assert (disjoint wv s1);
assert (disjoint r0 s0);
assert (disjoint r2 s0);
assert (disjoint r1 s1);
assert (disjoint r3 s1);
xor_row s0 r0;
let h1 = ST.get() in
xor_row s0 r2;
let h2 = ST.get() in
xor_row s1 r1;
let h3 = ST.get() in
xor_row s1 r3;
let h4 = ST.get() in
assert (modifies (loc s_iv) h0 h4);
let open Lib.Sequence in
assert (row_v h0 r0 == (state_v h0 wv).[0]);
assert (row_v h1 r2 == (state_v h0 wv).[2]);
assert (row_v h4 s0 == Spec.(((state_v h0 s_iv).[0] ^| (state_v h0 wv).[0]) ^| (state_v h0 wv).[2]));
assert (row_v h4 s1 == Spec.(((state_v h0 s_iv).[1] ^| (state_v h0 wv).[1]) ^| (state_v h0 wv).[3]));
eq_intro (state_v h2 s_iv) ((state_v h0 s_iv).[0] <- row_v h4 s0);
eq_intro (state_v h4 s_iv) ((state_v h2 s_iv).[1] <- row_v h4 s1);
eq_intro (state_v h4 s_iv) (Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv))
inline_for_extraction noextract
let compress_t (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> s: state_p al ms
-> m: block_p al
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s /\ live h m /\ disjoint s m /\ disjoint wv s /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc s |+| loc wv) h0 h1
/\ state_v h1 s == Spec.blake2_compress al (state_v h0 s) h0.[|m|] offset flag))
inline_for_extraction noextract
val blake2_compress: #al:Spec.alg -> #ms:m_spec -> compress_t al ms
let blake2_compress #al #ms wv s m offset flag =
push_frame();
let m_w = create 16ul (Spec.zero al) in
blake2_compress0 #al m m_w;
blake2_compress1 wv s offset flag;
blake2_compress2 wv m_w;
blake2_compress3 s wv;
pop_frame()
inline_for_extraction noextract
let blake2_update_block_st (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> hash: state_p al ms
-> flag: bool
-> totlen: Spec.limb_t al{v totlen <= Spec.max_limb al}
-> d: block_p al ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_block al flag (v totlen) h0.[|d|] (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_block: #al:Spec.alg -> #ms:m_spec -> blake2_update_block_st al ms
let blake2_update_block #al #ms wv hash flag totlen d =
blake2_compress wv hash d totlen flag
inline_for_extraction noextract
let blake2_update1_st (al:Spec.alg) (ms:m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> d: lbuffer uint8 len
-> i: size_t{v i < length d / Spec.size_block al} ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update1 al (v prev) h0.[|d|] (v i) (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update1: #al:Spec.alg -> #ms:m_spec -> blake2_update_block: blake2_update_block_st al ms -> blake2_update1_st al ms
let blake2_update1 #al #ms blake2_update_block #len wv hash prev d i =
let totlen = prev +. size_to_limb al ((i+!1ul) *! size_block al) in
assert (v totlen == v prev + (v i + 1) * Spec.size_block al);
let b = sub d (i *. size_block al) (size_block al) in
let h = ST.get() in
assert (as_seq h b == Spec.get_blocki al (as_seq h d) (v i));
blake2_update_block wv hash false totlen b
inline_for_extraction noextract
let blake2_update_last_st (al:Spec.alg) (ms:m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> rem: size_t {v rem <= v len /\ v rem <= Spec.size_block al}
-> d: lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_last al (v prev) (v rem) h0.[|d|] (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_last:
#al:Spec.alg
-> #ms:m_spec
-> blake2_update_block: blake2_update_block_st al ms
-> blake2_update_last_st al ms
let blake2_update_last #al #ms blake2_update_block #len wv hash prev rem d =
let h0 = ST.get () in
[@inline_let]
let spec _ h1 = state_v h1 hash == Spec.blake2_update_last al (v prev) (v rem) h0.[|d|] (state_v h0 hash) in
salloc1 h0 (size_block al) (u8 0) (Ghost.hide (loc hash |+| loc wv)) spec
(fun last_block ->
let last = sub d (len -! rem) rem in
let h1 = ST.get() in
update_sub last_block 0ul rem last;
let h2 = ST.get() in
as_seq_gsub h1 d (len -! rem) rem;
assert (as_seq h1 last == Seq.sub (as_seq h1 d) (v len - v rem) (v rem));
assert (as_seq h1 last == Seq.slice (as_seq h0 d) (v len - v rem) (v len));
assert (as_seq h2 last_block == Spec.get_last_padded_block al (as_seq h0 d) (v rem));
let totlen = prev +. (size_to_limb al len) in
blake2_update_block wv hash true totlen last_block;
let h3 = ST.get() in
assert (v totlen == v prev + v len);
assert (state_v h3 hash == Spec.blake2_update_block al true (v totlen) (as_seq h2 last_block) (state_v h0 hash))) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 500,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.m_spec",
"Hacl.Impl.Blake2.Core.state_p",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThanOrEqual",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Spec.Blake2.Definitions.max_key",
"Prims.l_and",
"Spec.Blake2.Definitions.max_output",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Impl.Blake2.Core.element_t",
"Lib.Buffer.modifies",
"Lib.Buffer.loc",
"Prims.eq2",
"Spec.Blake2.Definitions.state",
"Hacl.Impl.Blake2.Core.state_v",
"Spec.Blake2.blake2_init_hash",
"Spec.Blake2.Definitions.blake2_default_params"
] | [] | false | false | false | true | true | let blake2_init_st (al: Spec.alg) (ms: m_spec) =
|
hash: state_p al ms ->
kk: size_t{v kk <= Spec.max_key al} ->
nn: size_t{1 <= v nn /\ v nn <= Spec.max_output al}
-> Stack unit
(requires (fun h -> live h hash))
(ensures
(fun h0 _ h1 ->
modifies (loc hash) h0 h1 /\
state_v h1 hash ==
Spec.blake2_init_hash al (Spec.blake2_default_params al) (v kk) (v nn))) | false |
|
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.g1 | val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r)) | val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r)) | let g1 #al #m wv a b r =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get() in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 82,
"end_line": 111,
"start_col": 0,
"start_line": 104
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract
val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)}
let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s)
/// Constants
/// Define algorithm functions
inline_for_extraction noextract
val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r)) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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 |
wv: Hacl.Impl.Blake2.Core.state_p al m ->
a: Hacl.Impl.Blake2.Core.index_t ->
b: Hacl.Impl.Blake2.Core.index_t ->
r: Lib.IntTypes.rotval (Spec.Blake2.Definitions.wt al)
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.m_spec",
"Hacl.Impl.Blake2.Core.state_p",
"Hacl.Impl.Blake2.Core.index_t",
"Lib.IntTypes.rotval",
"Spec.Blake2.Definitions.wt",
"Lib.Sequence.eq_intro",
"Spec.Blake2.Definitions.row",
"Hacl.Impl.Blake2.Core.state_v",
"Spec.Blake2.g1",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Impl.Blake2.Core.ror_row",
"Hacl.Impl.Blake2.Core.xor_row",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Hacl.Impl.Blake2.Core.element_t",
"Hacl.Impl.Blake2.Core.row_len",
"Hacl.Impl.Blake2.Core.rowi",
"Hacl.Impl.Blake2.Core.row_p"
] | [] | false | true | false | false | false | let g1 #al #m wv a b r =
| let h0 = ST.get () in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get () in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r) | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.size_to_limb | val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)} | val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)} | let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 46,
"end_line": 91,
"start_col": 0,
"start_line": 89
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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 | al: Spec.Blake2.Definitions.alg -> s: Lib.IntTypes.size_t
-> u37:
Spec.Blake2.Definitions.limb_t al
{u37 == Spec.Blake2.Definitions.nat_to_limb al (Lib.IntTypes.v s)} | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Lib.IntTypes.size_t",
"Lib.IntTypes.size_to_uint64",
"Lib.IntTypes.to_u128",
"Lib.IntTypes.U64",
"Lib.IntTypes.SEC",
"Spec.Blake2.Definitions.limb_t",
"Prims.eq2",
"Spec.Blake2.Definitions.nat_to_limb",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB"
] | [] | false | false | false | false | false | let size_to_limb al s =
| match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s) | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.get_iv | val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s)))) | val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s)))) | let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 23,
"end_line": 53,
"start_col": 0,
"start_line": 43
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s)))) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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: Spec.Blake2.Definitions.alg -> s: Lib.IntTypes.size_t{Lib.IntTypes.size_v s < 8}
-> FStar.HyperStack.ST.Stack (Hacl.Impl.Blake2.Core.word_t a) | FStar.HyperStack.ST.Stack | [] | [] | [
"Spec.Blake2.Definitions.alg",
"Lib.IntTypes.size_t",
"Prims.b2t",
"Prims.op_LessThan",
"Lib.IntTypes.size_v",
"Lib.IntTypes.secret",
"Spec.Blake2.Definitions.wt",
"Hacl.Impl.Blake2.Core.word_t",
"Spec.Blake2.Definitions.pub_word_t",
"Lib.Buffer.index",
"Lib.Buffer.CONST",
"FStar.UInt32.uint_to_t",
"Lib.Buffer.lbuffer_t",
"FStar.UInt32.t",
"Prims.eq2",
"LowStar.ConstBuffer.qual",
"LowStar.ConstBuffer.qual_of",
"LowStar.ConstBuffer.IMMUTABLE",
"Prims.l_and",
"Lib.Buffer.witnessed",
"Spec.Blake2.ivTable",
"Lib.Buffer.recallable",
"Hacl.Impl.Blake2.Constants.ivTable_S",
"Hacl.Impl.Blake2.Constants.ivTable_B",
"Prims.unit",
"Lib.Buffer.recall_contents",
"Spec.Blake2.Definitions.Blake2B",
"FStar.UInt32.__uint_to_t",
"Spec.Blake2.Definitions.Blake2S"
] | [] | false | true | false | false | false | let get_iv a s =
| recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@@ inline_let ]let ivTable:(x:
glbuffer (Spec.pub_word_t a) 8ul {witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.blake2_compress0 | val blake2_compress0:
#al:Spec.alg
-> m_s: block_p al
-> m_w: block_w al
-> Stack unit
(requires (fun h -> live h m_s /\ live h m_w /\ disjoint m_s m_w))
(ensures (fun h0 _ h1 -> modifies (loc m_w) h0 h1
/\ as_seq h1 m_w == Spec.blake2_compress0 al (as_seq h0 m_s))) | val blake2_compress0:
#al:Spec.alg
-> m_s: block_p al
-> m_w: block_w al
-> Stack unit
(requires (fun h -> live h m_s /\ live h m_w /\ disjoint m_s m_w))
(ensures (fun h0 _ h1 -> modifies (loc m_w) h0 h1
/\ as_seq h1 m_w == Spec.blake2_compress0 al (as_seq h0 m_s))) | let blake2_compress0 #al m_s m_w =
uints_from_bytes_le m_w m_s | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 29,
"end_line": 317,
"start_col": 0,
"start_line": 316
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract
val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)}
let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s)
/// Constants
/// Define algorithm functions
inline_for_extraction noextract
val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r))
let g1 #al #m wv a b r =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get() in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r)
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> x:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ disjoint wv x /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x)))
let g2 #al #m wv a b x =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
add_row wv_a x;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x))
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b)))
let g2z #al #m wv a b =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b))
inline_for_extraction noextract
val blake2_mixing : #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> x:row_p al m -> y:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ live h y /\ disjoint wv x /\ disjoint wv y))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_mixing al (state_v h0 wv) (row_v h0 x) (row_v h0 y)))
let blake2_mixing #al #m wv x y =
let h0 = ST.get() in
push_frame ();
let a = 0ul in
let b = 1ul in
let c = 2ul in
let d = 3ul in
[@inline_let]
let r0 = normalize_term (Lib.Sequence.index (Spec.rTable al) 0) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 0);
[@inline_let]
let r1 = normalize_term (Lib.Sequence.index (Spec.rTable al) 1) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 1);
[@inline_let]
let r2 = normalize_term (Lib.Sequence.index (Spec.rTable al) 2) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 2);
[@inline_let]
let r3 = normalize_term (Lib.Sequence.index (Spec.rTable al) 3) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 3);
let h1 = ST.get() in
g2 wv a b x;
g1 wv d a r0;
g2z wv c d;
g1 wv b c r1;
g2 wv a b y;
g1 wv d a r2;
g2z wv c d;
g1 wv b c r3;
let h2 = ST.get() in
pop_frame ();
let h3 = ST.get() in
assert(modifies (loc wv) h0 h3);
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.blake2_mixing al (state_v h1 wv) (row_v h1 x) (row_v h1 y))
#pop-options
inline_for_extraction noextract
val diag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.diag (state_v h0 wv)))
let diag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 1ul;
permr_row r2 2ul;
permr_row r3 3ul
inline_for_extraction noextract
val undiag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.undiag (state_v h0 wv)))
let undiag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 3ul;
permr_row r2 2ul;
permr_row r3 1ul
inline_for_extraction noextract
val gather_state: #a:Spec.alg -> #ms:m_spec -> st:state_p a ms -> m:block_w a -> start:size_t{v start <= 144} -> Stack unit
(requires (fun h -> live h st /\ live h m /\ disjoint st m))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
state_v h1 st == Spec.gather_state a (as_seq h0 m) (v start)))
inline_for_extraction noextract
let get_sigma' (start: size_t { v start <= 144 }) (i: size_t { normalize (i <=. 15ul) }):
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 ->
h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v start + v i])))
=
get_sigma (start +! i)
#push-options "--z3rlimit 500"
let gather_state #a #ms st m start =
let h0 = ST.get() in
let r0 = rowi st 0ul in
let r1 = rowi st 1ul in
let r2 = rowi st 2ul in
let r3 = rowi st 3ul in
let s0 = get_sigma' start 0ul in
let s1 = get_sigma' start 1ul in
let s2 = get_sigma' start 2ul in
let s3 = get_sigma' start 3ul in
let s4 = get_sigma' start 4ul in
let s5 = get_sigma' start 5ul in
let s6 = get_sigma' start 6ul in
let s7 = get_sigma' start 7ul in
let s8 = get_sigma' start 8ul in
let s9 = get_sigma' start 9ul in
let s10 = get_sigma' start 10ul in
let s11 = get_sigma' start 11ul in
let s12 = get_sigma' start 12ul in
let s13 = get_sigma' start 13ul in
let s14 = get_sigma' start 14ul in
let s15 = get_sigma' start 15ul in
let h1 = ST.get() in
gather_row r0 m s0 s2 s4 s6;
let h2 = ST.get() in
gather_row r1 m s1 s3 s5 s7;
let h3 = ST.get() in
gather_row r2 m s8 s10 s12 s14;
let h4 = ST.get() in
gather_row r3 m s9 s11 s13 s15;
let h5 = ST.get() in
assert(modifies (loc st) h0 h5);
Lib.Sequence.eq_intro (state_v h5 st) (Spec.gather_state a (as_seq h0 m) (v start))
inline_for_extraction noextract
val blake2_round : #al:Spec.alg -> #ms:m_spec -> wv:state_p al ms -> m:block_w al -> i:size_t ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_round al (as_seq h0 m) (v i) (state_v h0 wv)))
let blake2_round #al #ms wv m i =
push_frame();
let start_idx = (i %. size 10) *. size 16 in
assert (v start_idx == (v i % 10) * 16);
assert (v start_idx <= 144);
let m_st = alloc_state al ms in
gather_state m_st m start_idx;
let x = rowi m_st 0ul in
let y = rowi m_st 1ul in
let z = rowi m_st 2ul in
let w = rowi m_st 3ul in
let h1 = ST.get() in
assert (disjoint wv m_st);
assert (disjoint m_st wv);
assert (disjoint x wv);
assert (disjoint wv x);
assert (disjoint y wv);
assert (disjoint wv y);
assert (disjoint z wv);
assert (disjoint wv z);
assert (disjoint w wv);
assert (disjoint wv w);
blake2_mixing wv x y;
diag wv;
blake2_mixing wv z w;
undiag wv;
pop_frame ()
inline_for_extraction noextract
val blake2_compress0:
#al:Spec.alg
-> m_s: block_p al
-> m_w: block_w al
-> Stack unit
(requires (fun h -> live h m_s /\ live h m_w /\ disjoint m_s m_w))
(ensures (fun h0 _ h1 -> modifies (loc m_w) h0 h1
/\ as_seq h1 m_w == Spec.blake2_compress0 al (as_seq h0 m_s))) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 500,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false | m_s: Hacl.Impl.Blake2.Core.block_p al -> m_w: Hacl.Impl.Blake2.Core.block_w al
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.block_p",
"Hacl.Impl.Blake2.Core.block_w",
"Lib.ByteBuffer.uints_from_bytes_le",
"Spec.Blake2.Definitions.wt",
"Lib.IntTypes.SEC",
"FStar.UInt32.__uint_to_t",
"Prims.unit"
] | [] | false | true | false | false | false | let blake2_compress0 #al m_s m_w =
| uints_from_bytes_le m_w m_s | false |
Steel.ST.HigherReference.fst | Steel.ST.HigherReference.share | val share (#a:Type)
(#uses:_)
(#p:perm)
(#v:erased a)
(r:ref a)
: STGhostT unit uses
(pts_to r p v)
(fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v) | val share (#a:Type)
(#uses:_)
(#p:perm)
(#v:erased a)
(r:ref a)
: STGhostT unit uses
(pts_to r p v)
(fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v) | let share (#a:Type)
(#uses:_)
(#p:perm)
(#v:erased a)
(r:ref a)
: STGhostT unit uses
(pts_to r p v)
(fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)
= coerce_ghost (fun _ -> R.share r) | {
"file_name": "lib/steel/Steel.ST.HigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 37,
"end_line": 176,
"start_col": 0,
"start_line": 168
} | (*
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.HigherReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.HigherReference
let ref (a:Type u#1)
: Type0
= R.ref a
let null (#a:Type)
: ref a
= R.null #a
let is_null (#a:Type) (r:ref a)
: b:bool{b <==> r == null}
= R.is_null r
let pts_to (#a:Type)
(r:ref a)
([@@@smt_fallback] p:perm)
([@@@smt_fallback] v:a)
: vprop
= R.pts_to r p v
let pts_to_injective_eq
(#a: Type)
(#opened:inames)
(#p0 #p1:perm)
(#v0 #v1:a)
(r: ref a)
: STGhost unit opened
(pts_to r p0 v0 `star` pts_to r p1 v1)
(fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)
(requires True)
(ensures fun _ -> v0 == v1)
= coerce_ghost
(fun _ -> R.higher_ref_pts_to_injective_eq #a #opened #p0 #p1 #(hide v0) #(hide v1) r)
let pts_to_not_null #a #opened #p #v r
= extract_fact #opened (pts_to r p v) (r =!= null) (R.pts_to_not_null r p v);
()
let alloc (#a:Type) (x:a)
: ST (ref a)
emp
(fun r -> pts_to r full_perm x)
(requires True)
(ensures fun r -> not (is_null r))
= let r = coerce_steel (fun _ -> R.alloc x) in
r
let read (#a:Type)
(#p:perm)
(#v:erased a)
(r:ref a)
: ST a
(pts_to r p v)
(fun _ -> pts_to r p v)
(requires True)
(ensures fun x -> x == Ghost.reveal v)
= let u = coerce_steel (fun _ -> R.read r) in
return u
let write (#a:Type)
(#v:erased a)
(r:ref a)
(x:a)
: STT unit
(pts_to r full_perm v)
(fun _ -> pts_to r full_perm x)
= coerce_steel (fun _ -> R.write r x);
return ()
let free (#a:Type)
(#v:erased a)
(r:ref a)
: STT unit
(pts_to r full_perm v)
(fun _ -> emp)
= coerce_steel(fun _ -> R.free r);
return ()
/// Local primitive, to be extracted to Low* EPushFrame. To remember
/// that we need to call some pop_frame later, we insert some dummy
/// vprop into the context.
let _stack_frame : vprop = pure True
let _push_frame () : STT unit emp (fun _ -> _stack_frame) =
rewrite (pure True) _stack_frame
/// Local primitive, to be extracted to Low* EBufCreate
let _alloca (#a:Type) (x:a)
: ST (ref a)
emp
(fun r -> pts_to r full_perm x)
(requires True)
(ensures fun r -> not (is_null r))
= alloc x
/// Local primitive, to be extracted to Low* EPopFrame
let _free_and_pop_frame
(#a:Type)
(#v:erased a)
(r:ref a)
: STT unit
(pts_to r full_perm v `star` _stack_frame)
(fun _ -> emp)
= free r;
rewrite _stack_frame (pure True);
elim_pure _
let with_local
(#t: Type)
(init: t)
(#pre: vprop)
(#ret_t: Type)
(#post: ret_t -> vprop)
(body: (r: ref t) ->
STT ret_t
(pts_to r full_perm init `star` pre)
(fun v -> exists_ (pts_to r full_perm) `star` post v)
)
: STF ret_t pre post True (fun _ -> True)
= _push_frame ();
let r = _alloca init in
let v = body r in
let _ = elim_exists () in
_free_and_pop_frame r;
return v
let with_named_local
(#t: Type)
(init: t)
(#pre: vprop)
(#ret_t: Type)
(#post: ret_t -> vprop)
(name: string)
(body: (r: ref t) ->
STT ret_t
(pts_to r full_perm init `star` pre)
(fun v -> exists_ (pts_to r full_perm) `star` post v)
)
: STF ret_t pre post True (fun _ -> True)
= _push_frame ();
[@(rename_let name)]
let r = _alloca init in
let v = body r in
let _ = elim_exists () in
_free_and_pop_frame r;
return v | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.HigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | r: Steel.ST.HigherReference.ref a -> Steel.ST.Effect.Ghost.STGhostT Prims.unit | Steel.ST.Effect.Ghost.STGhostT | [] | [] | [
"Steel.Memory.inames",
"Steel.FractionalPermission.perm",
"FStar.Ghost.erased",
"Steel.ST.HigherReference.ref",
"Steel.ST.Coercions.coerce_ghost",
"Prims.unit",
"Steel.Effect.Common.VUnit",
"Steel.Effect.Common.to_vprop'",
"Steel.HigherReference.pts_to_sl",
"FStar.Ghost.reveal",
"Steel.Effect.Common.star",
"Steel.FractionalPermission.half_perm",
"Steel.Effect.Common.vprop",
"Prims.l_True",
"Steel.HigherReference.share",
"Steel.ST.HigherReference.pts_to"
] | [] | false | true | false | false | false | let share (#a: Type) (#uses: _) (#p: perm) (#v: erased a) (r: ref a)
: STGhostT unit
uses
(pts_to r p v)
(fun _ -> (pts_to r (half_perm p) v) `star` (pts_to r (half_perm p) v)) =
| coerce_ghost (fun _ -> R.share r) | false |
Steel.ST.HigherReference.fst | Steel.ST.HigherReference.pts_to_not_null | val pts_to_not_null (#a:Type)
(#opened:inames)
(#p:perm)
(#v:a)
(r:ref a)
: STGhost unit opened
(pts_to r p v)
(fun _ -> pts_to r p v)
(requires True)
(ensures fun _ -> r =!= null) | val pts_to_not_null (#a:Type)
(#opened:inames)
(#p:perm)
(#v:a)
(r:ref a)
: STGhost unit opened
(pts_to r p v)
(fun _ -> pts_to r p v)
(requires True)
(ensures fun _ -> r =!= null) | let pts_to_not_null #a #opened #p #v r
= extract_fact #opened (pts_to r p v) (r =!= null) (R.pts_to_not_null r p v);
() | {
"file_name": "lib/steel/Steel.ST.HigherReference.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 6,
"end_line": 58,
"start_col": 0,
"start_line": 56
} | (*
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.HigherReference
open FStar.Ghost
open Steel.ST.Util
open Steel.ST.Coercions
module R = Steel.HigherReference
let ref (a:Type u#1)
: Type0
= R.ref a
let null (#a:Type)
: ref a
= R.null #a
let is_null (#a:Type) (r:ref a)
: b:bool{b <==> r == null}
= R.is_null r
let pts_to (#a:Type)
(r:ref a)
([@@@smt_fallback] p:perm)
([@@@smt_fallback] v:a)
: vprop
= R.pts_to r p v
let pts_to_injective_eq
(#a: Type)
(#opened:inames)
(#p0 #p1:perm)
(#v0 #v1:a)
(r: ref a)
: STGhost unit opened
(pts_to r p0 v0 `star` pts_to r p1 v1)
(fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)
(requires True)
(ensures fun _ -> v0 == v1)
= coerce_ghost
(fun _ -> R.higher_ref_pts_to_injective_eq #a #opened #p0 #p1 #(hide v0) #(hide v1) r) | {
"checked_file": "/",
"dependencies": [
"Steel.ST.Util.fsti.checked",
"Steel.ST.Coercions.fsti.checked",
"Steel.HigherReference.fsti.checked",
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "Steel.ST.HigherReference.fst"
} | [
{
"abbrev": true,
"full_module": "Steel.HigherReference",
"short_module": "R"
},
{
"abbrev": false,
"full_module": "Steel.ST.Coercions",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": true,
"full_module": "FStar.UInt32",
"short_module": "U32"
},
{
"abbrev": false,
"full_module": "Steel.ST.Util",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Ghost",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"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 | r: Steel.ST.HigherReference.ref a -> Steel.ST.Effect.Ghost.STGhost Prims.unit | Steel.ST.Effect.Ghost.STGhost | [] | [] | [
"Steel.Memory.inames",
"Steel.FractionalPermission.perm",
"Steel.ST.HigherReference.ref",
"Prims.unit",
"Steel.ST.Effect.Ghost.extract_fact",
"Steel.ST.HigherReference.pts_to",
"Prims.l_not",
"Prims.eq2",
"Steel.ST.HigherReference.null",
"Steel.HigherReference.pts_to_not_null"
] | [] | false | true | false | false | false | let pts_to_not_null #a #opened #p #v r =
| extract_fact #opened (pts_to r p v) (r =!= null) (R.pts_to_not_null r p v);
() | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.blake2_malloc_st | val blake2_malloc_st : al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | let blake2_malloc_st (al:Spec.alg) (ms:m_spec) = r:rid -> ST.ST (state_p al ms)
(requires (fun h ->
ST.is_eternal_region r))
(ensures (fun h0 s h1 ->
live h1 s /\
M.(modifies loc_none h0 h1) /\
B.fresh_loc (loc_addr_of_buffer s) h0 h1 /\
(M.loc_includes (M.loc_region_only true r) (loc_addr_of_buffer s)) /\
freeable s)) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 16,
"end_line": 1057,
"start_col": 0,
"start_line": 1049
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract
val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)}
let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s)
/// Constants
/// Define algorithm functions
inline_for_extraction noextract
val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r))
let g1 #al #m wv a b r =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get() in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r)
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> x:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ disjoint wv x /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x)))
let g2 #al #m wv a b x =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
add_row wv_a x;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x))
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b)))
let g2z #al #m wv a b =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b))
inline_for_extraction noextract
val blake2_mixing : #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> x:row_p al m -> y:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ live h y /\ disjoint wv x /\ disjoint wv y))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_mixing al (state_v h0 wv) (row_v h0 x) (row_v h0 y)))
let blake2_mixing #al #m wv x y =
let h0 = ST.get() in
push_frame ();
let a = 0ul in
let b = 1ul in
let c = 2ul in
let d = 3ul in
[@inline_let]
let r0 = normalize_term (Lib.Sequence.index (Spec.rTable al) 0) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 0);
[@inline_let]
let r1 = normalize_term (Lib.Sequence.index (Spec.rTable al) 1) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 1);
[@inline_let]
let r2 = normalize_term (Lib.Sequence.index (Spec.rTable al) 2) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 2);
[@inline_let]
let r3 = normalize_term (Lib.Sequence.index (Spec.rTable al) 3) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 3);
let h1 = ST.get() in
g2 wv a b x;
g1 wv d a r0;
g2z wv c d;
g1 wv b c r1;
g2 wv a b y;
g1 wv d a r2;
g2z wv c d;
g1 wv b c r3;
let h2 = ST.get() in
pop_frame ();
let h3 = ST.get() in
assert(modifies (loc wv) h0 h3);
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.blake2_mixing al (state_v h1 wv) (row_v h1 x) (row_v h1 y))
#pop-options
inline_for_extraction noextract
val diag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.diag (state_v h0 wv)))
let diag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 1ul;
permr_row r2 2ul;
permr_row r3 3ul
inline_for_extraction noextract
val undiag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.undiag (state_v h0 wv)))
let undiag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 3ul;
permr_row r2 2ul;
permr_row r3 1ul
inline_for_extraction noextract
val gather_state: #a:Spec.alg -> #ms:m_spec -> st:state_p a ms -> m:block_w a -> start:size_t{v start <= 144} -> Stack unit
(requires (fun h -> live h st /\ live h m /\ disjoint st m))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
state_v h1 st == Spec.gather_state a (as_seq h0 m) (v start)))
inline_for_extraction noextract
let get_sigma' (start: size_t { v start <= 144 }) (i: size_t { normalize (i <=. 15ul) }):
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 ->
h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v start + v i])))
=
get_sigma (start +! i)
#push-options "--z3rlimit 500"
let gather_state #a #ms st m start =
let h0 = ST.get() in
let r0 = rowi st 0ul in
let r1 = rowi st 1ul in
let r2 = rowi st 2ul in
let r3 = rowi st 3ul in
let s0 = get_sigma' start 0ul in
let s1 = get_sigma' start 1ul in
let s2 = get_sigma' start 2ul in
let s3 = get_sigma' start 3ul in
let s4 = get_sigma' start 4ul in
let s5 = get_sigma' start 5ul in
let s6 = get_sigma' start 6ul in
let s7 = get_sigma' start 7ul in
let s8 = get_sigma' start 8ul in
let s9 = get_sigma' start 9ul in
let s10 = get_sigma' start 10ul in
let s11 = get_sigma' start 11ul in
let s12 = get_sigma' start 12ul in
let s13 = get_sigma' start 13ul in
let s14 = get_sigma' start 14ul in
let s15 = get_sigma' start 15ul in
let h1 = ST.get() in
gather_row r0 m s0 s2 s4 s6;
let h2 = ST.get() in
gather_row r1 m s1 s3 s5 s7;
let h3 = ST.get() in
gather_row r2 m s8 s10 s12 s14;
let h4 = ST.get() in
gather_row r3 m s9 s11 s13 s15;
let h5 = ST.get() in
assert(modifies (loc st) h0 h5);
Lib.Sequence.eq_intro (state_v h5 st) (Spec.gather_state a (as_seq h0 m) (v start))
inline_for_extraction noextract
val blake2_round : #al:Spec.alg -> #ms:m_spec -> wv:state_p al ms -> m:block_w al -> i:size_t ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_round al (as_seq h0 m) (v i) (state_v h0 wv)))
let blake2_round #al #ms wv m i =
push_frame();
let start_idx = (i %. size 10) *. size 16 in
assert (v start_idx == (v i % 10) * 16);
assert (v start_idx <= 144);
let m_st = alloc_state al ms in
gather_state m_st m start_idx;
let x = rowi m_st 0ul in
let y = rowi m_st 1ul in
let z = rowi m_st 2ul in
let w = rowi m_st 3ul in
let h1 = ST.get() in
assert (disjoint wv m_st);
assert (disjoint m_st wv);
assert (disjoint x wv);
assert (disjoint wv x);
assert (disjoint y wv);
assert (disjoint wv y);
assert (disjoint z wv);
assert (disjoint wv z);
assert (disjoint w wv);
assert (disjoint wv w);
blake2_mixing wv x y;
diag wv;
blake2_mixing wv z w;
undiag wv;
pop_frame ()
inline_for_extraction noextract
val blake2_compress0:
#al:Spec.alg
-> m_s: block_p al
-> m_w: block_w al
-> Stack unit
(requires (fun h -> live h m_s /\ live h m_w /\ disjoint m_s m_w))
(ensures (fun h0 _ h1 -> modifies (loc m_w) h0 h1
/\ as_seq h1 m_w == Spec.blake2_compress0 al (as_seq h0 m_s)))
let blake2_compress0 #al m_s m_w =
uints_from_bytes_le m_w m_s
inline_for_extraction noextract
val blake2_compress1:
#al:Spec.alg
-> #m:m_spec
-> wv: state_p al m
-> s_iv: state_p al m
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s_iv /\ disjoint wv s_iv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_compress1 al (state_v h0 s_iv) offset flag))
let blake2_compress1 #al #m wv s_iv offset flag =
let h0 = ST.get() in
push_frame();
let mask = alloc_row al m in
[@inline_let]
let wv_12 = Spec.limb_to_word al offset in
[@inline_let]
let wv_13 = Spec.limb_to_word al (offset >>. (size (bits (Spec.wt al)))) in
// SH: TODO: for some reason, ``ones`` below doesn't get inlined by KaRaMeL,
// causing an extraction problem. The 3 lines below are a hack to fix
// extraction for the time being:
// [> let wv_14 = if flag then (ones (Spec.wt al) SEC) else (Spec.zero al) in
// After investigation, it is because ones is [@(strict_on_arguments [0])],
// and so isn't unfolded if its first argument is not normalized to a constant.
// However, the first argument should always be normalized (I checked the
// output generated by KaRaMeL and the definitions).
(**) normalize_term_spec (Spec.wt al);
[@inline_let] let wt_al = normalize_term (Spec.wt al) in
let wv_14 = if flag then ones wt_al SEC else (Spec.zero al) in
// end of the TODO
let wv_15 = Spec.zero al in
create_row mask wv_12 wv_13 wv_14 wv_15;
copy_state wv s_iv;
let wv3 = rowi wv 3ul in
xor_row wv3 mask;
pop_frame();
let h1 = ST.get() in
assert(modifies (loc wv) h0 h1);
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.blake2_compress1 al (state_v h0 s_iv) offset flag)
inline_for_extraction noextract
val blake2_compress2 :
#al:Spec.alg
-> #ms:m_spec
-> wv: state_p al ms
-> m: block_w al ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies1 wv h0 h1
/\ state_v h1 wv == Spec.blake2_compress2 al (state_v h0 wv) (as_seq h0 m)))
#push-options "--z3rlimit 400"
let blake2_compress2 #al #ms wv m =
let h0 = ST.get () in
[@inline_let]
let a_spec = Spec.state al in
[@inline_let]
let refl h = state_v h wv in
[@inline_let]
let footprint = Ghost.hide(loc wv) in
[@inline_let]
let spec h = Spec.blake2_round al h.[|m|] in
loop_refl h0 (rounds_t al) a_spec refl footprint spec
(fun i ->
Loops.unfold_repeati (Spec.rounds al) (spec h0) (state_v h0 wv) (v i);
blake2_round wv m i)
#pop-options
inline_for_extraction noextract
val blake2_compress3 :
#al:Spec.alg
-> #ms:m_spec
-> s_iv:state_p al ms
-> wv:state_p al ms ->
Stack unit
(requires (fun h -> live h s_iv /\ live h wv /\ disjoint s_iv wv))
(ensures (fun h0 _ h1 -> modifies (loc s_iv) h0 h1
/\ state_v h1 s_iv == Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv)))
let blake2_compress3 #al #ms s_iv wv =
let h0 = ST.get() in
let s0 = rowi s_iv 0ul in
let s1 = rowi s_iv 1ul in
let r0 = rowi wv 0ul in
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
assert (disjoint s0 wv);
assert (disjoint wv s0);
assert (disjoint s1 wv);
assert (disjoint wv s1);
assert (disjoint r0 s0);
assert (disjoint r2 s0);
assert (disjoint r1 s1);
assert (disjoint r3 s1);
xor_row s0 r0;
let h1 = ST.get() in
xor_row s0 r2;
let h2 = ST.get() in
xor_row s1 r1;
let h3 = ST.get() in
xor_row s1 r3;
let h4 = ST.get() in
assert (modifies (loc s_iv) h0 h4);
let open Lib.Sequence in
assert (row_v h0 r0 == (state_v h0 wv).[0]);
assert (row_v h1 r2 == (state_v h0 wv).[2]);
assert (row_v h4 s0 == Spec.(((state_v h0 s_iv).[0] ^| (state_v h0 wv).[0]) ^| (state_v h0 wv).[2]));
assert (row_v h4 s1 == Spec.(((state_v h0 s_iv).[1] ^| (state_v h0 wv).[1]) ^| (state_v h0 wv).[3]));
eq_intro (state_v h2 s_iv) ((state_v h0 s_iv).[0] <- row_v h4 s0);
eq_intro (state_v h4 s_iv) ((state_v h2 s_iv).[1] <- row_v h4 s1);
eq_intro (state_v h4 s_iv) (Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv))
inline_for_extraction noextract
let compress_t (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> s: state_p al ms
-> m: block_p al
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s /\ live h m /\ disjoint s m /\ disjoint wv s /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc s |+| loc wv) h0 h1
/\ state_v h1 s == Spec.blake2_compress al (state_v h0 s) h0.[|m|] offset flag))
inline_for_extraction noextract
val blake2_compress: #al:Spec.alg -> #ms:m_spec -> compress_t al ms
let blake2_compress #al #ms wv s m offset flag =
push_frame();
let m_w = create 16ul (Spec.zero al) in
blake2_compress0 #al m m_w;
blake2_compress1 wv s offset flag;
blake2_compress2 wv m_w;
blake2_compress3 s wv;
pop_frame()
inline_for_extraction noextract
let blake2_update_block_st (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> hash: state_p al ms
-> flag: bool
-> totlen: Spec.limb_t al{v totlen <= Spec.max_limb al}
-> d: block_p al ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_block al flag (v totlen) h0.[|d|] (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_block: #al:Spec.alg -> #ms:m_spec -> blake2_update_block_st al ms
let blake2_update_block #al #ms wv hash flag totlen d =
blake2_compress wv hash d totlen flag
inline_for_extraction noextract
let blake2_update1_st (al:Spec.alg) (ms:m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> d: lbuffer uint8 len
-> i: size_t{v i < length d / Spec.size_block al} ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update1 al (v prev) h0.[|d|] (v i) (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update1: #al:Spec.alg -> #ms:m_spec -> blake2_update_block: blake2_update_block_st al ms -> blake2_update1_st al ms
let blake2_update1 #al #ms blake2_update_block #len wv hash prev d i =
let totlen = prev +. size_to_limb al ((i+!1ul) *! size_block al) in
assert (v totlen == v prev + (v i + 1) * Spec.size_block al);
let b = sub d (i *. size_block al) (size_block al) in
let h = ST.get() in
assert (as_seq h b == Spec.get_blocki al (as_seq h d) (v i));
blake2_update_block wv hash false totlen b
inline_for_extraction noextract
let blake2_update_last_st (al:Spec.alg) (ms:m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> rem: size_t {v rem <= v len /\ v rem <= Spec.size_block al}
-> d: lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_last al (v prev) (v rem) h0.[|d|] (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_last:
#al:Spec.alg
-> #ms:m_spec
-> blake2_update_block: blake2_update_block_st al ms
-> blake2_update_last_st al ms
let blake2_update_last #al #ms blake2_update_block #len wv hash prev rem d =
let h0 = ST.get () in
[@inline_let]
let spec _ h1 = state_v h1 hash == Spec.blake2_update_last al (v prev) (v rem) h0.[|d|] (state_v h0 hash) in
salloc1 h0 (size_block al) (u8 0) (Ghost.hide (loc hash |+| loc wv)) spec
(fun last_block ->
let last = sub d (len -! rem) rem in
let h1 = ST.get() in
update_sub last_block 0ul rem last;
let h2 = ST.get() in
as_seq_gsub h1 d (len -! rem) rem;
assert (as_seq h1 last == Seq.sub (as_seq h1 d) (v len - v rem) (v rem));
assert (as_seq h1 last == Seq.slice (as_seq h0 d) (v len - v rem) (v len));
assert (as_seq h2 last_block == Spec.get_last_padded_block al (as_seq h0 d) (v rem));
let totlen = prev +. (size_to_limb al len) in
blake2_update_block wv hash true totlen last_block;
let h3 = ST.get() in
assert (v totlen == v prev + v len);
assert (state_v h3 hash == Spec.blake2_update_block al true (v totlen) (as_seq h2 last_block) (state_v h0 hash)))
inline_for_extraction noextract
let blake2_init_st (al:Spec.alg) (ms:m_spec) =
hash: state_p al ms
-> kk: size_t{v kk <= Spec.max_key al}
-> nn: size_t{1 <= v nn /\ v nn <= Spec.max_output al} ->
Stack unit
(requires (fun h -> live h hash))
(ensures (fun h0 _ h1 -> modifies (loc hash) h0 h1 /\
state_v h1 hash == Spec.blake2_init_hash al (Spec.blake2_default_params al) (v kk) (v nn)))
inline_for_extraction noextract
val serialize_params (al:Spec.alg)
(kk:size_t{v kk <= Spec.max_key al})
(nn: size_t{1 <= v nn /\ v nn <= Spec.max_output al})
(p: blake2_params al)
(b: lbuffer (word_t al) 8ul)
: Stack unit
(requires fun h ->
live h b /\
blake2_params_inv h p /\
LowStar.Buffer.loc_disjoint (loc b) (blake2_params_loc p) /\
as_seq h b == Seq.create 8 (Spec.nat_to_word al 0)
)
(ensures fun h0 _ h1 ->
modifies (loc b) h0 h1 /\
as_seq h1 b == Spec.serialize_blake2_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk)))
#push-options "--z3rlimit 100 --fuel 0"
inline_for_extraction noextract
let serialize_params_blake2s
(kk:size_t{v kk <= Spec.max_key Spec.Blake2S})
(nn: size_t{1 <= v nn /\ v nn <= Spec.max_output Spec.Blake2S})
(p: blake2_params Spec.Blake2S)
(b: lbuffer (word_t Spec.Blake2S) 8ul)
: Stack unit
(requires fun h -> live h b /\
blake2_params_inv h p /\
LowStar.Buffer.loc_disjoint (loc b) (blake2_params_loc p) /\
as_seq h b == Seq.create 8 (u32 0)
)
(ensures fun h0 _ h1 ->
modifies (loc b) h0 h1 /\
as_seq h1 b == Spec.serialize_blake2_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk)))
= let h0 = ST.get () in
[@inline_let]
let kk_shift_8 = shift_left (to_u32 kk) (size 8) in
[@inline_let]
let fanout_shift_16 = shift_left (to_u32 p.fanout) (size 16) in
[@inline_let]
let depth_shift_24 = shift_left (to_u32 p.depth) (size 24) in
[@inline_let]
let v0 = (to_u32 nn) ^. kk_shift_8 ^. fanout_shift_16 ^. depth_shift_24 in
[@inline_let]
let v1 = p.leaf_length in
[@inline_let]
let v2 = p.node_offset in
[@inline_let]
let node_depth_shift_16 = shift_left (to_u32 p.node_depth) (size 16) in
[@inline_let]
let inner_length_shift_16 = shift_left (to_u32 p.inner_length) (size 24) in
[@inline_let]
let v3 = (to_u32 p.xof_length) ^. node_depth_shift_16 ^. inner_length_shift_16 in
uints_from_bytes_le (sub b 4ul 2ul) p.salt;
uints_from_bytes_le (sub b 6ul 2ul) p.personal;
// AF: Putting these writes *after* modifications on a subbuffer of b helps with modifies-reasoning:
// By putting them before, F* struggles with proving that b[0..3] is not modified by uints_from_bytes_le
b.(0ul) <- v0;
b.(1ul) <- v1;
b.(2ul) <- v2;
b.(3ul) <- v3;
let h1 = ST.get () in
let aux () : Lemma (as_seq h1 b `Seq.equal` Spec.serialize_blake2s_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk))) =
let open Lib.Sequence in
let open Lib.ByteSequence in
let s0 = (u32 (v nn)) ^.
(u32 (v kk) <<. (size 8)) ^.
(u32 (v p.fanout) <<. (size 16)) ^.
(u32 (v p.depth) <<. (size 24)) in
let s1 = p.leaf_length in
let s2 = p.node_offset in
let s3 = (u32 (v p.xof_length)) ^.
(u32 (v p.node_depth) <<. (size 16)) ^.
(u32 (v p.inner_length) <<. (size 24)) in
let salt_u32: lseq uint32 2 = uints_from_bytes_le (as_seq h0 (get_salt p)) in
let s4 = salt_u32.[0] in
let s5 = salt_u32.[1] in
let personal_u32: lseq uint32 2 = uints_from_bytes_le (as_seq h0 (get_personal p)) in
let s6 = personal_u32.[0] in
let s7 = personal_u32.[1] in
[@inline_let]
let l = [s0; s1; s2; s3; s4; s5; s6; s7] in
assert_norm (List.Tot.length l == 8);
// There seems to be something not triggering with createL, requiring the
// following lemma calls, and assert_norms to relate List.index to the
// actual elements
assert_norm (List.Tot.index l 0 == s0);
assert_norm (List.Tot.index l 1 == s1);
assert_norm (List.Tot.index l 2 == s2);
assert_norm (List.Tot.index l 3 == s3);
assert_norm (List.Tot.index l 4 == s4);
assert_norm (List.Tot.index l 5 == s5);
assert_norm (List.Tot.index l 6 == s6);
assert_norm (List.Tot.index l 7 == s7);
of_list_index l 0;
of_list_index l 1;
of_list_index l 2;
of_list_index l 3;
of_list_index l 4;
of_list_index l 5;
of_list_index l 6;
of_list_index l 7
in
aux()
inline_for_extraction noextract
let serialize_params_blake2b
(kk:size_t{v kk <= Spec.max_key Spec.Blake2B})
(nn: size_t{1 <= v nn /\ v nn <= Spec.max_output Spec.Blake2B})
(p: blake2_params Spec.Blake2B)
(b: lbuffer (word_t Spec.Blake2B) 8ul)
: Stack unit
(requires fun h -> live h b /\
blake2_params_inv #Spec.Blake2B h p /\
LowStar.Buffer.loc_disjoint (loc b) (blake2_params_loc p) /\
as_seq h b == Seq.create 8 (u64 0)
)
(ensures fun h0 _ h1 ->
modifies (loc b) h0 h1 /\
as_seq h1 b == Spec.serialize_blake2_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk)))
= let h0 = ST.get () in
[@inline_let]
let kk_shift_8 = shift_left (to_u64 kk) (size 8) in
[@inline_let]
let fanout_shift_16 = shift_left (to_u64 p.fanout) (size 16) in
[@inline_let]
let depth_shift_24 = shift_left (to_u64 p.depth) (size 24) in
[@inline_let]
let leaf_length_shift_32 = shift_left (to_u64 p.leaf_length) (size 32) in
[@inline_let]
let v0 = (to_u64 nn) ^. kk_shift_8 ^. fanout_shift_16 ^. depth_shift_24 ^. leaf_length_shift_32 in
[@inline_let]
let xof_length_shift_32 = shift_left (to_u64 p.xof_length) (size 32) in
[@inline_let]
let v1 = (to_u64 p.node_offset) ^. xof_length_shift_32 in
[@inline_let]
let inner_length_shift_8 = shift_left (to_u64 p.inner_length) (size 8) in
[@inline_let]
let v2 = (to_u64 p.node_depth) ^. inner_length_shift_8 in
uints_from_bytes_le (sub b 4ul 2ul) p.salt;
uints_from_bytes_le (sub b 6ul 2ul) p.personal;
b.(0ul) <- v0;
b.(1ul) <- v1;
b.(2ul) <- v2;
b.(3ul) <- (u64 0);
let h1 = ST.get () in
let aux () : Lemma (as_seq h1 b `Seq.equal` Spec.serialize_blake2b_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk))) =
let open Lib.Sequence in
let open Lib.ByteSequence in
let s0 = (u64 (v nn)) ^.
(u64 (v kk) <<. (size 8)) ^.
(u64 (v p.fanout) <<. (size 16)) ^.
(u64 (v p.depth) <<. (size 24)) ^.
(u64 (v p.leaf_length) <<. (size 32)) in
let s1 = (u64 (v p.node_offset)) ^.
(u64 (v p.xof_length) <<. (size 32)) in
// The serialization corresponding to s2 contains node_depth and inner_length,
// followed by the 14 reserved bytes which always seem to be zeros, and can hence
// be ignored when building the corresponding uint64 using xor's
let s2 = (u64 (v p.node_depth)) ^.
(u64 (v p.inner_length) <<. (size 8)) in
// s3 corresponds to the remaining of the reserved bytes
let s3 = u64 0 in
let salt_u64: lseq uint64 2 = uints_from_bytes_le (as_seq h0 (get_salt p)) in
let s4 = salt_u64.[0] in
let s5 = salt_u64.[1] in
let personal_u64: lseq uint64 2 = uints_from_bytes_le (as_seq h0 (get_personal p)) in
let s6 = personal_u64.[0] in
let s7 = personal_u64.[1] in
[@inline_let]
let l = [s0; s1; s2; s3; s4; s5; s6; s7] in
assert_norm (List.Tot.length l == 8);
// There seems to be something not triggering with createL, requiring the
// following lemma calls, and assert_norms to relate List.index to the
// actual elements
assert_norm (List.Tot.index l 0 == s0);
assert_norm (List.Tot.index l 1 == s1);
assert_norm (List.Tot.index l 2 == s2);
assert_norm (List.Tot.index l 3 == s3);
assert_norm (List.Tot.index l 4 == s4);
assert_norm (List.Tot.index l 5 == s5);
assert_norm (List.Tot.index l 6 == s6);
assert_norm (List.Tot.index l 7 == s7);
of_list_index l 0;
of_list_index l 1;
of_list_index l 2;
of_list_index l 3;
of_list_index l 4;
of_list_index l 5;
of_list_index l 6;
of_list_index l 7
in
aux()
#pop-options
let serialize_params al kk nn p b =
match al with
| Spec.Blake2S -> serialize_params_blake2s kk nn p b
| Spec.Blake2B -> serialize_params_blake2b kk nn p b
inline_for_extraction noextract
val blake2_init:
#al:Spec.alg
-> #ms:m_spec
-> blake2_init_st al ms
let blake2_init #al #ms hash kk nn =
push_frame ();
let h0 = ST.get() in
let tmp = create 8ul (Spec.nat_to_word al 0) in
let r0 = rowi hash 0ul in
let r1 = rowi hash 1ul in
let r2 = rowi hash 2ul in
let r3 = rowi hash 3ul in
let iv0 = get_iv al 0ul in
let iv1 = get_iv al 1ul in
let iv2 = get_iv al 2ul in
let iv3 = get_iv al 3ul in
let iv4 = get_iv al 4ul in
let iv5 = get_iv al 5ul in
let iv6 = get_iv al 6ul in
let iv7 = get_iv al 7ul in
create_row #al #ms r2 iv0 iv1 iv2 iv3;
create_row #al #ms r3 iv4 iv5 iv6 iv7;
let salt = create (salt_len al) (u8 0) in
let personal = create (personal_len al) (u8 0) in
let p = create_default_params al salt personal in
serialize_params al kk nn p tmp;
let tmp0 = tmp.(0ul) in
let tmp1 = tmp.(1ul) in
let tmp2 = tmp.(2ul) in
let tmp3 = tmp.(3ul) in
let tmp4 = tmp.(4ul) in
let tmp5 = tmp.(5ul) in
let tmp6 = tmp.(6ul) in
let tmp7 = tmp.(7ul) in
let iv0' = iv0 ^. tmp0 in
let iv1' = iv1 ^. tmp1 in
let iv2' = iv2 ^. tmp2 in
let iv3' = iv3 ^. tmp3 in
let iv4' = iv4 ^. tmp4 in
let iv5' = iv5 ^. tmp5 in
let iv6' = iv6 ^. tmp6 in
let iv7' = iv7 ^. tmp7 in
create_row #al #ms r0 iv0' iv1' iv2' iv3';
create_row #al #ms r1 iv4' iv5' iv6' iv7';
let h1 = ST.get() in
assert (disjoint hash tmp);
assert (modifies (loc hash `union` loc tmp) h0 h1);
Lib.Sequence.eq_intro (state_v h1 hash) (Spec.blake2_init_hash al (Spec.blake2_default_params al) (v kk) (v nn));
pop_frame ()
#push-options "--z3rlimit 100 --max_fuel 0 --max_ifuel 0"
let _ : squash (inversion Spec.alg) = allow_inversion Spec.alg
inline_for_extraction noextract
val split_blocks: al:Spec.alg -> len:size_t -> r:(size_t & size_t){
let (x,y) = r in
let (sx,sy) = Spec.split al (v len) in
sx == v x /\
sy == v y}
let split_blocks al len =
let nb = len /. size_block al in
let rem = len %. size_block al in
(if rem =. 0ul && nb >. 0ul then nb -! 1ul else nb),
(if rem =. 0ul && nb >. 0ul then size_block al else rem)
inline_for_extraction noextract
let blake2_update_multi_st (al : Spec.alg) (ms : m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> blocks: lbuffer uint8 len
-> nb : size_t{length blocks >= v nb * v (size_block al) } ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h blocks /\
disjoint hash blocks /\ disjoint wv hash /\ disjoint wv blocks))
(ensures (fun h0 _ h1 ->
modifies (loc hash |+| loc wv) h0 h1 /\
state_v h1 hash == repeati (v nb) (Spec.blake2_update1 al (v prev) h0.[|blocks|])
(state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_multi (#al : Spec.alg) (#ms : m_spec) :
blake2_update_block:blake2_update_block_st al ms
-> blake2_update_multi_st al ms
let blake2_update_multi #al #ms blake2_update_block #len wv hash prev blocks nb =
let h0 = ST.get () in
[@inline_let]
let a_spec = Spec.state al in
[@inline_let]
let refl h = state_v h hash in
[@inline_let]
let footprint = Ghost.hide(loc hash |+| loc wv) in
[@inline_let]
let spec h = Spec.blake2_update1 al (v prev) h.[|blocks|] in
loop_refl h0 nb a_spec refl footprint spec
(fun i ->
Loops.unfold_repeati (v nb) (spec h0) (state_v h0 hash) (v i);
blake2_update1 #al #ms blake2_update_block #len wv hash prev blocks i)
inline_for_extraction noextract
let blake2_update_blocks_st (al : Spec.alg) (ms : m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> blocks: lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h blocks /\ disjoint hash blocks /\ disjoint wv hash /\ disjoint wv blocks))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1 /\
state_v h1 hash ==
Spec.blake2_update_blocks al (v prev) h0.[|blocks|] (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_blocks (#al : Spec.alg) (#ms : m_spec) :
blake2_update_multi_st al ms
-> blake2_update_last_st al ms
-> blake2_update_blocks_st al ms
let blake2_update_blocks #al #ms blake2_update_multi blake2_update_last #len wv hash prev blocks =
let (nb,rem) = split_blocks al len in
blake2_update_multi wv hash prev blocks nb;
blake2_update_last #len wv hash prev rem blocks
inline_for_extraction noextract
let blake2_finish_st (al:Spec.alg) (ms:m_spec) =
nn: size_t{1 <= v nn /\ v nn <= Spec.max_output al}
-> output: lbuffer uint8 nn
-> hash: state_p al ms ->
Stack unit
(requires (fun h -> live h hash /\ live h output /\ disjoint output hash))
(ensures (fun h0 _ h1 -> modifies (loc output) h0 h1
/\ h1.[|output|] == Spec.blake2_finish al (state_v h0 hash) (v nn)))
inline_for_extraction noextract
val blake2_finish:#al:Spec.alg -> #ms:m_spec -> blake2_finish_st al ms
let blake2_finish #al #ms nn output hash =
let h0 = ST.get () in
[@inline_let]
let double_row = 2ul *. size_row al in
[@inline_let]
let spec _ h1 = h1.[|output|] == Spec.blake2_finish al (state_v h0 hash) (v nn) in
salloc1 h0 double_row (u8 0) (Ghost.hide (loc output)) spec
(fun full ->
let first = sub full 0ul (size_row al) in
let second = sub full (size_row al) (size_row al) in
let row0 = rowi hash 0ul in
let row1 = rowi hash 1ul in
store_row first row0;
store_row second row1;
let h1 = ST.get() in
Lib.Sequence.eq_intro (as_seq h1 full)
(Lib.Sequence.(as_seq h1 (gsub full 0ul (size_row al)) @|
as_seq h1 (gsub full (size_row al) (size_row al))));
let final = sub full (size 0) nn in
copy output final)
inline_for_extraction noextract
let blake2_update_key_st (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> hash: state_p al ms
-> kk: size_t{v kk > 0 /\ v kk <= Spec.max_key al}
-> k: lbuffer uint8 kk
-> ll: size_t ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h k /\
disjoint hash k /\ disjoint wv hash /\ disjoint wv k))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_key al (v kk) h0.[|k|] (v ll) (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_key:
#al:Spec.alg
-> #ms:m_spec
-> blake2_update_block_st al ms
-> blake2_update_key_st al ms
inline_for_extraction noextract
let blake2_update_key #al #ms blake2_update_block wv hash kk k ll =
let lb = size_to_limb al (size_block al) in
assert (v lb = Spec.size_block al);
let h0 = ST.get () in
salloc1 h0 (size_block al) (u8 0) (Ghost.hide (loc hash |+| loc wv))
(fun _ h1 -> live h1 hash /\ state_v h1 hash == Spec.blake2_update_key al (v kk) h0.[|k|] (v ll) (state_v h0 hash))
(fun key_block ->
update_sub key_block 0ul kk k;
let h1 = ST.get() in
if ll =. 0ul then
blake2_update_block wv hash true lb key_block
else
blake2_update_block wv hash false lb key_block)
inline_for_extraction noextract
let blake2_update_st (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> hash: state_p al ms
-> kk: size_t{v kk <= Spec.max_key al}
-> k: lbuffer uint8 kk
-> ll: size_t
-> d: lbuffer uint8 ll ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h k /\ live h d /\
disjoint hash k /\ disjoint wv hash /\ disjoint wv k /\
disjoint hash d /\ disjoint wv d /\ disjoint d k))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update al (v kk) h0.[|k|] h0.[|d|] (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update:
#al:Spec.alg
-> #ms:m_spec
-> blake2_update_key_st al ms
-> blake2_update_blocks_st al ms
-> blake2_update_st al ms
inline_for_extraction noextract
let blake2_update #al #ms blake2_update_key blake2_update_blocks
wv hash kk k ll d =
let lb = size_to_limb al (size_block al) in
assert (v lb = Spec.size_block al);
if kk >. 0ul then (
blake2_update_key wv hash kk k ll;
if ll =. 0ul then ()
else blake2_update_blocks wv hash lb d)
else blake2_update_blocks wv hash (size_to_limb al 0ul) d
inline_for_extraction noextract
let blake2_st (al:Spec.alg) (ms:m_spec) =
output: buffer_t MUT uint8
-> output_len: size_t{v output_len == length output /\ 1 <= v output_len /\ v output_len <= Spec.max_output al}
-> input: buffer_t MUT uint8
-> input_len: size_t{v input_len == length input}
-> key: buffer_t MUT uint8
-> key_len: size_t{v key_len == length key /\ v key_len <= Spec.max_key al} ->
Stack unit
(requires (fun h -> live h output /\ live h input /\ live h key
/\ disjoint output input /\ disjoint output key /\ disjoint input key))
(ensures (fun h0 _ h1 -> modifies1 output h0 h1
/\ h1.[|(output <: lbuffer uint8 output_len)|] == Spec.blake2 al h0.[|(input <: lbuffer uint8 input_len)|] (Spec.blake2_default_params al) (v key_len) h0.[|(key <: lbuffer uint8 key_len)|] (v output_len)))
inline_for_extraction noextract
val blake2:
#al:Spec.alg
-> #ms:m_spec
-> blake2_init_st al ms
-> blake2_update_st al ms
-> blake2_finish_st al ms
-> blake2_st al ms
#push-options "--z3rlimit 100"
let blake2 #al #ms blake2_init blake2_update blake2_finish output output_len input input_len key key_len =
[@inline_let]
let stlen = le_sigh al ms in
[@inline_let]
let stzero = zero_element al ms in
let h0 = ST.get() in
[@inline_let]
let spec _ h1 = h1.[|output|] == Spec.blake2 al h0.[|(input <: lbuffer uint8 input_len)|] (Spec.blake2_default_params al) (v key_len) h0.[|key|] (v output_len) in
salloc1 h0 stlen stzero (Ghost.hide (loc output)) spec
(fun h ->
assert (max_size_t <= Spec.max_limb al);
let h1 = ST.get() in
salloc1 h1 stlen stzero (Ghost.hide (loc output |+| loc h)) spec
(fun wv ->
blake2_init h key_len output_len;
blake2_update wv h key_len key input_len input;
blake2_finish output_len output h))
#pop-options
module B = LowStar.Buffer
module M = LowStar.Modifies
// A little wrapper needed by EverCrypt.Hash | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": true,
"full_module": "LowStar.Modifies",
"short_module": "M"
},
{
"abbrev": true,
"full_module": "LowStar.Buffer",
"short_module": "B"
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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 | al: Spec.Blake2.Definitions.alg -> ms: Hacl.Impl.Blake2.Core.m_spec -> Type0 | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.m_spec",
"FStar.Monotonic.HyperHeap.rid",
"Hacl.Impl.Blake2.Core.state_p",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.is_eternal_region",
"Prims.l_and",
"Lib.Buffer.live",
"Lib.Buffer.MUT",
"Hacl.Impl.Blake2.Core.element_t",
"LowStar.Monotonic.Buffer.modifies",
"LowStar.Monotonic.Buffer.loc_none",
"LowStar.Monotonic.Buffer.fresh_loc",
"Lib.Buffer.loc_addr_of_buffer",
"LowStar.Monotonic.Buffer.loc_includes",
"LowStar.Monotonic.Buffer.loc_region_only",
"Lib.Buffer.freeable"
] | [] | false | false | false | true | true | let blake2_malloc_st (al: Spec.alg) (ms: m_spec) =
| r: rid
-> ST.ST (state_p al ms)
(requires (fun h -> ST.is_eternal_region r))
(ensures
(fun h0 s h1 ->
live h1 s /\ M.(modifies loc_none h0 h1) /\ B.fresh_loc (loc_addr_of_buffer s) h0 h1 /\
(M.loc_includes (M.loc_region_only true r) (loc_addr_of_buffer s)) /\ freeable s)) | false |
|
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.g2z | val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b))) | val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b))) | let g2z #al #m wv a b =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b)) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 82,
"end_line": 145,
"start_col": 0,
"start_line": 139
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract
val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)}
let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s)
/// Constants
/// Define algorithm functions
inline_for_extraction noextract
val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r))
let g1 #al #m wv a b r =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get() in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r)
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> x:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ disjoint wv x /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x)))
let g2 #al #m wv a b x =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
add_row wv_a x;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x))
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b))) | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 2,
"initial_ifuel": 1,
"max_fuel": 1,
"max_ifuel": 1,
"no_plugins": false,
"no_smt": false,
"no_tactics": false,
"quake_hi": 1,
"quake_keep": false,
"quake_lo": 1,
"retry": false,
"reuse_hint_for": null,
"smtencoding_elim_box": false,
"smtencoding_l_arith_repr": "boxwrap",
"smtencoding_nl_arith_repr": "boxwrap",
"smtencoding_valid_elim": false,
"smtencoding_valid_intro": true,
"tcnorm": true,
"trivial_pre_for_unannotated_effectful_fns": false,
"z3cliopt": [],
"z3refresh": false,
"z3rlimit": 100,
"z3rlimit_factor": 1,
"z3seed": 0,
"z3smtopt": [],
"z3version": "4.8.5"
} | false |
wv: Hacl.Impl.Blake2.Core.state_p al m ->
a: Hacl.Impl.Blake2.Core.index_t ->
b: Hacl.Impl.Blake2.Core.index_t
-> FStar.HyperStack.ST.Stack Prims.unit | FStar.HyperStack.ST.Stack | [] | [] | [
"Spec.Blake2.Definitions.alg",
"Hacl.Impl.Blake2.Core.m_spec",
"Hacl.Impl.Blake2.Core.state_p",
"Hacl.Impl.Blake2.Core.index_t",
"Lib.Sequence.eq_intro",
"Spec.Blake2.Definitions.row",
"Hacl.Impl.Blake2.Core.state_v",
"Spec.Blake2.g2z",
"Lib.IntTypes.v",
"Lib.IntTypes.U32",
"Lib.IntTypes.PUB",
"Prims.unit",
"FStar.Monotonic.HyperStack.mem",
"FStar.HyperStack.ST.get",
"Hacl.Impl.Blake2.Core.add_row",
"Lib.Buffer.lbuffer_t",
"Lib.Buffer.MUT",
"Hacl.Impl.Blake2.Core.element_t",
"Hacl.Impl.Blake2.Core.row_len",
"Hacl.Impl.Blake2.Core.rowi",
"Hacl.Impl.Blake2.Core.row_p"
] | [] | false | true | false | false | false | let g2z #al #m wv a b =
| let h0 = ST.get () in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
let h1 = ST.get () in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b)) | false |
CQueue.Cell.fst | CQueue.Cell.elim_ccell_is_lvalue | val elim_ccell_is_lvalue
(#opened: _)
(#a: Type)
(c: ccell_ptrvalue a)
: SteelGhost unit opened
(ccell_is_lvalue c)
(fun _ -> emp)
(fun _ -> True)
(fun h _ _ ->
(h (ccell_is_lvalue c) <: ccell_ptrvalue a) == c /\
ccell_ptrvalue_is_null c == false
) | val elim_ccell_is_lvalue
(#opened: _)
(#a: Type)
(c: ccell_ptrvalue a)
: SteelGhost unit opened
(ccell_is_lvalue c)
(fun _ -> emp)
(fun _ -> True)
(fun h _ _ ->
(h (ccell_is_lvalue c) <: ccell_ptrvalue a) == c /\
ccell_ptrvalue_is_null c == false
) | let elim_ccell_is_lvalue
#_ #a c
=
change_slprop_rel
(ccell_is_lvalue c)
(ccell_is_lvalue0 c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
);
elim_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
elim_vrefine emp (ccell_is_lvalue_refine c) | {
"file_name": "share/steel/examples/steel/CQueue.Cell.fst",
"git_rev": "f984200f79bdc452374ae994a5ca837496476c41",
"git_url": "https://github.com/FStarLang/steel.git",
"project_name": "steel"
} | {
"end_col": 45,
"end_line": 85,
"start_col": 0,
"start_line": 73
} | module CQueue.Cell
(* A Steel model of C cell structs *)
#push-options "--__no_positivity"
noeq
type mcell (a: Type0) = {
data: ref a;
next: ref (mcell a);
all_or_none_null: squash (is_null data == is_null next); // TODO: /\ freeable data /\ freeable next, if freeable is implemented as a pure space proposition rather than as stateful permissions (i.e. "freeable if you have the whole permission")
}
#pop-options
let ccell_ptrvalue a = mcell a
let ccell_ptrvalue_null a = {data = null; next = null; all_or_none_null = ()}
let ccell_ptrvalue_is_null #a x = is_null x.data
let ccell_data #a c =
c.data
let ccell_next #a c =
c.next
let ccell_is_lvalue_refine
(#a: Type)
(c: ccell_ptrvalue a)
(_: t_of emp)
: Tot prop
= ccell_ptrvalue_is_null c == false
let ccell_is_lvalue_rewrite
(#a: Type)
(c: ccell_ptrvalue a)
(_: normal (t_of (emp `vrefine` ccell_is_lvalue_refine c)))
: GTot (ccell_lvalue a)
= c
[@@ __steel_reduce__; __reduce__ ]
let ccell_is_lvalue0
(#a: Type)
(c: ccell_ptrvalue a)
: Tot vprop
= emp `vrefine` ccell_is_lvalue_refine c `vrewrite` ccell_is_lvalue_rewrite c
let ccell_is_lvalue_hp
(#a: Type)
(c: ccell_ptrvalue a)
: Tot (slprop u#1)
= hp_of (ccell_is_lvalue0 c)
let ccell_is_lvalue_sel
(#a: Type)
(c: ccell_ptrvalue a)
: GTot (selector (ccell_lvalue a) (ccell_is_lvalue_hp c))
= sel_of (ccell_is_lvalue0 c)
let intro_ccell_is_lvalue
#_ #a c
=
intro_vrefine emp (ccell_is_lvalue_refine c);
intro_vrewrite (emp `vrefine` ccell_is_lvalue_refine c) (ccell_is_lvalue_rewrite c);
change_slprop_rel
(ccell_is_lvalue0 c)
(ccell_is_lvalue c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m)
) | {
"checked_file": "/",
"dependencies": [
"prims.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": true,
"source_file": "CQueue.Cell.fst"
} | [
{
"abbrev": false,
"full_module": "Steel.Reference",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.FractionalPermission",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect.Atomic",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Effect",
"short_module": null
},
{
"abbrev": false,
"full_module": "Steel.Memory",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": false,
"full_module": "CQueue",
"short_module": null
},
{
"abbrev": 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 | c: CQueue.Cell.ccell_ptrvalue a -> Steel.Effect.Atomic.SteelGhost Prims.unit | Steel.Effect.Atomic.SteelGhost | [] | [] | [
"Steel.Memory.inames",
"CQueue.Cell.ccell_ptrvalue",
"Steel.Effect.Atomic.elim_vrefine",
"Steel.Effect.Common.emp",
"CQueue.Cell.ccell_is_lvalue_refine",
"Prims.unit",
"Steel.Effect.Atomic.elim_vrewrite",
"Steel.Effect.Common.vrefine",
"CQueue.Cell.ccell_lvalue",
"CQueue.Cell.ccell_is_lvalue_rewrite",
"Steel.Effect.Atomic.change_slprop_rel",
"CQueue.Cell.ccell_is_lvalue",
"CQueue.Cell.ccell_is_lvalue0",
"Steel.Effect.Common.normal",
"Steel.Effect.Common.t_of",
"Prims.eq2",
"Prims.prop",
"Steel.Memory.mem",
"FStar.Pervasives.assert_norm",
"Prims.op_Equals_Equals_Equals",
"Steel.Effect.Common.sel_of",
"Steel.Memory.slprop",
"Steel.Effect.Common.hp_of"
] | [] | false | true | false | false | false | let elim_ccell_is_lvalue #_ #a c =
| change_slprop_rel (ccell_is_lvalue c)
(ccell_is_lvalue0 c)
(fun x y -> x == y)
(fun m ->
assert_norm (hp_of (ccell_is_lvalue c) == hp_of (ccell_is_lvalue0 c));
assert_norm (sel_of (ccell_is_lvalue c) m === sel_of (ccell_is_lvalue0 c) m));
elim_vrewrite (emp `vrefine` (ccell_is_lvalue_refine c)) (ccell_is_lvalue_rewrite c);
elim_vrefine emp (ccell_is_lvalue_refine c) | false |
Hacl.Impl.Blake2.Generic.fst | Hacl.Impl.Blake2.Generic.split_blocks | val split_blocks: al:Spec.alg -> len:size_t -> r:(size_t & size_t){
let (x,y) = r in
let (sx,sy) = Spec.split al (v len) in
sx == v x /\
sy == v y} | val split_blocks: al:Spec.alg -> len:size_t -> r:(size_t & size_t){
let (x,y) = r in
let (sx,sy) = Spec.split al (v len) in
sx == v x /\
sy == v y} | let split_blocks al len =
let nb = len /. size_block al in
let rem = len %. size_block al in
(if rem =. 0ul && nb >. 0ul then nb -! 1ul else nb),
(if rem =. 0ul && nb >. 0ul then size_block al else rem) | {
"file_name": "code/blake2/Hacl.Impl.Blake2.Generic.fst",
"git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872",
"git_url": "https://github.com/project-everest/hacl-star.git",
"project_name": "hacl-star"
} | {
"end_col": 58,
"end_line": 834,
"start_col": 0,
"start_line": 830
} | module Hacl.Impl.Blake2.Generic
open FStar.Mul
open FStar.HyperStack
open FStar.HyperStack.ST
open Lib.IntTypes
open Lib.Buffer
open Lib.ByteBuffer
open Lib.LoopCombinators
module ST = FStar.HyperStack.ST
module Seq = Lib.Sequence
module Loops = Lib.LoopCombinators
module Spec = Spec.Blake2
open Hacl.Impl.Blake2.Constants
open Hacl.Impl.Blake2.Core
#set-options "--z3rlimit 50 --max_ifuel 0 --max_fuel 0"
noextract
let is_valid_blake2_config (a : Spec.alg) (m : m_spec) =
match a, m with
| Spec.Blake2S, M32 | Spec.Blake2S, M128
| Spec.Blake2B, M32 | Spec.Blake2B, M256 -> true
| _ -> false
inline_for_extraction noextract
let valid_m_spec (a : Spec.alg) = m:m_spec{is_valid_blake2_config a m}
/// Accessors for constants
inline_for_extraction noextract
val get_iv:
a:Spec.alg
-> s: size_t{size_v s < 8} ->
Stack (word_t a)
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\
v z == v (Seq.index (Spec.ivTable a) (v s))))
let get_iv a s =
recall_contents #(Spec.pub_word_t Spec.Blake2S) #8ul ivTable_S (Spec.ivTable Spec.Blake2S);
recall_contents #(Spec.pub_word_t Spec.Blake2B) #8ul ivTable_B (Spec.ivTable Spec.Blake2B);
[@inline_let]
let ivTable: (x:glbuffer (Spec.pub_word_t a) 8ul{witnessed x (Spec.ivTable a) /\ recallable x}) =
match a with
| Spec.Blake2S -> ivTable_S
| Spec.Blake2B -> ivTable_B
in
let r = index ivTable s in
secret #(Spec.wt a) r
inline_for_extraction noextract
val get_sigma:
s: size_t{v s < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v s])))
let get_sigma s =
recall_contents sigmaTable Spec.sigmaTable;
index sigmaTable s
inline_for_extraction noextract
val get_sigma_sub:
start: size_t ->
i: size_t{v i < 16 /\ v start + v i < 160} ->
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 -> h0 == h1 /\ v z == v (Seq.index Spec.sigmaTable (v start + v i))))
let get_sigma_sub start i = get_sigma (start +. i)
inline_for_extraction noextract
let rounds_t (a:Spec.alg): size_t = size (Spec.rounds a)
inline_for_extraction noextract
val size_to_word: al:Spec.alg -> s:size_t -> u:word_t al{u == Spec.nat_to_word al (v s)}
let size_to_word al s = match al with
| Spec.Blake2S -> size_to_uint32 s
| Spec.Blake2B -> size_to_uint64 s
inline_for_extraction noextract
val size_to_limb: al:Spec.alg -> s:size_t -> u:Spec.limb_t al{u == Spec.nat_to_limb al (v s)}
let size_to_limb al s = match al with
| Spec.Blake2S -> size_to_uint64 s
| Spec.Blake2B -> to_u128 (size_to_uint64 s)
/// Constants
/// Define algorithm functions
inline_for_extraction noextract
val g1: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> r:rotval (Spec.wt al) ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ (state_v h1 wv) == Spec.g1 al (state_v h0 wv) (v a) (v b) r))
let g1 #al #m wv a b r =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
xor_row wv_a wv_b;
ror_row wv_a r;
let h2 = ST.get() in
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.g1 al (state_v h0 wv) (v a) (v b) r)
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t -> x:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ disjoint wv x /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x)))
let g2 #al #m wv a b x =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
add_row wv_a x;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2 al (state_v h0 wv) (v a) (v b) (row_v h0 x))
#push-options "--z3rlimit 100 --max_fuel 1 --max_ifuel 1"
inline_for_extraction noextract
val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->
Stack unit
(requires (fun h -> live h wv /\ a <> b))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b)))
let g2z #al #m wv a b =
let h0 = ST.get() in
let wv_a = rowi wv a in
let wv_b = rowi wv b in
add_row wv_a wv_b;
let h1 = ST.get() in
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b))
inline_for_extraction noextract
val blake2_mixing : #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> x:row_p al m -> y:row_p al m ->
Stack unit
(requires (fun h -> live h wv /\ live h x /\ live h y /\ disjoint wv x /\ disjoint wv y))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_mixing al (state_v h0 wv) (row_v h0 x) (row_v h0 y)))
let blake2_mixing #al #m wv x y =
let h0 = ST.get() in
push_frame ();
let a = 0ul in
let b = 1ul in
let c = 2ul in
let d = 3ul in
[@inline_let]
let r0 = normalize_term (Lib.Sequence.index (Spec.rTable al) 0) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 0);
[@inline_let]
let r1 = normalize_term (Lib.Sequence.index (Spec.rTable al) 1) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 1);
[@inline_let]
let r2 = normalize_term (Lib.Sequence.index (Spec.rTable al) 2) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 2);
[@inline_let]
let r3 = normalize_term (Lib.Sequence.index (Spec.rTable al) 3) in
normalize_term_spec (Lib.Sequence.index (Spec.rTable al) 3);
let h1 = ST.get() in
g2 wv a b x;
g1 wv d a r0;
g2z wv c d;
g1 wv b c r1;
g2 wv a b y;
g1 wv d a r2;
g2z wv c d;
g1 wv b c r3;
let h2 = ST.get() in
pop_frame ();
let h3 = ST.get() in
assert(modifies (loc wv) h0 h3);
Lib.Sequence.eq_intro (state_v h2 wv) (Spec.blake2_mixing al (state_v h1 wv) (row_v h1 x) (row_v h1 y))
#pop-options
inline_for_extraction noextract
val diag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.diag (state_v h0 wv)))
let diag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 1ul;
permr_row r2 2ul;
permr_row r3 3ul
inline_for_extraction noextract
val undiag: #a:Spec.alg -> #m:m_spec -> wv:state_p a m
-> Stack unit
(requires (fun h -> live h wv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1 /\
state_v h1 wv == Spec.undiag (state_v h0 wv)))
let undiag #a #m wv =
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
let h0 = ST.get() in
permr_row r1 3ul;
permr_row r2 2ul;
permr_row r3 1ul
inline_for_extraction noextract
val gather_state: #a:Spec.alg -> #ms:m_spec -> st:state_p a ms -> m:block_w a -> start:size_t{v start <= 144} -> Stack unit
(requires (fun h -> live h st /\ live h m /\ disjoint st m))
(ensures (fun h0 _ h1 -> modifies (loc st) h0 h1 /\
state_v h1 st == Spec.gather_state a (as_seq h0 m) (v start)))
inline_for_extraction noextract
let get_sigma' (start: size_t { v start <= 144 }) (i: size_t { normalize (i <=. 15ul) }):
Stack Spec.sigma_elt_t
(requires (fun h -> True))
(ensures (fun h0 z h1 ->
h0 == h1 /\ z == Lib.Sequence.(Spec.sigmaTable.[v start + v i])))
=
get_sigma (start +! i)
#push-options "--z3rlimit 500"
let gather_state #a #ms st m start =
let h0 = ST.get() in
let r0 = rowi st 0ul in
let r1 = rowi st 1ul in
let r2 = rowi st 2ul in
let r3 = rowi st 3ul in
let s0 = get_sigma' start 0ul in
let s1 = get_sigma' start 1ul in
let s2 = get_sigma' start 2ul in
let s3 = get_sigma' start 3ul in
let s4 = get_sigma' start 4ul in
let s5 = get_sigma' start 5ul in
let s6 = get_sigma' start 6ul in
let s7 = get_sigma' start 7ul in
let s8 = get_sigma' start 8ul in
let s9 = get_sigma' start 9ul in
let s10 = get_sigma' start 10ul in
let s11 = get_sigma' start 11ul in
let s12 = get_sigma' start 12ul in
let s13 = get_sigma' start 13ul in
let s14 = get_sigma' start 14ul in
let s15 = get_sigma' start 15ul in
let h1 = ST.get() in
gather_row r0 m s0 s2 s4 s6;
let h2 = ST.get() in
gather_row r1 m s1 s3 s5 s7;
let h3 = ST.get() in
gather_row r2 m s8 s10 s12 s14;
let h4 = ST.get() in
gather_row r3 m s9 s11 s13 s15;
let h5 = ST.get() in
assert(modifies (loc st) h0 h5);
Lib.Sequence.eq_intro (state_v h5 st) (Spec.gather_state a (as_seq h0 m) (v start))
inline_for_extraction noextract
val blake2_round : #al:Spec.alg -> #ms:m_spec -> wv:state_p al ms -> m:block_w al -> i:size_t ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_round al (as_seq h0 m) (v i) (state_v h0 wv)))
let blake2_round #al #ms wv m i =
push_frame();
let start_idx = (i %. size 10) *. size 16 in
assert (v start_idx == (v i % 10) * 16);
assert (v start_idx <= 144);
let m_st = alloc_state al ms in
gather_state m_st m start_idx;
let x = rowi m_st 0ul in
let y = rowi m_st 1ul in
let z = rowi m_st 2ul in
let w = rowi m_st 3ul in
let h1 = ST.get() in
assert (disjoint wv m_st);
assert (disjoint m_st wv);
assert (disjoint x wv);
assert (disjoint wv x);
assert (disjoint y wv);
assert (disjoint wv y);
assert (disjoint z wv);
assert (disjoint wv z);
assert (disjoint w wv);
assert (disjoint wv w);
blake2_mixing wv x y;
diag wv;
blake2_mixing wv z w;
undiag wv;
pop_frame ()
inline_for_extraction noextract
val blake2_compress0:
#al:Spec.alg
-> m_s: block_p al
-> m_w: block_w al
-> Stack unit
(requires (fun h -> live h m_s /\ live h m_w /\ disjoint m_s m_w))
(ensures (fun h0 _ h1 -> modifies (loc m_w) h0 h1
/\ as_seq h1 m_w == Spec.blake2_compress0 al (as_seq h0 m_s)))
let blake2_compress0 #al m_s m_w =
uints_from_bytes_le m_w m_s
inline_for_extraction noextract
val blake2_compress1:
#al:Spec.alg
-> #m:m_spec
-> wv: state_p al m
-> s_iv: state_p al m
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s_iv /\ disjoint wv s_iv))
(ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1
/\ state_v h1 wv == Spec.blake2_compress1 al (state_v h0 s_iv) offset flag))
let blake2_compress1 #al #m wv s_iv offset flag =
let h0 = ST.get() in
push_frame();
let mask = alloc_row al m in
[@inline_let]
let wv_12 = Spec.limb_to_word al offset in
[@inline_let]
let wv_13 = Spec.limb_to_word al (offset >>. (size (bits (Spec.wt al)))) in
// SH: TODO: for some reason, ``ones`` below doesn't get inlined by KaRaMeL,
// causing an extraction problem. The 3 lines below are a hack to fix
// extraction for the time being:
// [> let wv_14 = if flag then (ones (Spec.wt al) SEC) else (Spec.zero al) in
// After investigation, it is because ones is [@(strict_on_arguments [0])],
// and so isn't unfolded if its first argument is not normalized to a constant.
// However, the first argument should always be normalized (I checked the
// output generated by KaRaMeL and the definitions).
(**) normalize_term_spec (Spec.wt al);
[@inline_let] let wt_al = normalize_term (Spec.wt al) in
let wv_14 = if flag then ones wt_al SEC else (Spec.zero al) in
// end of the TODO
let wv_15 = Spec.zero al in
create_row mask wv_12 wv_13 wv_14 wv_15;
copy_state wv s_iv;
let wv3 = rowi wv 3ul in
xor_row wv3 mask;
pop_frame();
let h1 = ST.get() in
assert(modifies (loc wv) h0 h1);
Lib.Sequence.eq_intro (state_v h1 wv) (Spec.blake2_compress1 al (state_v h0 s_iv) offset flag)
inline_for_extraction noextract
val blake2_compress2 :
#al:Spec.alg
-> #ms:m_spec
-> wv: state_p al ms
-> m: block_w al ->
Stack unit
(requires (fun h -> live h wv /\ live h m /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies1 wv h0 h1
/\ state_v h1 wv == Spec.blake2_compress2 al (state_v h0 wv) (as_seq h0 m)))
#push-options "--z3rlimit 400"
let blake2_compress2 #al #ms wv m =
let h0 = ST.get () in
[@inline_let]
let a_spec = Spec.state al in
[@inline_let]
let refl h = state_v h wv in
[@inline_let]
let footprint = Ghost.hide(loc wv) in
[@inline_let]
let spec h = Spec.blake2_round al h.[|m|] in
loop_refl h0 (rounds_t al) a_spec refl footprint spec
(fun i ->
Loops.unfold_repeati (Spec.rounds al) (spec h0) (state_v h0 wv) (v i);
blake2_round wv m i)
#pop-options
inline_for_extraction noextract
val blake2_compress3 :
#al:Spec.alg
-> #ms:m_spec
-> s_iv:state_p al ms
-> wv:state_p al ms ->
Stack unit
(requires (fun h -> live h s_iv /\ live h wv /\ disjoint s_iv wv))
(ensures (fun h0 _ h1 -> modifies (loc s_iv) h0 h1
/\ state_v h1 s_iv == Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv)))
let blake2_compress3 #al #ms s_iv wv =
let h0 = ST.get() in
let s0 = rowi s_iv 0ul in
let s1 = rowi s_iv 1ul in
let r0 = rowi wv 0ul in
let r1 = rowi wv 1ul in
let r2 = rowi wv 2ul in
let r3 = rowi wv 3ul in
assert (disjoint s0 wv);
assert (disjoint wv s0);
assert (disjoint s1 wv);
assert (disjoint wv s1);
assert (disjoint r0 s0);
assert (disjoint r2 s0);
assert (disjoint r1 s1);
assert (disjoint r3 s1);
xor_row s0 r0;
let h1 = ST.get() in
xor_row s0 r2;
let h2 = ST.get() in
xor_row s1 r1;
let h3 = ST.get() in
xor_row s1 r3;
let h4 = ST.get() in
assert (modifies (loc s_iv) h0 h4);
let open Lib.Sequence in
assert (row_v h0 r0 == (state_v h0 wv).[0]);
assert (row_v h1 r2 == (state_v h0 wv).[2]);
assert (row_v h4 s0 == Spec.(((state_v h0 s_iv).[0] ^| (state_v h0 wv).[0]) ^| (state_v h0 wv).[2]));
assert (row_v h4 s1 == Spec.(((state_v h0 s_iv).[1] ^| (state_v h0 wv).[1]) ^| (state_v h0 wv).[3]));
eq_intro (state_v h2 s_iv) ((state_v h0 s_iv).[0] <- row_v h4 s0);
eq_intro (state_v h4 s_iv) ((state_v h2 s_iv).[1] <- row_v h4 s1);
eq_intro (state_v h4 s_iv) (Spec.blake2_compress3 al (state_v h0 wv) (state_v h0 s_iv))
inline_for_extraction noextract
let compress_t (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> s: state_p al ms
-> m: block_p al
-> offset: Spec.limb_t al
-> flag: bool ->
Stack unit
(requires (fun h -> live h wv /\ live h s /\ live h m /\ disjoint s m /\ disjoint wv s /\ disjoint wv m))
(ensures (fun h0 _ h1 -> modifies (loc s |+| loc wv) h0 h1
/\ state_v h1 s == Spec.blake2_compress al (state_v h0 s) h0.[|m|] offset flag))
inline_for_extraction noextract
val blake2_compress: #al:Spec.alg -> #ms:m_spec -> compress_t al ms
let blake2_compress #al #ms wv s m offset flag =
push_frame();
let m_w = create 16ul (Spec.zero al) in
blake2_compress0 #al m m_w;
blake2_compress1 wv s offset flag;
blake2_compress2 wv m_w;
blake2_compress3 s wv;
pop_frame()
inline_for_extraction noextract
let blake2_update_block_st (al:Spec.alg) (ms:m_spec) =
wv:state_p al ms
-> hash: state_p al ms
-> flag: bool
-> totlen: Spec.limb_t al{v totlen <= Spec.max_limb al}
-> d: block_p al ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_block al flag (v totlen) h0.[|d|] (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_block: #al:Spec.alg -> #ms:m_spec -> blake2_update_block_st al ms
let blake2_update_block #al #ms wv hash flag totlen d =
blake2_compress wv hash d totlen flag
inline_for_extraction noextract
let blake2_update1_st (al:Spec.alg) (ms:m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> d: lbuffer uint8 len
-> i: size_t{v i < length d / Spec.size_block al} ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update1 al (v prev) h0.[|d|] (v i) (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update1: #al:Spec.alg -> #ms:m_spec -> blake2_update_block: blake2_update_block_st al ms -> blake2_update1_st al ms
let blake2_update1 #al #ms blake2_update_block #len wv hash prev d i =
let totlen = prev +. size_to_limb al ((i+!1ul) *! size_block al) in
assert (v totlen == v prev + (v i + 1) * Spec.size_block al);
let b = sub d (i *. size_block al) (size_block al) in
let h = ST.get() in
assert (as_seq h b == Spec.get_blocki al (as_seq h d) (v i));
blake2_update_block wv hash false totlen b
inline_for_extraction noextract
let blake2_update_last_st (al:Spec.alg) (ms:m_spec) =
#len:size_t
-> wv: state_p al ms
-> hash: state_p al ms
-> prev: Spec.limb_t al{v prev + v len <= Spec.max_limb al}
-> rem: size_t {v rem <= v len /\ v rem <= Spec.size_block al}
-> d: lbuffer uint8 len ->
Stack unit
(requires (fun h -> live h wv /\ live h hash /\ live h d /\ disjoint hash d /\ disjoint wv hash /\ disjoint wv d))
(ensures (fun h0 _ h1 -> modifies (loc hash |+| loc wv) h0 h1
/\ state_v h1 hash == Spec.blake2_update_last al (v prev) (v rem) h0.[|d|] (state_v h0 hash)))
inline_for_extraction noextract
val blake2_update_last:
#al:Spec.alg
-> #ms:m_spec
-> blake2_update_block: blake2_update_block_st al ms
-> blake2_update_last_st al ms
let blake2_update_last #al #ms blake2_update_block #len wv hash prev rem d =
let h0 = ST.get () in
[@inline_let]
let spec _ h1 = state_v h1 hash == Spec.blake2_update_last al (v prev) (v rem) h0.[|d|] (state_v h0 hash) in
salloc1 h0 (size_block al) (u8 0) (Ghost.hide (loc hash |+| loc wv)) spec
(fun last_block ->
let last = sub d (len -! rem) rem in
let h1 = ST.get() in
update_sub last_block 0ul rem last;
let h2 = ST.get() in
as_seq_gsub h1 d (len -! rem) rem;
assert (as_seq h1 last == Seq.sub (as_seq h1 d) (v len - v rem) (v rem));
assert (as_seq h1 last == Seq.slice (as_seq h0 d) (v len - v rem) (v len));
assert (as_seq h2 last_block == Spec.get_last_padded_block al (as_seq h0 d) (v rem));
let totlen = prev +. (size_to_limb al len) in
blake2_update_block wv hash true totlen last_block;
let h3 = ST.get() in
assert (v totlen == v prev + v len);
assert (state_v h3 hash == Spec.blake2_update_block al true (v totlen) (as_seq h2 last_block) (state_v h0 hash)))
inline_for_extraction noextract
let blake2_init_st (al:Spec.alg) (ms:m_spec) =
hash: state_p al ms
-> kk: size_t{v kk <= Spec.max_key al}
-> nn: size_t{1 <= v nn /\ v nn <= Spec.max_output al} ->
Stack unit
(requires (fun h -> live h hash))
(ensures (fun h0 _ h1 -> modifies (loc hash) h0 h1 /\
state_v h1 hash == Spec.blake2_init_hash al (Spec.blake2_default_params al) (v kk) (v nn)))
inline_for_extraction noextract
val serialize_params (al:Spec.alg)
(kk:size_t{v kk <= Spec.max_key al})
(nn: size_t{1 <= v nn /\ v nn <= Spec.max_output al})
(p: blake2_params al)
(b: lbuffer (word_t al) 8ul)
: Stack unit
(requires fun h ->
live h b /\
blake2_params_inv h p /\
LowStar.Buffer.loc_disjoint (loc b) (blake2_params_loc p) /\
as_seq h b == Seq.create 8 (Spec.nat_to_word al 0)
)
(ensures fun h0 _ h1 ->
modifies (loc b) h0 h1 /\
as_seq h1 b == Spec.serialize_blake2_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk)))
#push-options "--z3rlimit 100 --fuel 0"
inline_for_extraction noextract
let serialize_params_blake2s
(kk:size_t{v kk <= Spec.max_key Spec.Blake2S})
(nn: size_t{1 <= v nn /\ v nn <= Spec.max_output Spec.Blake2S})
(p: blake2_params Spec.Blake2S)
(b: lbuffer (word_t Spec.Blake2S) 8ul)
: Stack unit
(requires fun h -> live h b /\
blake2_params_inv h p /\
LowStar.Buffer.loc_disjoint (loc b) (blake2_params_loc p) /\
as_seq h b == Seq.create 8 (u32 0)
)
(ensures fun h0 _ h1 ->
modifies (loc b) h0 h1 /\
as_seq h1 b == Spec.serialize_blake2_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk)))
= let h0 = ST.get () in
[@inline_let]
let kk_shift_8 = shift_left (to_u32 kk) (size 8) in
[@inline_let]
let fanout_shift_16 = shift_left (to_u32 p.fanout) (size 16) in
[@inline_let]
let depth_shift_24 = shift_left (to_u32 p.depth) (size 24) in
[@inline_let]
let v0 = (to_u32 nn) ^. kk_shift_8 ^. fanout_shift_16 ^. depth_shift_24 in
[@inline_let]
let v1 = p.leaf_length in
[@inline_let]
let v2 = p.node_offset in
[@inline_let]
let node_depth_shift_16 = shift_left (to_u32 p.node_depth) (size 16) in
[@inline_let]
let inner_length_shift_16 = shift_left (to_u32 p.inner_length) (size 24) in
[@inline_let]
let v3 = (to_u32 p.xof_length) ^. node_depth_shift_16 ^. inner_length_shift_16 in
uints_from_bytes_le (sub b 4ul 2ul) p.salt;
uints_from_bytes_le (sub b 6ul 2ul) p.personal;
// AF: Putting these writes *after* modifications on a subbuffer of b helps with modifies-reasoning:
// By putting them before, F* struggles with proving that b[0..3] is not modified by uints_from_bytes_le
b.(0ul) <- v0;
b.(1ul) <- v1;
b.(2ul) <- v2;
b.(3ul) <- v3;
let h1 = ST.get () in
let aux () : Lemma (as_seq h1 b `Seq.equal` Spec.serialize_blake2s_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk))) =
let open Lib.Sequence in
let open Lib.ByteSequence in
let s0 = (u32 (v nn)) ^.
(u32 (v kk) <<. (size 8)) ^.
(u32 (v p.fanout) <<. (size 16)) ^.
(u32 (v p.depth) <<. (size 24)) in
let s1 = p.leaf_length in
let s2 = p.node_offset in
let s3 = (u32 (v p.xof_length)) ^.
(u32 (v p.node_depth) <<. (size 16)) ^.
(u32 (v p.inner_length) <<. (size 24)) in
let salt_u32: lseq uint32 2 = uints_from_bytes_le (as_seq h0 (get_salt p)) in
let s4 = salt_u32.[0] in
let s5 = salt_u32.[1] in
let personal_u32: lseq uint32 2 = uints_from_bytes_le (as_seq h0 (get_personal p)) in
let s6 = personal_u32.[0] in
let s7 = personal_u32.[1] in
[@inline_let]
let l = [s0; s1; s2; s3; s4; s5; s6; s7] in
assert_norm (List.Tot.length l == 8);
// There seems to be something not triggering with createL, requiring the
// following lemma calls, and assert_norms to relate List.index to the
// actual elements
assert_norm (List.Tot.index l 0 == s0);
assert_norm (List.Tot.index l 1 == s1);
assert_norm (List.Tot.index l 2 == s2);
assert_norm (List.Tot.index l 3 == s3);
assert_norm (List.Tot.index l 4 == s4);
assert_norm (List.Tot.index l 5 == s5);
assert_norm (List.Tot.index l 6 == s6);
assert_norm (List.Tot.index l 7 == s7);
of_list_index l 0;
of_list_index l 1;
of_list_index l 2;
of_list_index l 3;
of_list_index l 4;
of_list_index l 5;
of_list_index l 6;
of_list_index l 7
in
aux()
inline_for_extraction noextract
let serialize_params_blake2b
(kk:size_t{v kk <= Spec.max_key Spec.Blake2B})
(nn: size_t{1 <= v nn /\ v nn <= Spec.max_output Spec.Blake2B})
(p: blake2_params Spec.Blake2B)
(b: lbuffer (word_t Spec.Blake2B) 8ul)
: Stack unit
(requires fun h -> live h b /\
blake2_params_inv #Spec.Blake2B h p /\
LowStar.Buffer.loc_disjoint (loc b) (blake2_params_loc p) /\
as_seq h b == Seq.create 8 (u64 0)
)
(ensures fun h0 _ h1 ->
modifies (loc b) h0 h1 /\
as_seq h1 b == Spec.serialize_blake2_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk)))
= let h0 = ST.get () in
[@inline_let]
let kk_shift_8 = shift_left (to_u64 kk) (size 8) in
[@inline_let]
let fanout_shift_16 = shift_left (to_u64 p.fanout) (size 16) in
[@inline_let]
let depth_shift_24 = shift_left (to_u64 p.depth) (size 24) in
[@inline_let]
let leaf_length_shift_32 = shift_left (to_u64 p.leaf_length) (size 32) in
[@inline_let]
let v0 = (to_u64 nn) ^. kk_shift_8 ^. fanout_shift_16 ^. depth_shift_24 ^. leaf_length_shift_32 in
[@inline_let]
let xof_length_shift_32 = shift_left (to_u64 p.xof_length) (size 32) in
[@inline_let]
let v1 = (to_u64 p.node_offset) ^. xof_length_shift_32 in
[@inline_let]
let inner_length_shift_8 = shift_left (to_u64 p.inner_length) (size 8) in
[@inline_let]
let v2 = (to_u64 p.node_depth) ^. inner_length_shift_8 in
uints_from_bytes_le (sub b 4ul 2ul) p.salt;
uints_from_bytes_le (sub b 6ul 2ul) p.personal;
b.(0ul) <- v0;
b.(1ul) <- v1;
b.(2ul) <- v2;
b.(3ul) <- (u64 0);
let h1 = ST.get () in
let aux () : Lemma (as_seq h1 b `Seq.equal` Spec.serialize_blake2b_params
(Spec.set_key_length (Spec.set_digest_length (blake2_params_v h0 p) (v nn)) (v kk))) =
let open Lib.Sequence in
let open Lib.ByteSequence in
let s0 = (u64 (v nn)) ^.
(u64 (v kk) <<. (size 8)) ^.
(u64 (v p.fanout) <<. (size 16)) ^.
(u64 (v p.depth) <<. (size 24)) ^.
(u64 (v p.leaf_length) <<. (size 32)) in
let s1 = (u64 (v p.node_offset)) ^.
(u64 (v p.xof_length) <<. (size 32)) in
// The serialization corresponding to s2 contains node_depth and inner_length,
// followed by the 14 reserved bytes which always seem to be zeros, and can hence
// be ignored when building the corresponding uint64 using xor's
let s2 = (u64 (v p.node_depth)) ^.
(u64 (v p.inner_length) <<. (size 8)) in
// s3 corresponds to the remaining of the reserved bytes
let s3 = u64 0 in
let salt_u64: lseq uint64 2 = uints_from_bytes_le (as_seq h0 (get_salt p)) in
let s4 = salt_u64.[0] in
let s5 = salt_u64.[1] in
let personal_u64: lseq uint64 2 = uints_from_bytes_le (as_seq h0 (get_personal p)) in
let s6 = personal_u64.[0] in
let s7 = personal_u64.[1] in
[@inline_let]
let l = [s0; s1; s2; s3; s4; s5; s6; s7] in
assert_norm (List.Tot.length l == 8);
// There seems to be something not triggering with createL, requiring the
// following lemma calls, and assert_norms to relate List.index to the
// actual elements
assert_norm (List.Tot.index l 0 == s0);
assert_norm (List.Tot.index l 1 == s1);
assert_norm (List.Tot.index l 2 == s2);
assert_norm (List.Tot.index l 3 == s3);
assert_norm (List.Tot.index l 4 == s4);
assert_norm (List.Tot.index l 5 == s5);
assert_norm (List.Tot.index l 6 == s6);
assert_norm (List.Tot.index l 7 == s7);
of_list_index l 0;
of_list_index l 1;
of_list_index l 2;
of_list_index l 3;
of_list_index l 4;
of_list_index l 5;
of_list_index l 6;
of_list_index l 7
in
aux()
#pop-options
let serialize_params al kk nn p b =
match al with
| Spec.Blake2S -> serialize_params_blake2s kk nn p b
| Spec.Blake2B -> serialize_params_blake2b kk nn p b
inline_for_extraction noextract
val blake2_init:
#al:Spec.alg
-> #ms:m_spec
-> blake2_init_st al ms
let blake2_init #al #ms hash kk nn =
push_frame ();
let h0 = ST.get() in
let tmp = create 8ul (Spec.nat_to_word al 0) in
let r0 = rowi hash 0ul in
let r1 = rowi hash 1ul in
let r2 = rowi hash 2ul in
let r3 = rowi hash 3ul in
let iv0 = get_iv al 0ul in
let iv1 = get_iv al 1ul in
let iv2 = get_iv al 2ul in
let iv3 = get_iv al 3ul in
let iv4 = get_iv al 4ul in
let iv5 = get_iv al 5ul in
let iv6 = get_iv al 6ul in
let iv7 = get_iv al 7ul in
create_row #al #ms r2 iv0 iv1 iv2 iv3;
create_row #al #ms r3 iv4 iv5 iv6 iv7;
let salt = create (salt_len al) (u8 0) in
let personal = create (personal_len al) (u8 0) in
let p = create_default_params al salt personal in
serialize_params al kk nn p tmp;
let tmp0 = tmp.(0ul) in
let tmp1 = tmp.(1ul) in
let tmp2 = tmp.(2ul) in
let tmp3 = tmp.(3ul) in
let tmp4 = tmp.(4ul) in
let tmp5 = tmp.(5ul) in
let tmp6 = tmp.(6ul) in
let tmp7 = tmp.(7ul) in
let iv0' = iv0 ^. tmp0 in
let iv1' = iv1 ^. tmp1 in
let iv2' = iv2 ^. tmp2 in
let iv3' = iv3 ^. tmp3 in
let iv4' = iv4 ^. tmp4 in
let iv5' = iv5 ^. tmp5 in
let iv6' = iv6 ^. tmp6 in
let iv7' = iv7 ^. tmp7 in
create_row #al #ms r0 iv0' iv1' iv2' iv3';
create_row #al #ms r1 iv4' iv5' iv6' iv7';
let h1 = ST.get() in
assert (disjoint hash tmp);
assert (modifies (loc hash `union` loc tmp) h0 h1);
Lib.Sequence.eq_intro (state_v h1 hash) (Spec.blake2_init_hash al (Spec.blake2_default_params al) (v kk) (v nn));
pop_frame ()
#push-options "--z3rlimit 100 --max_fuel 0 --max_ifuel 0"
let _ : squash (inversion Spec.alg) = allow_inversion Spec.alg
inline_for_extraction noextract
val split_blocks: al:Spec.alg -> len:size_t -> r:(size_t & size_t){
let (x,y) = r in
let (sx,sy) = Spec.split al (v len) in
sx == v x /\
sy == v y} | {
"checked_file": "/",
"dependencies": [
"Spec.Blake2.fst.checked",
"prims.fst.checked",
"LowStar.Modifies.fst.checked",
"LowStar.Buffer.fst.checked",
"Lib.Sequence.fsti.checked",
"Lib.LoopCombinators.fsti.checked",
"Lib.IntTypes.fsti.checked",
"Lib.ByteSequence.fsti.checked",
"Lib.ByteBuffer.fsti.checked",
"Lib.Buffer.fsti.checked",
"Hacl.Impl.Blake2.Core.fsti.checked",
"Hacl.Impl.Blake2.Constants.fst.checked",
"FStar.UInt32.fsti.checked",
"FStar.Pervasives.Native.fst.checked",
"FStar.Pervasives.fsti.checked",
"FStar.Mul.fst.checked",
"FStar.List.Tot.fst.checked",
"FStar.HyperStack.ST.fsti.checked",
"FStar.HyperStack.fst.checked",
"FStar.Ghost.fsti.checked"
],
"interface_file": false,
"source_file": "Hacl.Impl.Blake2.Generic.fst"
} | [
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Core",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2.Constants",
"short_module": null
},
{
"abbrev": true,
"full_module": "Spec.Blake2",
"short_module": "Spec"
},
{
"abbrev": true,
"full_module": "Lib.LoopCombinators",
"short_module": "Loops"
},
{
"abbrev": true,
"full_module": "Lib.Sequence",
"short_module": "Seq"
},
{
"abbrev": true,
"full_module": "FStar.HyperStack.ST",
"short_module": "ST"
},
{
"abbrev": false,
"full_module": "Lib.LoopCombinators",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.ByteBuffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.Buffer",
"short_module": null
},
{
"abbrev": false,
"full_module": "Lib.IntTypes",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack.ST",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.HyperStack",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Mul",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "Hacl.Impl.Blake2",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar.Pervasives",
"short_module": null
},
{
"abbrev": false,
"full_module": "Prims",
"short_module": null
},
{
"abbrev": false,
"full_module": "FStar",
"short_module": null
}
] | {
"detail_errors": false,
"detail_hint_replay": false,
"initial_fuel": 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 | al: Spec.Blake2.Definitions.alg -> len: Lib.IntTypes.size_t
-> r:
(Lib.IntTypes.size_t * Lib.IntTypes.size_t)
{ let _ = r in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ x y = _ in
let _ = Spec.Blake2.split al (Lib.IntTypes.v len) in
(let FStar.Pervasives.Native.Mktuple2 #_ #_ sx sy = _ in
sx == Lib.IntTypes.v x /\ sy == Lib.IntTypes.v y)
<:
Type0)
<:
Type0 } | Prims.Tot | [
"total"
] | [] | [
"Spec.Blake2.Definitions.alg",
"Lib.IntTypes.size_t",
"FStar.Pervasives.Native.Mktuple2",
"Prims.op_AmpAmp",
"Lib.IntTypes.op_Equals_Dot",
"Lib.IntTypes.U32",
"FStar.UInt32.__uint_to_t",
"Lib.IntTypes.op_Greater_Dot",
"Lib.IntTypes.op_Subtraction_Bang",
"Lib.IntTypes.PUB",
"Prims.bool",
"Hacl.Impl.Blake2.Core.size_block",
"Lib.IntTypes.int_t",
"Lib.IntTypes.op_Percent_Dot",
"Lib.IntTypes.op_Slash_Dot",
"FStar.Pervasives.Native.tuple2",
"Prims.nat",
"Prims.l_and",
"Prims.eq2",
"Prims.int",
"Prims.l_or",
"Prims.b2t",
"Prims.op_GreaterThanOrEqual",
"Lib.IntTypes.range",
"Lib.IntTypes.v",
"Prims.op_Addition",
"Prims.op_Multiply",
"Spec.Blake2.Definitions.size_block",
"Spec.Blake2.split"
] | [] | false | false | false | false | false | let split_blocks al len =
| let nb = len /. size_block al in
let rem = len %. size_block al in
(if rem =. 0ul && nb >. 0ul then nb -! 1ul else nb),
(if rem =. 0ul && nb >. 0ul then size_block al else rem) | false |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.